@codeyam/codeyam-cli 0.1.0-staging.323686 → 0.1.0-staging.4813bf3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analyzer-template/.build-info.json +7 -7
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +5 -5
- package/analyzer-template/packages/ai/index.ts +7 -1
- package/analyzer-template/packages/ai/package.json +2 -2
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +62 -18
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +67 -9
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +409 -50
- package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +21 -6
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +992 -249
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +5 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +16 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +6 -4
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +31 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +37 -15
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +126 -11
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +367 -96
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +33 -15
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +58 -3
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +315 -6
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +9 -5
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +49 -5
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +649 -142
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +51 -3
- package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
- package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +90 -96
- package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +10 -7
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +24 -4
- package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +25 -13
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +4 -3
- package/analyzer-template/packages/analyze/index.ts +2 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +65 -59
- package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +113 -26
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +89 -9
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +19 -4
- package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +0 -3
- package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
- package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +14 -12
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1315 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +61 -13
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +37 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +229 -19
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +117 -9
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +459 -39
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
- package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
- package/analyzer-template/packages/aws/package.json +1 -1
- package/analyzer-template/packages/database/package.json +1 -1
- package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +6 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
- package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
- package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +3 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts +23 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +7 -0
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +5 -5
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/package.json +1 -1
- package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +7 -0
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +6 -5
- package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +7 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +5 -5
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
- package/analyzer-template/project/constructMockCode.ts +90 -10
- package/analyzer-template/project/writeMockDataTsx.ts +181 -8
- package/analyzer-template/project/writeScenarioComponents.ts +60 -12
- package/analyzer-template/project/writeSimpleRoot.ts +21 -11
- package/background/src/lib/local/createLocalAnalyzer.js +1 -1
- package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +75 -4
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +162 -4
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +60 -15
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeSimpleRoot.js +21 -11
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +180 -0
- package/codeyam-cli/scripts/apply-setup.js.map +1 -1
- package/codeyam-cli/src/cli.js +2 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/codeyam-cli.js +18 -2
- package/codeyam-cli/src/codeyam-cli.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +4 -2
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/baseline.js +2 -0
- package/codeyam-cli/src/commands/baseline.js.map +1 -1
- package/codeyam-cli/src/commands/debug.js +9 -5
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +31 -20
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/detect-universal-mocks.js +2 -0
- package/codeyam-cli/src/commands/detect-universal-mocks.js.map +1 -1
- package/codeyam-cli/src/commands/init.js +49 -257
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +17 -26
- package/codeyam-cli/src/commands/memory.js.map +1 -1
- package/codeyam-cli/src/commands/recapture.js +2 -0
- package/codeyam-cli/src/commands/recapture.js.map +1 -1
- package/codeyam-cli/src/commands/setup-sandbox.js +2 -0
- package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
- package/codeyam-cli/src/commands/setup-simulations.js +284 -0
- package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
- package/codeyam-cli/src/commands/test-startup.js +2 -0
- package/codeyam-cli/src/commands/test-startup.js.map +1 -1
- package/codeyam-cli/src/commands/verify.js +14 -2
- package/codeyam-cli/src/commands/verify.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +128 -86
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +7 -0
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +5 -0
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/generateReport.js +2 -2
- package/codeyam-cli/src/utils/install-skills.js +70 -45
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/labsAutoCheck.js +19 -0
- package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
- package/codeyam-cli/src/utils/progress.js +7 -0
- package/codeyam-cli/src/utils/progress.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +4 -0
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/requireSimulations.js +10 -0
- package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +230 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +75 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +378 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +115 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/index.js +1 -0
- package/codeyam-cli/src/utils/rules/index.js.map +1 -1
- package/codeyam-cli/src/utils/rules/parser.js +2 -25
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
- package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
- package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
- package/codeyam-cli/src/utils/rules/staleness.js +16 -11
- package/codeyam-cli/src/utils/rules/staleness.js.map +1 -1
- package/codeyam-cli/src/utils/serverState.js +37 -10
- package/codeyam-cli/src/utils/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +21 -44
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js +15 -3
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/backgroundServer.js +24 -0
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CA3JxPb7.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-DsN1wKrm.js → EntityItem-B86KKU7e.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DLqD3qNt.js → EntityTypeBadge-B5ctlSYt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-Ba2JVPzP.js → EntityTypeIcon-BqY8gDAW.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-C8lyxW9k.js → InlineSpinner-ClaLpuOo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-aht4aafF.js → InteractivePreview-BDhPilK7.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CVtiBnY5.js → LibraryFunctionPreview-VeqEBv9v.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-B0GLXMsr.js → LoadingDots-Bs7Nn1Jr.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-xgeCVgSM.js → LogViewer-Bm3PmcCz.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-OApQuNyq.js → ReportIssueModal-CgMEzchJ.js} +3 -8
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-DuDvi0jm.js → SafeScreenshot-Gq3Ocjo6.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DzccYyI8.js → ScenarioViewer-CBui0id_.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-DyFZkK0l.js → TruncatedFilePath-CiwXDxLh.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{_index-BwqWJOgH.js → _index-B3TDXxnk.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BwavGCpm.js → activity.(_tab)-BtBFH820.js} +6 -11
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-CN61MOMa.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.agent-transcripts-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/book-open-PttOB2SF.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-Cx24_aWc.js → chevron-down-TJp6ofnp.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-CXRTFQ3F.js → chunk-JZWAC4HX-JE9ZIoBl.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BOARzkeR.js → circle-check-CXhHQYrI.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/copy-6y9ALfGT.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-BdhJEx6B.js → createLucideIcon-Ca9fAY46.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-BBnGWYga.js → dev.empty-C0epRiVn.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BJUiQqZF.js → entity._sha._-BVnB8a9L.js} +10 -10
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js → entity._sha.scenarios._scenarioId.fullscreen-CBoafmVs.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-D1T4TGjf.js → entity._sha_.create-scenario-DGgZjdFg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CTBG2mmz.js → entity._sha_.edit._scenarioId-38yPijoD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CS2cb_eZ.js → entry.client-BSHEfydn.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DMJ7zii9.js → fileTableUtils-DCPhhSMo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{files-CJ6lTdTA.js → files-0N0YJQv7.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{git-CPTZZ-JZ.js → git-DXnyr8uP.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-CKT08Djd.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-lzqtyFU8.js → index-CcsFv748.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-B1h680n5.js → index-ChN9-fAY.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-BLJ7HxOC.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-B7B9V-bu.js → loader-circle-CTqLEAGU.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-b171b9d3.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-CCQd4aZA.js +78 -0
- package/codeyam-cli/src/webserver/build/client/assets/pause-D6vreykR.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-CHhiHoo_.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-CxXUmBSd.js → search-B8VUL8nl.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-BejnUJ6R.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{simulations-DwFIBT09.js → simulations-CPoAg7Zo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/terminal-BrCP7uQo.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-B6LgvRJg.js → triangle-alert-BZz2NjYa.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-C1v1PQzo.js → useCustomSizes-DNwUduNu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-aSv48UbS.js → useLastLogLine-COky1GVF.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DYxHZQuP.js → useReportContext-CpZgwliL.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-mBRpZPiu.js → useToast-Bv9JFvUO.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/{index-DVzYx8PN.js → index-8Fv-lH1-.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-Akn3iYFP.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:debug.md → codeyam-debug.md} +1 -1
- package/codeyam-cli/templates/codeyam-diagnose.md +481 -0
- package/codeyam-cli/templates/codeyam-memory-hook.sh +19 -20
- package/codeyam-cli/templates/codeyam-memory.md +392 -0
- package/codeyam-cli/templates/codeyam-new-rule.md +13 -0
- package/codeyam-cli/templates/{codeyam:setup.md → codeyam-setup.md} +13 -1
- package/codeyam-cli/templates/{codeyam:sim.md → codeyam-sim.md} +1 -1
- package/codeyam-cli/templates/{codeyam:test.md → codeyam-test.md} +1 -1
- package/codeyam-cli/templates/{codeyam:verify.md → codeyam-verify.md} +1 -1
- package/codeyam-cli/templates/rule-notification-hook.py +56 -0
- package/codeyam-cli/templates/rule-reflection-hook.py +627 -0
- package/codeyam-cli/templates/rules-instructions.md +132 -0
- package/package.json +2 -2
- package/packages/ai/index.js +3 -2
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +50 -13
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +54 -8
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
- package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +317 -44
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
- package/packages/ai/src/lib/astScopes/sharedPatterns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +763 -171
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +5 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +33 -3
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +36 -11
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
- package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +113 -11
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +309 -84
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructureChunking.js +26 -11
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +46 -2
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +227 -4
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +7 -1
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +26 -4
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +447 -80
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
- package/packages/ai/src/lib/isolateScopes.js +39 -3
- package/packages/ai/src/lib/isolateScopes.js.map +1 -1
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
- package/packages/ai/src/lib/mergeStatements.js +70 -51
- package/packages/ai/src/lib/mergeStatements.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +10 -4
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +17 -2
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/resolvePathToControllable.js +24 -14
- package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/analyze/index.js +1 -0
- package/packages/analyze/index.js.map +1 -1
- package/packages/analyze/src/lib/FileAnalyzer.js +60 -36
- package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/ProjectAnalyzer.js +96 -26
- package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +65 -7
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +17 -4
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +0 -3
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
- package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
- package/packages/analyze/src/lib/files/getImportedExports.js +11 -7
- package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +880 -0
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +56 -10
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +33 -8
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +150 -17
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +56 -8
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +399 -31
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
- package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/index.js +1 -0
- package/packages/analyze/src/lib/index.js.map +1 -1
- package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
- package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
- package/packages/database/src/lib/analysisBranchToDb.js +1 -1
- package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
- package/packages/database/src/lib/analysisToDb.js +1 -1
- package/packages/database/src/lib/analysisToDb.js.map +1 -1
- package/packages/database/src/lib/branchToDb.js +1 -1
- package/packages/database/src/lib/branchToDb.js.map +1 -1
- package/packages/database/src/lib/commitBranchToDb.js +1 -1
- package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
- package/packages/database/src/lib/commitToDb.js +1 -1
- package/packages/database/src/lib/commitToDb.js.map +1 -1
- package/packages/database/src/lib/fileToDb.js +1 -1
- package/packages/database/src/lib/fileToDb.js.map +1 -1
- package/packages/database/src/lib/kysely/db.js +3 -0
- package/packages/database/src/lib/kysely/db.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
- package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/packages/database/src/lib/projectToDb.js +1 -1
- package/packages/database/src/lib/projectToDb.js.map +1 -1
- package/packages/database/src/lib/saveFiles.js +1 -1
- package/packages/database/src/lib/saveFiles.js.map +1 -1
- package/packages/database/src/lib/scenarioToDb.js +1 -1
- package/packages/database/src/lib/scenarioToDb.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +8 -76
- package/codeyam-cli/src/webserver/build/client/assets/copy-Bb-80kDT.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/file-code-Dhef1kWN.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/globals-D3yhhV8x.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-7522edd4.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory-yxFcrxBX.js +0 -92
- package/codeyam-cli/src/webserver/build/client/assets/root-eVAaavTS.js +0 -62
- package/codeyam-cli/src/webserver/build/client/assets/settings-CS5f3WzT.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-4Cr0uToj.js +0 -257
- package/codeyam-cli/templates/codeyam:diagnose.md +0 -803
- package/codeyam-cli/templates/codeyam:memory.md +0 -462
- package/codeyam-cli/templates/codeyam:new-rule.md +0 -13
package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts
ADDED
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { splitOutsideParenthesesAndArrays } from '~codeyam/ai';
|
|
2
|
+
import { DataStructure } from '~codeyam/types';
|
|
3
|
+
|
|
4
|
+
// Safety limits to prevent combinatorial explosion
|
|
5
|
+
const MAX_SCHEMA_PATHS = 15000; // Don't propagate if schema already has this many paths
|
|
6
|
+
const MAX_PATHS_TO_ADD = 5000; // Stop adding paths after this many new paths
|
|
7
|
+
const MAX_ARRAY_NESTING_DEPTH = 3; // Don't propagate paths with more than this many [] levels
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Count the number of array levels in a path.
|
|
11
|
+
* e.g., "entities[].analyses[].scenarios[]" has 3 levels
|
|
12
|
+
*/
|
|
13
|
+
function countArrayLevels(path: string): number {
|
|
14
|
+
return (path.match(/\[\]/g) || []).length;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Check if appending suffix to prefix would create a recursive path.
|
|
19
|
+
* A path is recursive if it contains the same array name twice.
|
|
20
|
+
* e.g., "entities[].analyses[].scenarios[].analyses[]" has "analyses" twice.
|
|
21
|
+
*/
|
|
22
|
+
function wouldCreateRecursivePath(prefix: string, suffix: string): boolean {
|
|
23
|
+
// Extract array names from prefix (names that appear before [])
|
|
24
|
+
const prefixArrayNames = new Set<string>();
|
|
25
|
+
const prefixMatches = prefix.matchAll(/\.?([a-zA-Z_][a-zA-Z0-9_]*)\[\]/g);
|
|
26
|
+
for (const match of prefixMatches) {
|
|
27
|
+
prefixArrayNames.add(match[1].toLowerCase());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Check if any array name in suffix already exists in prefix
|
|
31
|
+
const suffixMatches = suffix.matchAll(/\.?([a-zA-Z_][a-zA-Z0-9_]*)\[\]/g);
|
|
32
|
+
for (const match of suffixMatches) {
|
|
33
|
+
if (prefixArrayNames.has(match[1].toLowerCase())) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Propagates array item schemas between arrays that likely have the same type.
|
|
43
|
+
*
|
|
44
|
+
* When the Rust analyzer traces property accesses, it may trace item properties for
|
|
45
|
+
* one array but not another, even though they have the same TypeScript type. This
|
|
46
|
+
* happens when:
|
|
47
|
+
* - One array is accessed directly in code (e.g., `entities.forEach(e => e.name)`)
|
|
48
|
+
* - Another array is only used as a fallback in an OR expression
|
|
49
|
+
* (e.g., `const displayEntities = currentlyExecuting?.entities || currentEntities`)
|
|
50
|
+
*
|
|
51
|
+
* In this case, `entities` gets `entities[]`, `entities[].name`, etc. traced,
|
|
52
|
+
* but `currentEntities` only gets `currentEntities: "array"` with no item schema.
|
|
53
|
+
*
|
|
54
|
+
* This function finds arrays without item schemas and copies item schemas from
|
|
55
|
+
* other arrays that appear to have the same type based on naming conventions.
|
|
56
|
+
*
|
|
57
|
+
* Heuristics for matching arrays:
|
|
58
|
+
* 1. Same suffix (e.g., `currentEntities` matches `entities`, `queueJobs[].entities` matches `entities`)
|
|
59
|
+
* 2. One name is a plural/singular form of the other
|
|
60
|
+
*/
|
|
61
|
+
export default function propagateArrayItemSchemas(
|
|
62
|
+
dependencySchemas: DataStructure['dependencySchemas'],
|
|
63
|
+
): void {
|
|
64
|
+
if (!dependencySchemas) {
|
|
65
|
+
console.log('[PROPAGATE] No dependencySchemas provided');
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Log what we're working with
|
|
70
|
+
const packages = Object.keys(dependencySchemas);
|
|
71
|
+
console.log('[PROPAGATE] Processing packages:', packages);
|
|
72
|
+
|
|
73
|
+
// PHASE 1: Run per-entity propagation (original behavior)
|
|
74
|
+
// This propagates array item schemas within each entity's own schema.
|
|
75
|
+
console.log('[PROPAGATE] === PHASE 1: Per-entity propagation ===');
|
|
76
|
+
for (const filePath in dependencySchemas) {
|
|
77
|
+
for (const entityName in dependencySchemas[filePath]) {
|
|
78
|
+
const schema = dependencySchemas[filePath][entityName]?.returnValueSchema;
|
|
79
|
+
if (!schema) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const beforeCount = Object.keys(schema).length;
|
|
83
|
+
|
|
84
|
+
propagateArrayItemSchemasInSchema(schema);
|
|
85
|
+
|
|
86
|
+
const afterCount = Object.keys(schema).length;
|
|
87
|
+
|
|
88
|
+
if (beforeCount !== afterCount) {
|
|
89
|
+
console.log(
|
|
90
|
+
`[PROPAGATE] PHASE1 ${filePath}/${entityName}: ${beforeCount} -> ${afterCount} paths`,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// PHASE 2: Cross-entity propagation within the same package
|
|
97
|
+
// When we have call-specific entities like `useLoaderData<typeof loader>()`,
|
|
98
|
+
// they may be missing array item paths that exist in the base entity `useLoaderData`.
|
|
99
|
+
// Copy array item paths from base entities to call-specific entities.
|
|
100
|
+
console.log('[PROPAGATE] === PHASE 2: Cross-entity propagation ===');
|
|
101
|
+
for (const filePath in dependencySchemas) {
|
|
102
|
+
const entities = dependencySchemas[filePath];
|
|
103
|
+
const entityNames = Object.keys(entities);
|
|
104
|
+
|
|
105
|
+
for (const entityName of entityNames) {
|
|
106
|
+
// Check if this is a call-specific entity (ends with function call syntax)
|
|
107
|
+
if (!entityName.includes('(')) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Find the base entity name (e.g., "useLoaderData<typeof loader>()" -> "useLoaderData")
|
|
112
|
+
const baseEntityName = entityName.split(/[(<]/)[0];
|
|
113
|
+
|
|
114
|
+
if (!baseEntityName || !entities[baseEntityName]) {
|
|
115
|
+
console.log(
|
|
116
|
+
`[PROPAGATE] PHASE2: No base entity '${baseEntityName}' for '${entityName}'`,
|
|
117
|
+
);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const callSpecificSchema = entities[entityName]?.returnValueSchema;
|
|
122
|
+
const baseSchema = entities[baseEntityName]?.returnValueSchema;
|
|
123
|
+
|
|
124
|
+
if (!callSpecificSchema || !baseSchema) {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
console.log(
|
|
129
|
+
`[PROPAGATE] PHASE2: Copying from '${baseEntityName}' (${Object.keys(baseSchema).length} paths) to '${entityName}' (${Object.keys(callSpecificSchema).length} paths)`,
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
// Check what paths exist in base but not in call-specific
|
|
133
|
+
const baseHasEntitiesFilePath = Object.keys(baseSchema).some((p) =>
|
|
134
|
+
p.includes('currentlyExecuting.entities[].filePath'),
|
|
135
|
+
);
|
|
136
|
+
const callSpecificHasEntitiesFilePath = Object.keys(
|
|
137
|
+
callSpecificSchema,
|
|
138
|
+
).some((p) => p.includes('currentlyExecuting.entities[].filePath'));
|
|
139
|
+
|
|
140
|
+
console.log(
|
|
141
|
+
`[PROPAGATE] PHASE2: base has currentlyExecuting.entities[].filePath: ${baseHasEntitiesFilePath}`,
|
|
142
|
+
);
|
|
143
|
+
console.log(
|
|
144
|
+
`[PROPAGATE] PHASE2: callSpecific has currentlyExecuting.entities[].filePath: ${callSpecificHasEntitiesFilePath}`,
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
// Copy any array item paths from base schema to call-specific schema
|
|
148
|
+
// that are missing in the call-specific schema
|
|
149
|
+
let copiedCount = 0;
|
|
150
|
+
const copiedPaths: string[] = [];
|
|
151
|
+
for (const path in baseSchema) {
|
|
152
|
+
// Only copy paths that include array element notation
|
|
153
|
+
if (!path.includes('[]')) continue;
|
|
154
|
+
// Only copy if not already present
|
|
155
|
+
if (callSpecificSchema[path]) continue;
|
|
156
|
+
|
|
157
|
+
callSpecificSchema[path] = baseSchema[path];
|
|
158
|
+
copiedCount++;
|
|
159
|
+
|
|
160
|
+
// Track specific paths we care about
|
|
161
|
+
if (path.includes('currentlyExecuting.entities[]')) {
|
|
162
|
+
copiedPaths.push(path);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
console.log(`[PROPAGATE] PHASE2: Copied ${copiedCount} paths`);
|
|
167
|
+
if (copiedPaths.length > 0) {
|
|
168
|
+
console.log(
|
|
169
|
+
'[PROPAGATE] PHASE2: Copied currentlyExecuting.entities paths:',
|
|
170
|
+
copiedPaths,
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Verify after copy
|
|
175
|
+
const afterHasEntitiesFilePath = Object.keys(callSpecificSchema).some(
|
|
176
|
+
(p) => p.includes('currentlyExecuting.entities[].filePath'),
|
|
177
|
+
);
|
|
178
|
+
console.log(
|
|
179
|
+
`[PROPAGATE] PHASE2: AFTER copy, callSpecific has currentlyExecuting.entities[].filePath: ${afterHasEntitiesFilePath}`,
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
console.log('[PROPAGATE] === DONE ===');
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Helper to extract the "base name" from an array path for matching purposes.
|
|
189
|
+
* e.g., "currentEntities" -> "entities"
|
|
190
|
+
* e.g., "validCurrentEntities" -> "entities"
|
|
191
|
+
* e.g., "queueJobs[].entities" -> "entities"
|
|
192
|
+
* e.g., "entities" -> "entities"
|
|
193
|
+
*/
|
|
194
|
+
function extractArrayBaseName(path: string): string {
|
|
195
|
+
// Get the last segment of the path (after the last dot, if any)
|
|
196
|
+
const parts = splitOutsideParenthesesAndArrays(path);
|
|
197
|
+
const lastPart = parts[parts.length - 1] || path;
|
|
198
|
+
|
|
199
|
+
// Remove trailing [] if present
|
|
200
|
+
const name = lastPart.replace(/\[\]$/, '');
|
|
201
|
+
|
|
202
|
+
// Common prefixes that can be stripped for matching
|
|
203
|
+
const prefixes = [
|
|
204
|
+
'current',
|
|
205
|
+
'valid',
|
|
206
|
+
'filtered',
|
|
207
|
+
'all',
|
|
208
|
+
'new',
|
|
209
|
+
'old',
|
|
210
|
+
'display',
|
|
211
|
+
'active',
|
|
212
|
+
'selected',
|
|
213
|
+
'loaded',
|
|
214
|
+
'fetched',
|
|
215
|
+
];
|
|
216
|
+
|
|
217
|
+
// Keep stripping prefixes until no more match
|
|
218
|
+
let baseName = name;
|
|
219
|
+
let changed = true;
|
|
220
|
+
while (changed) {
|
|
221
|
+
changed = false;
|
|
222
|
+
for (const prefix of prefixes) {
|
|
223
|
+
if (
|
|
224
|
+
baseName.toLowerCase().startsWith(prefix) &&
|
|
225
|
+
baseName.length > prefix.length
|
|
226
|
+
) {
|
|
227
|
+
// Remove prefix and lowercase the first char
|
|
228
|
+
baseName = baseName.slice(prefix.length);
|
|
229
|
+
baseName = baseName.charAt(0).toLowerCase() + baseName.slice(1);
|
|
230
|
+
changed = true;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return baseName.toLowerCase();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Check if two array names likely refer to the same type.
|
|
241
|
+
*/
|
|
242
|
+
function arrayNamesMatch(name1: string, name2: string): boolean {
|
|
243
|
+
const base1 = extractArrayBaseName(name1);
|
|
244
|
+
const base2 = extractArrayBaseName(name2);
|
|
245
|
+
|
|
246
|
+
if (base1 === base2) return true;
|
|
247
|
+
|
|
248
|
+
// Check singular/plural relationships
|
|
249
|
+
if (base1 + 's' === base2 || base2 + 's' === base1) return true;
|
|
250
|
+
if (base1 + 'es' === base2 || base2 + 'es' === base1) return true;
|
|
251
|
+
|
|
252
|
+
// Handle "ies" plural (e.g., entity -> entities)
|
|
253
|
+
if (base1.endsWith('ies') && base1.slice(0, -3) + 'y' === base2) return true;
|
|
254
|
+
if (base2.endsWith('ies') && base2.slice(0, -3) + 'y' === base1) return true;
|
|
255
|
+
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Count the number of item properties an array has in the schema.
|
|
261
|
+
*/
|
|
262
|
+
function countArrayItemProperties(
|
|
263
|
+
schema: Record<string, string>,
|
|
264
|
+
arrayPath: string,
|
|
265
|
+
): number {
|
|
266
|
+
const elementPrefix = arrayPath + '[]';
|
|
267
|
+
let count = 0;
|
|
268
|
+
for (const path in schema) {
|
|
269
|
+
if (path.startsWith(elementPrefix)) {
|
|
270
|
+
count++;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return count;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function propagateArrayItemSchemasInSchema(
|
|
277
|
+
schema: Record<string, string>,
|
|
278
|
+
): void {
|
|
279
|
+
// Safety check: Don't propagate if schema is already very large
|
|
280
|
+
const initialPathCount = Object.keys(schema).length;
|
|
281
|
+
if (initialPathCount > MAX_SCHEMA_PATHS) {
|
|
282
|
+
console.log(
|
|
283
|
+
`[PROPAGATE] SKIPPING: Schema already has ${initialPathCount} paths (limit: ${MAX_SCHEMA_PATHS})`,
|
|
284
|
+
);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
let totalPathsAdded = 0;
|
|
289
|
+
|
|
290
|
+
// Find all array paths and categorize them
|
|
291
|
+
const arraysWithItemSchema: string[] = [];
|
|
292
|
+
const arraysWithoutItemSchema: string[] = [];
|
|
293
|
+
|
|
294
|
+
for (const path in schema) {
|
|
295
|
+
const type = schema[path];
|
|
296
|
+
|
|
297
|
+
// Check if this is an array type (including "array | undefined", etc.)
|
|
298
|
+
if (!type.startsWith('array')) continue;
|
|
299
|
+
|
|
300
|
+
// Check if this is an array element path (ends with [])
|
|
301
|
+
if (path.endsWith('[]')) continue;
|
|
302
|
+
|
|
303
|
+
// This is an array declaration, not an element. Check if it has item schema.
|
|
304
|
+
const elementPath = path + '[]';
|
|
305
|
+
if (schema[elementPath]) {
|
|
306
|
+
arraysWithItemSchema.push(path);
|
|
307
|
+
} else {
|
|
308
|
+
arraysWithoutItemSchema.push(path);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// For each array without item schema, try to find a matching array with schema
|
|
313
|
+
for (const emptyArrayPath of arraysWithoutItemSchema) {
|
|
314
|
+
let bestMatch: string | null = null;
|
|
315
|
+
let bestMatchScore = 0;
|
|
316
|
+
|
|
317
|
+
for (const richArrayPath of arraysWithItemSchema) {
|
|
318
|
+
if (!arrayNamesMatch(emptyArrayPath, richArrayPath)) continue;
|
|
319
|
+
|
|
320
|
+
// Score the match - prefer shorter paths (less nested) as they're more likely primary
|
|
321
|
+
// and prefer paths that are more similar in structure
|
|
322
|
+
const emptyDepth = emptyArrayPath.split('.').length;
|
|
323
|
+
const richDepth = richArrayPath.split('.').length;
|
|
324
|
+
const depthDiff = Math.abs(emptyDepth - richDepth);
|
|
325
|
+
const score = 100 - depthDiff * 10 - richDepth;
|
|
326
|
+
|
|
327
|
+
if (score > bestMatchScore) {
|
|
328
|
+
bestMatchScore = score;
|
|
329
|
+
bestMatch = richArrayPath;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if (bestMatch) {
|
|
334
|
+
// Safety check: Stop if we've added too many paths
|
|
335
|
+
if (totalPathsAdded >= MAX_PATHS_TO_ADD) {
|
|
336
|
+
console.log(
|
|
337
|
+
`[PROPAGATE] STOPPING FIRST PASS: Already added ${totalPathsAdded} paths (limit: ${MAX_PATHS_TO_ADD})`,
|
|
338
|
+
);
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// Copy item schema from the rich array to the empty array
|
|
343
|
+
const richElementPrefix = bestMatch + '[]';
|
|
344
|
+
const emptyElementPrefix = emptyArrayPath + '[]';
|
|
345
|
+
|
|
346
|
+
// Find all paths that start with the rich array's element path
|
|
347
|
+
const pathsToCheck = Object.keys(schema);
|
|
348
|
+
|
|
349
|
+
for (const path of pathsToCheck) {
|
|
350
|
+
if (path.startsWith(richElementPrefix)) {
|
|
351
|
+
const suffix = path.slice(richElementPrefix.length);
|
|
352
|
+
const newPath = emptyElementPrefix + suffix;
|
|
353
|
+
|
|
354
|
+
// Skip if this would create a recursive path (suffix contains array names that are already in the prefix)
|
|
355
|
+
if (wouldCreateRecursivePath(emptyElementPrefix, suffix)) {
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// Skip if the new path would have too many array levels
|
|
360
|
+
if (countArrayLevels(newPath) > MAX_ARRAY_NESTING_DEPTH) {
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// Safety check: Stop if we've added too many paths
|
|
365
|
+
if (totalPathsAdded >= MAX_PATHS_TO_ADD) {
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// Only add if the path doesn't already exist
|
|
370
|
+
if (!schema[newPath]) {
|
|
371
|
+
schema[newPath] = schema[path];
|
|
372
|
+
totalPathsAdded++;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// SECOND PASS: For arrays that have PARTIAL item schemas (some but not all properties),
|
|
380
|
+
// propagate missing properties from matching arrays with more complete schemas.
|
|
381
|
+
// This handles the case where e.g. currentlyExecuting.entities has sha traced
|
|
382
|
+
// but is missing filePath, name, etc. that entities[] has.
|
|
383
|
+
|
|
384
|
+
// Safety check: Skip second pass if we've already hit the limit
|
|
385
|
+
if (totalPathsAdded >= MAX_PATHS_TO_ADD) {
|
|
386
|
+
console.log(
|
|
387
|
+
`[PROPAGATE] SKIPPING SECOND PASS: Already added ${totalPathsAdded} paths`,
|
|
388
|
+
);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
for (const partialArrayPath of arraysWithItemSchema) {
|
|
393
|
+
// Safety check: Stop if we've added too many paths
|
|
394
|
+
if (totalPathsAdded >= MAX_PATHS_TO_ADD) {
|
|
395
|
+
console.log(
|
|
396
|
+
`[PROPAGATE] STOPPING SECOND PASS: Already added ${totalPathsAdded} paths (limit: ${MAX_PATHS_TO_ADD})`,
|
|
397
|
+
);
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
const partialCount = countArrayItemProperties(schema, partialArrayPath);
|
|
402
|
+
|
|
403
|
+
// Find the best matching array with MORE properties
|
|
404
|
+
let bestMatch: string | null = null;
|
|
405
|
+
let bestMatchScore = 0;
|
|
406
|
+
let bestMatchCount = partialCount;
|
|
407
|
+
|
|
408
|
+
for (const richArrayPath of arraysWithItemSchema) {
|
|
409
|
+
if (richArrayPath === partialArrayPath) continue;
|
|
410
|
+
if (!arrayNamesMatch(partialArrayPath, richArrayPath)) continue;
|
|
411
|
+
|
|
412
|
+
const richCount = countArrayItemProperties(schema, richArrayPath);
|
|
413
|
+
|
|
414
|
+
// Only consider arrays with MORE properties
|
|
415
|
+
if (richCount <= partialCount) continue;
|
|
416
|
+
|
|
417
|
+
// Score the match - prefer arrays with more properties and shallower depth
|
|
418
|
+
const partialDepth = partialArrayPath.split('.').length;
|
|
419
|
+
const richDepth = richArrayPath.split('.').length;
|
|
420
|
+
const depthDiff = Math.abs(partialDepth - richDepth);
|
|
421
|
+
const score = richCount * 10 - depthDiff * 5 - richDepth;
|
|
422
|
+
|
|
423
|
+
if (score > bestMatchScore || richCount > bestMatchCount) {
|
|
424
|
+
bestMatchScore = score;
|
|
425
|
+
bestMatch = richArrayPath;
|
|
426
|
+
bestMatchCount = richCount;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
if (bestMatch) {
|
|
431
|
+
// Copy MISSING item properties from the rich array to the partial array
|
|
432
|
+
const richElementPrefix = bestMatch + '[]';
|
|
433
|
+
const partialElementPrefix = partialArrayPath + '[]';
|
|
434
|
+
|
|
435
|
+
const pathsToCheck = Object.keys(schema);
|
|
436
|
+
|
|
437
|
+
for (const path of pathsToCheck) {
|
|
438
|
+
if (path.startsWith(richElementPrefix)) {
|
|
439
|
+
const suffix = path.slice(richElementPrefix.length);
|
|
440
|
+
const newPath = partialElementPrefix + suffix;
|
|
441
|
+
|
|
442
|
+
// Skip if this would create a recursive path
|
|
443
|
+
if (wouldCreateRecursivePath(partialElementPrefix, suffix)) {
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// Skip if the new path would have too many array levels
|
|
448
|
+
if (countArrayLevels(newPath) > MAX_ARRAY_NESTING_DEPTH) {
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// Safety check: Stop if we've added too many paths
|
|
453
|
+
if (totalPathsAdded >= MAX_PATHS_TO_ADD) {
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// Only add if the path doesn't already exist (don't overwrite)
|
|
458
|
+
if (!schema[newPath]) {
|
|
459
|
+
schema[newPath] = schema[path];
|
|
460
|
+
totalPathsAdded++;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// Log final stats
|
|
468
|
+
if (totalPathsAdded > 0) {
|
|
469
|
+
const finalPathCount = Object.keys(schema).length;
|
|
470
|
+
console.log(
|
|
471
|
+
`[PROPAGATE] Added ${totalPathsAdded} paths (${initialPathCount} -> ${finalPathCount})`,
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Commit, Entity, File } from '~codeyam/types';
|
|
2
2
|
import { ProjectAnalyzer } from '../ProjectAnalyzer';
|
|
3
|
+
import { getFileByPathSafe } from '../utils/getFileByPath';
|
|
3
4
|
import getImportedExports from './getImportedExports';
|
|
4
5
|
import { getFrameworkForFile, isFrameworkRoute } from '~codeyam/utils';
|
|
5
6
|
import findOrCreateEntity from './analyze/findOrCreateEntity';
|
|
@@ -149,7 +150,7 @@ export default async function setImportedExports({
|
|
|
149
150
|
// Use fileStore for O(1) lookup when available, fallback to O(n) find
|
|
150
151
|
const relevantFile =
|
|
151
152
|
fileStore?.getByPath(resolvedFilePath) ??
|
|
152
|
-
|
|
153
|
+
getFileByPathSafe(projectAnalyzer, resolvedFilePath);
|
|
153
154
|
|
|
154
155
|
if (relevantFile) {
|
|
155
156
|
const relevantFileAnalyzer =
|
|
@@ -4,3 +4,4 @@ export { type FunctionDependenciesMap } from './asts/sourceFiles/getPseudoFile';
|
|
|
4
4
|
export * as asts from './asts/index';
|
|
5
5
|
export * as projects from './projects/index';
|
|
6
6
|
export * as types from './types';
|
|
7
|
+
export { transformationTracer } from './files/scenarios/TransformationTracer';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { File } from '~codeyam/types';
|
|
2
|
+
import { ProjectAnalyzer } from '../ProjectAnalyzer';
|
|
3
|
+
|
|
4
|
+
export function getFileByPathSafe(
|
|
5
|
+
projectAnalyzer: ProjectAnalyzer,
|
|
6
|
+
filePath: string,
|
|
7
|
+
): File | undefined {
|
|
8
|
+
const maybeGetFileByPath = (projectAnalyzer as any).getFileByPath;
|
|
9
|
+
if (typeof maybeGetFileByPath === 'function') {
|
|
10
|
+
return maybeGetFileByPath.call(projectAnalyzer, filePath);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const projectFiles = (projectAnalyzer as any).project?.files;
|
|
14
|
+
if (Array.isArray(projectFiles)) {
|
|
15
|
+
return projectFiles.find((file: File) => file.path === filePath);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@aws-sdk/client-codebuild": "^3.948.0",
|
|
15
|
-
"@aws-sdk/client-cloudwatch-logs": "^3.
|
|
15
|
+
"@aws-sdk/client-cloudwatch-logs": "^3.980.0",
|
|
16
16
|
"@aws-sdk/client-dynamodb": "^3.956.0",
|
|
17
17
|
"@aws-sdk/client-ecr": "^3.948.0",
|
|
18
18
|
"@aws-sdk/client-ecs": "^3.956.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnalysisBranch } from '~codeyam/types';
|
|
2
2
|
import { DbAnalysisBranch } from './kysely/tableRelations';
|
|
3
|
-
|
|
3
|
+
const randomUUID = () => crypto.randomUUID();
|
|
4
4
|
import { AnalysisBranchesTable } from './kysely/tables/analysisBranchesTable';
|
|
5
5
|
import { type Insertable } from 'kysely';
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Analysis } from '~codeyam/types';
|
|
2
2
|
import { type Insertable } from 'kysely';
|
|
3
3
|
import { AnalysesTable } from './kysely/tables/analysesTable';
|
|
4
|
-
|
|
4
|
+
const randomUUID = () => crypto.randomUUID();
|
|
5
5
|
|
|
6
6
|
export default function analysisToDb(
|
|
7
7
|
analysis: Analysis,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Branch } from '~codeyam/types';
|
|
2
2
|
import { type Insertable } from 'kysely';
|
|
3
3
|
import { BranchesTable } from './kysely/tables/branchesTable';
|
|
4
|
-
|
|
4
|
+
const randomUUID = () => crypto.randomUUID();
|
|
5
5
|
|
|
6
6
|
export default function branchToDb(branch: Branch): Insertable<BranchesTable> {
|
|
7
7
|
const { id, projectId, activeAt, contentChangedAt, metadata, ...remaining } =
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommitBranch } from '~codeyam/types';
|
|
2
2
|
import { type Insertable } from 'kysely';
|
|
3
|
-
|
|
3
|
+
const randomUUID = () => crypto.randomUUID();
|
|
4
4
|
import { CommitBranchesTable } from './kysely/tables/commitBranchesTable';
|
|
5
5
|
|
|
6
6
|
export default function commitBranchToDb(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Commit } from '~codeyam/types';
|
|
2
2
|
import { CommitsTable } from './kysely/tables/commitsTable';
|
|
3
3
|
import { type Insertable } from 'kysely';
|
|
4
|
-
|
|
4
|
+
const randomUUID = () => crypto.randomUUID();
|
|
5
5
|
|
|
6
6
|
export default function commitToDb(
|
|
7
7
|
commit: Commit,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { File } from '~codeyam/types';
|
|
2
2
|
import { type Insertable } from 'kysely';
|
|
3
3
|
import { FilesTable } from './kysely/tables/filesTable';
|
|
4
|
-
|
|
4
|
+
const randomUUID = () => crypto.randomUUID();
|
|
5
5
|
|
|
6
6
|
export default function fileToDb(file: File): Insertable<FilesTable> {
|
|
7
7
|
return {
|
|
@@ -36,6 +36,10 @@ import {
|
|
|
36
36
|
createDebugBundlesTable,
|
|
37
37
|
DebugBundlesTable,
|
|
38
38
|
} from './tables/debugReportsTable';
|
|
39
|
+
import {
|
|
40
|
+
createLabsRequestsTable,
|
|
41
|
+
LabsRequestsTable,
|
|
42
|
+
} from './tables/labsRequestsTable';
|
|
39
43
|
import { createEntitiesTable, EntitiesTable } from './tables/entitiesTable';
|
|
40
44
|
import {
|
|
41
45
|
createEntityBranchesTable,
|
|
@@ -107,6 +111,7 @@ const databaseSchema = {
|
|
|
107
111
|
entity_statements: schemaField<EntityStatementsTable>(),
|
|
108
112
|
files: schemaField<FilesTable>(),
|
|
109
113
|
github_payloads: schemaField<GithubPayloadsTable>(),
|
|
114
|
+
labs_requests: schemaField<LabsRequestsTable>(),
|
|
110
115
|
github_users: schemaField<GithubUsersTable>(),
|
|
111
116
|
scenario_comments: schemaField<ScenarioCommentsTable>(),
|
|
112
117
|
scenarios: schemaField<ScenariosTable>(),
|
|
@@ -391,6 +396,7 @@ export async function createSqliteSchema(db: Kysely<Database>): Promise<void> {
|
|
|
391
396
|
await createFilesTable(db);
|
|
392
397
|
await createGithubPayloadsTable(db);
|
|
393
398
|
await createGithubUsersTable(db);
|
|
399
|
+
await createLabsRequestsTable(db);
|
|
394
400
|
await createScenarioCommentsTable(db);
|
|
395
401
|
await createScenariosTable(db);
|
|
396
402
|
await createStatementsTable(db);
|
|
@@ -6,7 +6,7 @@ import { schemaField, defaultNow } from '../schemaHelpers';
|
|
|
6
6
|
/**
|
|
7
7
|
* Metadata for a debug bundle upload.
|
|
8
8
|
* Note: "bundle" refers to the tarball upload (base + delta).
|
|
9
|
-
* The markdown "debug report" from /codeyam
|
|
9
|
+
* The markdown "debug report" from /codeyam-diagnose is stored in feedback.debugReport.
|
|
10
10
|
*/
|
|
11
11
|
interface DebugBundleMetadata {
|
|
12
12
|
timestamp: string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Kysely, ColumnDefinitionBuilder } from 'kysely';
|
|
2
|
+
import type { Generated } from 'kysely';
|
|
3
|
+
|
|
4
|
+
import { schemaField, defaultNow } from '../schemaHelpers';
|
|
5
|
+
|
|
6
|
+
const labsRequestsSchema = {
|
|
7
|
+
id: schemaField<Generated<string>>(),
|
|
8
|
+
project_slug: schemaField<string>(),
|
|
9
|
+
name: schemaField<string>(),
|
|
10
|
+
email: schemaField<string>(),
|
|
11
|
+
org_name: schemaField<string | null>(),
|
|
12
|
+
org_size: schemaField<string | null>(),
|
|
13
|
+
project_size: schemaField<string | null>(),
|
|
14
|
+
tech_stack: schemaField<string | null>(),
|
|
15
|
+
status: schemaField<string | null>(),
|
|
16
|
+
unlock_code: schemaField<string | null>(),
|
|
17
|
+
created_at: schemaField<Generated<string>>(),
|
|
18
|
+
approved_at: schemaField<string | null>(),
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
export type LabsRequestsTable = {
|
|
22
|
+
[K in keyof typeof labsRequestsSchema]: (typeof labsRequestsSchema)[K];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const LabsRequestsTableColumns = Object.keys(
|
|
26
|
+
labsRequestsSchema,
|
|
27
|
+
) as (keyof LabsRequestsTable)[];
|
|
28
|
+
|
|
29
|
+
export async function createLabsRequestsTable(db: Kysely<any>): Promise<void> {
|
|
30
|
+
await db.schema
|
|
31
|
+
.createTable('labs_requests')
|
|
32
|
+
.addColumn('id', 'uuid', (col: ColumnDefinitionBuilder) => col.primaryKey())
|
|
33
|
+
.addColumn('project_slug', 'varchar', (col: ColumnDefinitionBuilder) =>
|
|
34
|
+
col.notNull().unique(),
|
|
35
|
+
)
|
|
36
|
+
.addColumn('name', 'varchar', (col: ColumnDefinitionBuilder) =>
|
|
37
|
+
col.notNull(),
|
|
38
|
+
)
|
|
39
|
+
.addColumn('email', 'varchar', (col: ColumnDefinitionBuilder) =>
|
|
40
|
+
col.notNull(),
|
|
41
|
+
)
|
|
42
|
+
.addColumn('org_name', 'varchar')
|
|
43
|
+
.addColumn('org_size', 'varchar')
|
|
44
|
+
.addColumn('project_size', 'varchar')
|
|
45
|
+
.addColumn('tech_stack', 'varchar')
|
|
46
|
+
.addColumn('status', 'varchar')
|
|
47
|
+
.addColumn('unlock_code', 'varchar')
|
|
48
|
+
.addColumn('created_at', 'datetime', defaultNow(true))
|
|
49
|
+
.addColumn('approved_at', 'datetime')
|
|
50
|
+
.ifNotExists()
|
|
51
|
+
.execute();
|
|
52
|
+
}
|