@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
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { JsonTypeDefinition } from '~codeyam/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Simplify verbose function call keys for LLM consumption.
|
|
5
|
+
*
|
|
6
|
+
* The static analysis generates keys that include entire function call signatures
|
|
7
|
+
* with all arguments, including multi-line callback bodies. For example:
|
|
8
|
+
*
|
|
9
|
+
* ```
|
|
10
|
+
* "useQuery({ id: Number(id), pagination: debouncedPagination, onSuccess: async (quote) => { ...30 lines... } })"
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* These verbose keys confuse the LLM and cause it to miss generating data for some keys.
|
|
14
|
+
* This function simplifies keys to just the essential parts:
|
|
15
|
+
*
|
|
16
|
+
* ```
|
|
17
|
+
* "useQuery({ id, pagination, onSuccess: () => <truncated> })"
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* The reconcileMockDataKeys function already does fuzzy matching, so the LLM's
|
|
21
|
+
* simplified response keys will still match back to the original verbose keys.
|
|
22
|
+
*/
|
|
23
|
+
export default function simplifyKeysForLLM(
|
|
24
|
+
data: JsonTypeDefinition,
|
|
25
|
+
): JsonTypeDefinition {
|
|
26
|
+
if (typeof data !== 'object' || data === null) {
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const result: JsonTypeDefinition = {};
|
|
31
|
+
|
|
32
|
+
for (const key of Object.keys(data)) {
|
|
33
|
+
const simplifiedKey = simplifyFunctionCallKey(key);
|
|
34
|
+
const value = data[key];
|
|
35
|
+
|
|
36
|
+
// Recursively simplify nested objects
|
|
37
|
+
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
38
|
+
result[simplifiedKey] = simplifyKeysForLLM(value as JsonTypeDefinition);
|
|
39
|
+
} else if (Array.isArray(value)) {
|
|
40
|
+
// For arrays, recursively simplify each object element
|
|
41
|
+
result[simplifiedKey] = value.map((item) =>
|
|
42
|
+
typeof item === 'object' && item !== null && !Array.isArray(item)
|
|
43
|
+
? simplifyKeysForLLM(item as JsonTypeDefinition)
|
|
44
|
+
: item,
|
|
45
|
+
) as JsonTypeDefinition[];
|
|
46
|
+
} else {
|
|
47
|
+
result[simplifiedKey] = value;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Simplify a single function call key.
|
|
56
|
+
*
|
|
57
|
+
* Rules:
|
|
58
|
+
* 1. If key doesn't look like a function call, return as-is
|
|
59
|
+
* 2. For function calls with object arguments:
|
|
60
|
+
* - Keep property names
|
|
61
|
+
* - Replace complex values with simplified versions
|
|
62
|
+
* - Replace callbacks with () => ...
|
|
63
|
+
* 3. Cap total length at MAX_KEY_LENGTH
|
|
64
|
+
*/
|
|
65
|
+
function simplifyFunctionCallKey(key: string): string {
|
|
66
|
+
// If it doesn't look like a function call, return as-is
|
|
67
|
+
if (!key.includes('(')) {
|
|
68
|
+
return key;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Extract function name and arguments
|
|
72
|
+
const funcNameMatch = key.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*\(/);
|
|
73
|
+
if (!funcNameMatch) {
|
|
74
|
+
return key;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const funcName = funcNameMatch[1];
|
|
78
|
+
const argsStart = key.indexOf('(');
|
|
79
|
+
const argsContent = key.slice(argsStart + 1, -1); // Remove outer parens
|
|
80
|
+
|
|
81
|
+
// If args are empty or very short, return as-is
|
|
82
|
+
if (argsContent.trim().length < 50) {
|
|
83
|
+
return key;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Parse and simplify the arguments
|
|
87
|
+
const simplifiedArgs = simplifyArguments(argsContent);
|
|
88
|
+
const simplified = `${funcName}(${simplifiedArgs})`;
|
|
89
|
+
|
|
90
|
+
// Cap length - use <truncated> instead of ... to prevent LLMs from
|
|
91
|
+
// interpreting it as a fill-in placeholder (Issue #14)
|
|
92
|
+
const MAX_KEY_LENGTH = 150;
|
|
93
|
+
if (simplified.length > MAX_KEY_LENGTH) {
|
|
94
|
+
return simplified.slice(0, MAX_KEY_LENGTH - 11) + '<truncated>';
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return simplified;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Simplify function call arguments.
|
|
102
|
+
*
|
|
103
|
+
* Handles multiple arguments separated by commas, where each argument
|
|
104
|
+
* could be an object literal, a simple value, or a complex expression.
|
|
105
|
+
*/
|
|
106
|
+
function simplifyArguments(argsContent: string): string {
|
|
107
|
+
const trimmed = argsContent.trim();
|
|
108
|
+
|
|
109
|
+
// Split arguments at top-level commas (not inside nested structures)
|
|
110
|
+
const args = splitTopLevelArguments(trimmed);
|
|
111
|
+
|
|
112
|
+
const simplifiedArgs = args.map((arg) => {
|
|
113
|
+
const argTrimmed = arg.trim();
|
|
114
|
+
|
|
115
|
+
// Check if it's an object literal (starts with {)
|
|
116
|
+
if (argTrimmed.startsWith('{')) {
|
|
117
|
+
return simplifyObjectLiteral(argTrimmed);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// For non-object arguments, just truncate if needed
|
|
121
|
+
// Use <truncated> instead of ... to prevent LLMs from interpreting as fill-in
|
|
122
|
+
if (argTrimmed.length > 30) {
|
|
123
|
+
return argTrimmed.slice(0, 19) + '<truncated>';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return argTrimmed;
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
return simplifiedArgs.join(', ');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Split arguments at top-level commas, respecting nested braces/parens.
|
|
134
|
+
*/
|
|
135
|
+
function splitTopLevelArguments(argsContent: string): string[] {
|
|
136
|
+
const args: string[] = [];
|
|
137
|
+
let current = '';
|
|
138
|
+
let depth = 0;
|
|
139
|
+
let inString = false;
|
|
140
|
+
let stringChar = '';
|
|
141
|
+
|
|
142
|
+
for (let i = 0; i < argsContent.length; i++) {
|
|
143
|
+
const char = argsContent[i];
|
|
144
|
+
const prevChar = i > 0 ? argsContent[i - 1] : '';
|
|
145
|
+
|
|
146
|
+
// Handle string boundaries
|
|
147
|
+
if ((char === '"' || char === "'" || char === '`') && prevChar !== '\\') {
|
|
148
|
+
if (!inString) {
|
|
149
|
+
inString = true;
|
|
150
|
+
stringChar = char;
|
|
151
|
+
} else if (char === stringChar) {
|
|
152
|
+
inString = false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (!inString) {
|
|
157
|
+
if (char === '{' || char === '(' || char === '[') {
|
|
158
|
+
depth++;
|
|
159
|
+
} else if (char === '}' || char === ')' || char === ']') {
|
|
160
|
+
depth--;
|
|
161
|
+
} else if (char === ',' && depth === 0) {
|
|
162
|
+
// End of argument
|
|
163
|
+
if (current.trim()) {
|
|
164
|
+
args.push(current.trim());
|
|
165
|
+
}
|
|
166
|
+
current = '';
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
current += char;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Don't forget the last argument
|
|
175
|
+
if (current.trim()) {
|
|
176
|
+
args.push(current.trim());
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return args;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Simplify an object literal, keeping property names but simplifying values.
|
|
184
|
+
*/
|
|
185
|
+
function simplifyObjectLiteral(objStr: string): string {
|
|
186
|
+
// Extract property names and their values
|
|
187
|
+
const properties = extractObjectProperties(objStr);
|
|
188
|
+
|
|
189
|
+
if (properties.length === 0) {
|
|
190
|
+
return '{ }';
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const simplifiedProps = properties.map(({ name, value }) => {
|
|
194
|
+
const simplifiedValue = simplifyPropertyValue(value);
|
|
195
|
+
// If value is same as name (shorthand), just use name
|
|
196
|
+
if (simplifiedValue === name) {
|
|
197
|
+
return name;
|
|
198
|
+
}
|
|
199
|
+
return `${name}: ${simplifiedValue}`;
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
return `{ ${simplifiedProps.join(', ')} }`;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Extract property names and values from an object literal string.
|
|
207
|
+
*/
|
|
208
|
+
function extractObjectProperties(
|
|
209
|
+
objStr: string,
|
|
210
|
+
): Array<{ name: string; value: string }> {
|
|
211
|
+
const properties: Array<{ name: string; value: string }> = [];
|
|
212
|
+
|
|
213
|
+
// Remove outer braces and trim
|
|
214
|
+
let content = objStr.trim();
|
|
215
|
+
if (content.startsWith('{')) content = content.slice(1);
|
|
216
|
+
if (content.endsWith('}')) content = content.slice(0, -1);
|
|
217
|
+
content = content.trim();
|
|
218
|
+
|
|
219
|
+
// Parse properties, handling nested structures
|
|
220
|
+
let current = '';
|
|
221
|
+
let depth = 0;
|
|
222
|
+
let inString = false;
|
|
223
|
+
let stringChar = '';
|
|
224
|
+
|
|
225
|
+
for (let i = 0; i < content.length; i++) {
|
|
226
|
+
const char = content[i];
|
|
227
|
+
const prevChar = i > 0 ? content[i - 1] : '';
|
|
228
|
+
|
|
229
|
+
// Handle string boundaries
|
|
230
|
+
if ((char === '"' || char === "'" || char === '`') && prevChar !== '\\') {
|
|
231
|
+
if (!inString) {
|
|
232
|
+
inString = true;
|
|
233
|
+
stringChar = char;
|
|
234
|
+
} else if (char === stringChar) {
|
|
235
|
+
inString = false;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (!inString) {
|
|
240
|
+
if (char === '{' || char === '(' || char === '[') {
|
|
241
|
+
depth++;
|
|
242
|
+
} else if (char === '}' || char === ')' || char === ']') {
|
|
243
|
+
depth--;
|
|
244
|
+
} else if (char === ',' && depth === 0) {
|
|
245
|
+
// End of property
|
|
246
|
+
const prop = parseProperty(current.trim());
|
|
247
|
+
if (prop) properties.push(prop);
|
|
248
|
+
current = '';
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
current += char;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Don't forget the last property
|
|
257
|
+
if (current.trim()) {
|
|
258
|
+
const prop = parseProperty(current.trim());
|
|
259
|
+
if (prop) properties.push(prop);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return properties;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Parse a single property string into name and value.
|
|
267
|
+
*/
|
|
268
|
+
function parseProperty(
|
|
269
|
+
propStr: string,
|
|
270
|
+
): { name: string; value: string } | null {
|
|
271
|
+
// Handle shorthand properties (just a name)
|
|
272
|
+
const shorthandMatch = propStr.match(/^([a-zA-Z_][a-zA-Z0-9_]*)$/);
|
|
273
|
+
if (shorthandMatch) {
|
|
274
|
+
return { name: shorthandMatch[1], value: shorthandMatch[1] };
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// Handle name: value
|
|
278
|
+
const colonIndex = findPropertyColon(propStr);
|
|
279
|
+
if (colonIndex === -1) {
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const name = propStr.slice(0, colonIndex).trim();
|
|
284
|
+
const value = propStr.slice(colonIndex + 1).trim();
|
|
285
|
+
|
|
286
|
+
// Clean up property name (remove quotes if present)
|
|
287
|
+
const cleanName = name.replace(/^['"]|['"]$/g, '');
|
|
288
|
+
|
|
289
|
+
return { name: cleanName, value };
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Find the colon that separates property name from value.
|
|
294
|
+
* Must handle cases like { 'key': value } and { key: value }
|
|
295
|
+
*/
|
|
296
|
+
function findPropertyColon(propStr: string): number {
|
|
297
|
+
let depth = 0;
|
|
298
|
+
let inString = false;
|
|
299
|
+
let stringChar = '';
|
|
300
|
+
|
|
301
|
+
for (let i = 0; i < propStr.length; i++) {
|
|
302
|
+
const char = propStr[i];
|
|
303
|
+
const prevChar = i > 0 ? propStr[i - 1] : '';
|
|
304
|
+
|
|
305
|
+
if ((char === '"' || char === "'" || char === '`') && prevChar !== '\\') {
|
|
306
|
+
if (!inString) {
|
|
307
|
+
inString = true;
|
|
308
|
+
stringChar = char;
|
|
309
|
+
} else if (char === stringChar) {
|
|
310
|
+
inString = false;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (!inString) {
|
|
315
|
+
if (char === '{' || char === '(' || char === '[') {
|
|
316
|
+
depth++;
|
|
317
|
+
} else if (char === '}' || char === ')' || char === ']') {
|
|
318
|
+
depth--;
|
|
319
|
+
} else if (char === ':' && depth === 0) {
|
|
320
|
+
return i;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
return -1;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Simplify a property value.
|
|
330
|
+
*/
|
|
331
|
+
function simplifyPropertyValue(value: string): string {
|
|
332
|
+
const trimmed = value.trim();
|
|
333
|
+
|
|
334
|
+
// If it's a simple identifier, return as-is
|
|
335
|
+
if (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(trimmed)) {
|
|
336
|
+
return trimmed;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// If it's a simple literal (number, boolean, null, undefined), return as-is
|
|
340
|
+
if (/^(true|false|null|undefined|\d+(\.\d+)?)$/.test(trimmed)) {
|
|
341
|
+
return trimmed;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// If it's a short string literal, return as-is
|
|
345
|
+
if (
|
|
346
|
+
(trimmed.startsWith('"') || trimmed.startsWith("'")) &&
|
|
347
|
+
trimmed.length < 30
|
|
348
|
+
) {
|
|
349
|
+
return trimmed;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// If it looks like a function/arrow function, simplify
|
|
353
|
+
// Use <truncated> instead of ... to prevent LLMs from interpreting as fill-in
|
|
354
|
+
if (
|
|
355
|
+
trimmed.startsWith('function') ||
|
|
356
|
+
trimmed.startsWith('async function') ||
|
|
357
|
+
trimmed.includes('=>') ||
|
|
358
|
+
(trimmed.startsWith('(') && trimmed.includes('=>'))
|
|
359
|
+
) {
|
|
360
|
+
return '() => <truncated>';
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// If it's an object literal, recursively simplify
|
|
364
|
+
if (trimmed.startsWith('{')) {
|
|
365
|
+
const inner = simplifyObjectLiteral(trimmed);
|
|
366
|
+
if (inner.length > 50) {
|
|
367
|
+
return '{ <truncated> }';
|
|
368
|
+
}
|
|
369
|
+
return inner;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// If it's an array, simplify
|
|
373
|
+
// Use <truncated> instead of ... to prevent LLMs from interpreting as fill-in
|
|
374
|
+
if (trimmed.startsWith('[')) {
|
|
375
|
+
return '[<truncated>]';
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// For complex expressions, extract the first identifier or truncate
|
|
379
|
+
// Use <truncated> instead of ... to prevent LLMs from interpreting as fill-in
|
|
380
|
+
const identMatch = trimmed.match(/^([a-zA-Z_][a-zA-Z0-9_]*)/);
|
|
381
|
+
if (identMatch && trimmed.length > 30) {
|
|
382
|
+
return identMatch[1] + '<truncated>';
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// Truncate long values
|
|
386
|
+
if (trimmed.length > 30) {
|
|
387
|
+
return trimmed.slice(0, 19) + '<truncated>';
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
return trimmed;
|
|
391
|
+
}
|
|
@@ -336,6 +336,7 @@ function findControllablePrefix(
|
|
|
336
336
|
// Check direct match in attributesMap
|
|
337
337
|
if (prefix in attributesMap) {
|
|
338
338
|
const type = attributesMap[prefix];
|
|
339
|
+
|
|
339
340
|
// For objects, arrays, or unknown types, nested property access is controllable
|
|
340
341
|
if (
|
|
341
342
|
isArrayType(type) ||
|
|
@@ -375,16 +376,6 @@ function findControllableBaseForDerivedPath(
|
|
|
375
376
|
path: string,
|
|
376
377
|
attributesMap: Record<string, string>,
|
|
377
378
|
): string | null {
|
|
378
|
-
// Use cleanPathOfNonTransformingFunctions to strip non-transforming methods
|
|
379
|
-
// like .filter(), .sort(), .slice() etc. This handles all method calls generically
|
|
380
|
-
// without hardcoding specific method names.
|
|
381
|
-
const cleanedPath = cleanPathOfNonTransformingFunctions(path);
|
|
382
|
-
|
|
383
|
-
// If the path wasn't changed, there are no non-transforming functions to strip
|
|
384
|
-
if (cleanedPath === path) {
|
|
385
|
-
return null;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
379
|
// Helper to check if a path is in attributesMap
|
|
389
380
|
const checkInAttributesMap = (pathToCheck: string): string | null => {
|
|
390
381
|
// Direct match
|
|
@@ -401,21 +392,121 @@ function findControllableBaseForDerivedPath(
|
|
|
401
392
|
return null;
|
|
402
393
|
};
|
|
403
394
|
|
|
404
|
-
//
|
|
395
|
+
// Use cleanPathOfNonTransformingFunctions to strip non-transforming methods
|
|
396
|
+
// like .filter(), .sort(), .slice() etc. This handles all method calls generically
|
|
397
|
+
// without hardcoding specific method names.
|
|
398
|
+
const cleanedPath = cleanPathOfNonTransformingFunctions(path);
|
|
399
|
+
|
|
400
|
+
// Check the cleaned path directly (even if unchanged, later steps may find something)
|
|
405
401
|
const directResult = checkInAttributesMap(cleanedPath);
|
|
406
402
|
if (directResult) {
|
|
407
403
|
return directResult;
|
|
408
404
|
}
|
|
409
405
|
|
|
410
|
-
//
|
|
411
|
-
|
|
406
|
+
// Fix 38: For controllability purposes, strip ALL derivation operations
|
|
407
|
+
// including transforming methods like .split(...) and array indices.
|
|
408
|
+
// The key insight is: if we control the base, we control all derived values.
|
|
409
|
+
//
|
|
410
|
+
// Pattern: base.split('...').filter(...)[N] → find base
|
|
411
|
+
// We progressively strip: [N] → filter(...) → split(...) → until we find something controllable
|
|
412
|
+
|
|
413
|
+
// Methods that derive new values (should be stripped for controllability)
|
|
414
|
+
const derivingMethods = [
|
|
415
|
+
'split',
|
|
416
|
+
'match',
|
|
417
|
+
'filter',
|
|
418
|
+
'map',
|
|
419
|
+
'find',
|
|
420
|
+
'findIndex',
|
|
421
|
+
'slice',
|
|
422
|
+
'substring',
|
|
423
|
+
'substr',
|
|
424
|
+
'trim',
|
|
425
|
+
'trimStart',
|
|
426
|
+
'trimEnd',
|
|
427
|
+
'toLowerCase',
|
|
428
|
+
'toUpperCase',
|
|
429
|
+
'replace',
|
|
430
|
+
'replaceAll',
|
|
431
|
+
'sort',
|
|
432
|
+
'reverse',
|
|
433
|
+
'flat',
|
|
434
|
+
'flatMap',
|
|
435
|
+
];
|
|
436
|
+
|
|
437
|
+
// Build regex to match method calls: .methodName(...)
|
|
438
|
+
// Use a simpler approach: progressively strip trailing derivations
|
|
439
|
+
let workingPath = cleanedPath;
|
|
440
|
+
|
|
441
|
+
// Keep stripping derivations until we find something controllable or can't strip anymore
|
|
442
|
+
// Max 20 iterations to prevent infinite loops
|
|
443
|
+
for (let iteration = 0; iteration < 20; iteration++) {
|
|
444
|
+
// Try current path
|
|
445
|
+
const result = checkInAttributesMap(workingPath);
|
|
446
|
+
if (result) {
|
|
447
|
+
return result;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// Also check via functionCallReturnValue extraction
|
|
451
|
+
// Note: We return workingPath (the FULL path) if the short path is found,
|
|
452
|
+
// because the full path is more meaningful for execution flows
|
|
453
|
+
const functionReturnMatch = workingPath.match(
|
|
454
|
+
/\.functionCallReturnValue\.(.+)$/,
|
|
455
|
+
);
|
|
456
|
+
if (functionReturnMatch) {
|
|
457
|
+
const shortPath = functionReturnMatch[1];
|
|
458
|
+
const shortResult = checkInAttributesMap(shortPath);
|
|
459
|
+
if (shortResult) {
|
|
460
|
+
// Return the full path, not just the short result
|
|
461
|
+
// This ensures execution flows have meaningful paths like
|
|
462
|
+
// "useParams().functionCallReturnValue.*" instead of just "*"
|
|
463
|
+
return workingPath;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// Try to strip trailing array index: path[0] → path
|
|
468
|
+
const arrayIndexMatch = workingPath.match(/^(.+)\[\d+\]$/);
|
|
469
|
+
if (arrayIndexMatch) {
|
|
470
|
+
workingPath = arrayIndexMatch[1];
|
|
471
|
+
continue;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// Try to strip trailing method call: path.method(...) → path
|
|
475
|
+
let strippedMethod = false;
|
|
476
|
+
for (const method of derivingMethods) {
|
|
477
|
+
// Match .method(...) at the end, handling nested parentheses
|
|
478
|
+
const methodRegex = new RegExp(
|
|
479
|
+
`\\.${method}\\([^()]*(?:\\([^()]*\\)[^()]*)*\\)$`,
|
|
480
|
+
);
|
|
481
|
+
if (methodRegex.test(workingPath)) {
|
|
482
|
+
workingPath = workingPath.replace(methodRegex, '');
|
|
483
|
+
strippedMethod = true;
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
if (!strippedMethod) {
|
|
489
|
+
// Can't strip anymore
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// Final check after stripping
|
|
495
|
+
const finalResult = checkInAttributesMap(workingPath);
|
|
496
|
+
if (finalResult) {
|
|
497
|
+
return finalResult;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// Also check via functionCallReturnValue extraction for final path
|
|
501
|
+
const finalFunctionReturnMatch = workingPath.match(
|
|
412
502
|
/\.functionCallReturnValue\.(.+)$/,
|
|
413
503
|
);
|
|
414
|
-
if (
|
|
415
|
-
const shortPath =
|
|
504
|
+
if (finalFunctionReturnMatch) {
|
|
505
|
+
const shortPath = finalFunctionReturnMatch[1];
|
|
416
506
|
const shortResult = checkInAttributesMap(shortPath);
|
|
417
507
|
if (shortResult) {
|
|
418
|
-
|
|
508
|
+
// Return the full path, not just the short result
|
|
509
|
+
return workingPath;
|
|
419
510
|
}
|
|
420
511
|
}
|
|
421
512
|
|
|
@@ -593,10 +684,11 @@ export default function resolvePathToControllable(
|
|
|
593
684
|
};
|
|
594
685
|
}
|
|
595
686
|
|
|
596
|
-
// Fix 34: Handle derived paths from controllable bases
|
|
687
|
+
// Fix 34/38: Handle derived paths from controllable bases
|
|
597
688
|
// Paths like "useParams().functionCallReturnValue.*.split('/').filter(Boolean)[0]"
|
|
598
689
|
// are derived from "useParams().functionCallReturnValue.*" via string methods.
|
|
599
|
-
// If the base path is controllable, the
|
|
690
|
+
// If the base path is controllable, return the BASE path (not the derived path)
|
|
691
|
+
// because that's what we need to mock in the data structure.
|
|
600
692
|
const derivedBaseResult = findControllableBaseForDerivedPath(
|
|
601
693
|
fullResolvedPath,
|
|
602
694
|
attributesMap,
|
|
@@ -604,7 +696,9 @@ export default function resolvePathToControllable(
|
|
|
604
696
|
if (derivedBaseResult) {
|
|
605
697
|
chain.push(`derived from controllable base: ${derivedBaseResult}`);
|
|
606
698
|
return {
|
|
607
|
-
|
|
699
|
+
// Return the controllable BASE path, not the derived path
|
|
700
|
+
// This ensures execution flows contain paths that exist in attributesMap
|
|
701
|
+
resolvedPath: derivedBaseResult,
|
|
608
702
|
resolutionChain: chain,
|
|
609
703
|
isControllable: true,
|
|
610
704
|
};
|
|
@@ -632,21 +726,48 @@ export default function resolvePathToControllable(
|
|
|
632
726
|
// 5. Fix 35: Check for controllable prefix on the local path directly
|
|
633
727
|
// This handles cases where the localPath itself (before any resolution)
|
|
634
728
|
// has a controllable prefix in attributesMap
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
729
|
+
//
|
|
730
|
+
// IMPORTANT: Only do prefix matching if:
|
|
731
|
+
// a) The root variable is known in equivalentSignatureVariables, OR
|
|
732
|
+
// b) The path looks like an already-translated path (contains .functionCallReturnValue.)
|
|
733
|
+
//
|
|
734
|
+
// If the root variable is NOT known AND it's not an already-translated path, it's likely
|
|
735
|
+
// from an internal scope (callback, async function) and shouldn't be matched
|
|
736
|
+
// against similarly-named variables from different scopes.
|
|
737
|
+
// For example, "data.status" from inside `await response.json()` should NOT
|
|
738
|
+
// match the "data" from a useFetcher hook.
|
|
739
|
+
const localVarNameForPrefix = extractLocalVariableName(localPath);
|
|
740
|
+
const isKnownVariable = localVarNameForPrefix in equivalentSignatureVariables;
|
|
741
|
+
|
|
742
|
+
// Fix 35b: Also allow prefix matching for already-translated paths from child components
|
|
743
|
+
// These paths start with hook patterns like useLoaderData<...>().functionCallReturnValue
|
|
744
|
+
// and should be checked for controllable prefixes even if the hook itself isn't
|
|
745
|
+
// in equivalentSignatureVariables (because it's a fully resolved path, not a local variable)
|
|
746
|
+
const isAlreadyTranslatedPath = localPath.includes(
|
|
747
|
+
'.functionCallReturnValue.',
|
|
639
748
|
);
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
749
|
+
|
|
750
|
+
if (isKnownVariable || isAlreadyTranslatedPath) {
|
|
751
|
+
const localPrefixResult = findControllablePrefix(
|
|
752
|
+
localPath,
|
|
753
|
+
attributesMap,
|
|
754
|
+
fullToShortPathMap,
|
|
755
|
+
);
|
|
756
|
+
if (localPrefixResult) {
|
|
757
|
+
chain.push(`nested property of controllable prefix (direct)`);
|
|
758
|
+
return {
|
|
759
|
+
resolvedPath: localPath,
|
|
760
|
+
resolutionChain: chain,
|
|
761
|
+
isControllable: true,
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
} else {
|
|
765
|
+
chain.push(
|
|
766
|
+
`root variable '${localVarNameForPrefix}' not in equivalentSignatureVariables - skipping prefix match`,
|
|
767
|
+
);
|
|
647
768
|
}
|
|
648
769
|
|
|
649
|
-
// 5b. Fix 36: Check for derived paths on localPath directly
|
|
770
|
+
// 5b. Fix 36/38: Check for derived paths on localPath directly
|
|
650
771
|
// When localPath contains derivation methods like .filter(cyScope()), check if
|
|
651
772
|
// the base path (before .filter()) is controllable
|
|
652
773
|
const localDerivedResult = findControllableBaseForDerivedPath(
|
|
@@ -658,7 +779,8 @@ export default function resolvePathToControllable(
|
|
|
658
779
|
`derived from controllable base (direct): ${localDerivedResult}`,
|
|
659
780
|
);
|
|
660
781
|
return {
|
|
661
|
-
|
|
782
|
+
// Return the controllable BASE path, not the derived path
|
|
783
|
+
resolvedPath: localDerivedResult,
|
|
662
784
|
resolutionChain: chain,
|
|
663
785
|
isControllable: true,
|
|
664
786
|
};
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import type {
|
|
14
14
|
ConditionalEffect,
|
|
15
15
|
CompoundConditional,
|
|
16
|
+
JsxRenderingUsage,
|
|
16
17
|
} from '../astScopes/types';
|
|
17
18
|
|
|
18
19
|
export interface SerializableScopeVariable {
|
|
@@ -101,7 +102,8 @@ export interface EnrichedConditionalUsage {
|
|
|
101
102
|
| 'and'
|
|
102
103
|
| 'arrayIncludes'
|
|
103
104
|
| 'arraySome'
|
|
104
|
-
| 'arrayEvery'
|
|
105
|
+
| 'arrayEvery'
|
|
106
|
+
| 'arrayLength';
|
|
105
107
|
/** For comparison operations, the value being compared to */
|
|
106
108
|
comparedValue?: string;
|
|
107
109
|
};
|
|
@@ -154,6 +156,15 @@ export interface SerializableDataStructure {
|
|
|
154
156
|
* This allows us to merge child component execution flows with parent gating conditions.
|
|
155
157
|
*/
|
|
156
158
|
childBoundaryGatingConditions?: Record<string, EnrichedConditionalUsage[]>;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* JSX rendering usages - tracks arrays rendered via .map() and strings interpolated in JSX.
|
|
162
|
+
* Used to generate execution flows for array sizes and text lengths without explicit conditionals.
|
|
163
|
+
*
|
|
164
|
+
* Example:
|
|
165
|
+
* {items.map(i => <Item {...i} />)} produces an array-map usage for 'items'
|
|
166
|
+
*/
|
|
167
|
+
jsxRenderingUsages?: JsxRenderingUsage[];
|
|
157
168
|
}
|
|
158
169
|
|
|
159
170
|
/**
|
|
@@ -329,3 +340,13 @@ export function getChildBoundaryGatingConditions(
|
|
|
329
340
|
): Record<string, EnrichedConditionalUsage[]> {
|
|
330
341
|
return dataStructure.childBoundaryGatingConditions ?? {};
|
|
331
342
|
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Get JSX rendering usages (arrays rendered via .map() and strings interpolated in JSX).
|
|
346
|
+
* Returns the array of JSX rendering usages, or empty array if not available.
|
|
347
|
+
*/
|
|
348
|
+
export function getJsxRenderingUsages(
|
|
349
|
+
dataStructure: SerializableDataStructure,
|
|
350
|
+
): JsxRenderingUsage[] {
|
|
351
|
+
return dataStructure.jsxRenderingUsages ?? [];
|
|
352
|
+
}
|