@codeyam/codeyam-cli 0.1.0-staging.8e7b1bd → 0.1.0-staging.9574237

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.
Files changed (1445) hide show
  1. package/analyzer-template/.build-info.json +8 -8
  2. package/analyzer-template/common/execAsync.ts +1 -1
  3. package/analyzer-template/log.txt +3 -3
  4. package/analyzer-template/package.json +37 -33
  5. package/analyzer-template/packages/ai/index.ts +21 -5
  6. package/analyzer-template/packages/ai/package.json +5 -5
  7. package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
  8. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +228 -24
  9. package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
  10. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +239 -13
  11. package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
  12. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +181 -23
  13. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
  14. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.ts +18 -0
  15. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +38 -1
  16. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +181 -1
  17. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +1619 -125
  18. package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
  19. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +324 -5
  20. package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +29 -10
  21. package/analyzer-template/packages/ai/src/lib/completionCall.ts +247 -66
  22. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +2788 -390
  23. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +21 -4
  24. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +976 -0
  25. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +243 -77
  26. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +16 -3
  27. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +6 -4
  28. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +71 -2
  29. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +161 -19
  30. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
  31. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
  32. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +163 -14
  33. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
  34. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
  35. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
  36. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +422 -86
  37. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
  38. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
  39. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +183 -0
  40. package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
  41. package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
  42. package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
  43. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +74 -7
  44. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +89 -112
  45. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +63 -2
  46. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1497 -92
  47. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +216 -109
  48. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +677 -0
  49. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
  50. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +2484 -0
  51. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
  52. package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +143 -31
  53. package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
  54. package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +328 -7
  55. package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
  56. package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +111 -87
  57. package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
  58. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +17 -7
  59. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
  60. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -102
  61. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
  62. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
  63. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +110 -6
  64. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -53
  65. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
  66. package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +28 -2
  67. package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
  68. package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +824 -0
  69. package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
  70. package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
  71. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +127 -3
  72. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +121 -2
  73. package/analyzer-template/packages/analyze/index.ts +2 -0
  74. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +79 -59
  75. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +132 -33
  76. package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
  77. package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
  78. package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
  79. package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +1 -0
  80. package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
  81. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
  82. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
  83. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
  84. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
  85. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
  86. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
  87. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +570 -180
  88. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +62 -1
  89. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +15 -0
  90. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
  91. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -10
  92. package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +31 -15
  93. package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +11 -7
  94. package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +11 -12
  95. package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
  96. package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
  97. package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +22 -13
  98. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1352 -0
  99. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +313 -0
  100. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
  101. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +675 -77
  102. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.ts +1 -1
  103. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
  104. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +633 -137
  105. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +166 -0
  106. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +78 -83
  107. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +4 -8
  108. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1087 -168
  109. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
  110. package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
  111. package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
  112. package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
  113. package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
  114. package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
  115. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
  116. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
  117. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
  118. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
  119. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
  120. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
  121. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
  122. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  123. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
  124. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
  125. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
  126. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  127. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts +15 -0
  128. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts.map +1 -0
  129. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js +31 -0
  130. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js.map +1 -0
  131. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
  132. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
  133. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
  134. package/analyzer-template/packages/aws/package.json +10 -10
  135. package/analyzer-template/packages/aws/s3/index.ts +1 -0
  136. package/analyzer-template/packages/aws/src/lib/codebuild/waitForBuild.ts +43 -19
  137. package/analyzer-template/packages/aws/src/lib/ecs/ecsDefineContainer.ts +3 -3
  138. package/analyzer-template/packages/aws/src/lib/ecs/ecsTaskFactory.ts +17 -69
  139. package/analyzer-template/packages/aws/src/lib/s3/checkS3ObjectExists.ts +47 -0
  140. package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
  141. package/analyzer-template/packages/database/index.ts +1 -0
  142. package/analyzer-template/packages/database/package.json +4 -4
  143. package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
  144. package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
  145. package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
  146. package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
  147. package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
  148. package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
  149. package/analyzer-template/packages/database/src/lib/kysely/db.ts +26 -5
  150. package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
  151. package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
  152. package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +36 -9
  153. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +164 -0
  154. package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
  155. package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
  156. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
  157. package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
  158. package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
  159. package/analyzer-template/packages/database/src/lib/loadCommits.ts +58 -19
  160. package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -9
  161. package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
  162. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +5 -5
  163. package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
  164. package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
  165. package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
  166. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +96 -152
  167. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
  168. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
  169. package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
  170. package/analyzer-template/packages/generate/index.ts +3 -0
  171. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +17 -1
  172. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +221 -0
  173. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.ts +73 -0
  174. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +42 -9
  175. package/analyzer-template/packages/generate/src/lib/deepMerge.ts +26 -1
  176. package/analyzer-template/packages/generate/src/lib/getComponentScenarioPath.ts +8 -3
  177. package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
  178. package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
  179. package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
  180. package/analyzer-template/packages/github/dist/database/index.js +1 -0
  181. package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
  182. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
  183. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
  184. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
  185. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
  186. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
  187. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
  188. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
  189. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
  190. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
  191. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
  192. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
  193. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
  194. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +6 -2
  195. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  196. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +18 -3
  197. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  198. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts +2 -2
  199. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -11
  200. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
  201. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
  202. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
  203. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
  204. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  205. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +30 -7
  206. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
  207. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  208. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  209. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +29 -0
  210. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
  211. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +149 -0
  212. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  213. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts +1 -0
  214. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts.map +1 -1
  215. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts +23 -0
  216. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
  217. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  218. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  219. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +7 -6
  220. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  221. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
  222. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
  223. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
  224. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
  225. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  226. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
  227. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  228. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
  229. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
  230. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
  231. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
  232. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
  233. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
  234. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  235. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +45 -14
  236. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  237. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
  238. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  239. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -10
  240. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  241. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
  242. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
  243. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
  244. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +5 -3
  245. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  246. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +1 -1
  247. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
  248. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
  249. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
  250. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
  251. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
  252. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
  253. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  254. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +76 -89
  255. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  256. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
  257. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  258. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  259. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
  260. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  261. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  262. package/analyzer-template/packages/github/dist/generate/index.d.ts +3 -0
  263. package/analyzer-template/packages/github/dist/generate/index.d.ts.map +1 -1
  264. package/analyzer-template/packages/github/dist/generate/index.js +3 -0
  265. package/analyzer-template/packages/github/dist/generate/index.js.map +1 -1
  266. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
  267. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  268. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  269. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts +9 -0
  270. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -0
  271. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +217 -0
  272. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  273. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts +20 -0
  274. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts.map +1 -0
  275. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  276. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  277. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  278. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +41 -9
  279. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  280. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.d.ts.map +1 -1
  281. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js +27 -1
  282. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js.map +1 -1
  283. package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.d.ts.map +1 -1
  284. package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js +7 -3
  285. package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js.map +1 -1
  286. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts +8 -0
  287. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts.map +1 -0
  288. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js +89 -0
  289. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  290. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.d.ts.map +1 -1
  291. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +10 -0
  292. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +1 -1
  293. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.d.ts.map +1 -1
  294. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js +3 -0
  295. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +1 -1
  296. package/analyzer-template/packages/github/dist/types/index.d.ts +2 -2
  297. package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
  298. package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
  299. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts +2 -0
  300. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
  301. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js +2 -0
  302. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js.map +1 -1
  303. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +87 -13
  304. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
  305. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
  306. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
  307. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +2 -0
  308. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts.map +1 -1
  309. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +8 -0
  310. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  311. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +21 -6
  312. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  313. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +199 -3
  314. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  315. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  316. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  317. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts +2 -0
  318. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  319. package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
  320. package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js +26 -2
  321. package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
  322. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  323. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  324. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  325. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
  326. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  327. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
  328. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
  329. package/analyzer-template/packages/github/package.json +2 -2
  330. package/analyzer-template/packages/github/src/lib/loadOrCreateCommit.ts +14 -0
  331. package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +2 -0
  332. package/analyzer-template/packages/process/index.ts +2 -0
  333. package/analyzer-template/packages/process/package.json +12 -0
  334. package/analyzer-template/packages/process/tsconfig.json +8 -0
  335. package/analyzer-template/packages/types/index.ts +5 -0
  336. package/analyzer-template/packages/types/src/enums/ProjectFramework.ts +2 -0
  337. package/analyzer-template/packages/types/src/types/Analysis.ts +104 -13
  338. package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
  339. package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
  340. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +8 -0
  341. package/analyzer-template/packages/types/src/types/Scenario.ts +21 -10
  342. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +228 -3
  343. package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
  344. package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
  345. package/analyzer-template/packages/ui-components/package.json +5 -5
  346. package/analyzer-template/packages/ui-components/src/components/ScenarioDetailInteractiveView.tsx +23 -7
  347. package/analyzer-template/packages/utils/dist/types/index.d.ts +2 -2
  348. package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
  349. package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
  350. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts +2 -0
  351. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
  352. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js +2 -0
  353. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js.map +1 -1
  354. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +87 -13
  355. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
  356. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
  357. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
  358. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +2 -0
  359. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts.map +1 -1
  360. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +8 -0
  361. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  362. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +21 -6
  363. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  364. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +199 -3
  365. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  366. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  367. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  368. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts +2 -0
  369. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  370. package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
  371. package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js +26 -2
  372. package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
  373. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  374. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +98 -3
  375. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  376. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  377. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  378. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  379. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
  380. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  381. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
  382. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
  383. package/analyzer-template/packages/utils/src/lib/applyUniversalMocks.ts +28 -2
  384. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +121 -3
  385. package/analyzer-template/packages/utils/src/lib/lightweightEntityExtractor.ts +27 -0
  386. package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
  387. package/analyzer-template/playwright/capture.ts +57 -26
  388. package/analyzer-template/playwright/captureFromUrl.ts +89 -82
  389. package/analyzer-template/playwright/captureStatic.ts +1 -1
  390. package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
  391. package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
  392. package/analyzer-template/playwright/takeScreenshot.ts +9 -7
  393. package/analyzer-template/playwright/waitForServer.ts +21 -6
  394. package/analyzer-template/project/TESTING.md +83 -0
  395. package/analyzer-template/project/analyzeBaselineCommit.ts +9 -0
  396. package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
  397. package/analyzer-template/project/analyzeFileEntities.ts +4 -0
  398. package/analyzer-template/project/analyzeRegularCommit.ts +9 -0
  399. package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
  400. package/analyzer-template/project/constructMockCode.ts +1453 -189
  401. package/analyzer-template/project/controller/startController.ts +16 -1
  402. package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
  403. package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
  404. package/analyzer-template/project/loadReadyToBeCaptured.ts +82 -42
  405. package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
  406. package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
  407. package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +13 -9
  408. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +93 -42
  409. package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
  410. package/analyzer-template/project/orchestrateCapture.ts +85 -10
  411. package/analyzer-template/project/reconcileMockDataKeys.ts +251 -3
  412. package/analyzer-template/project/runAnalysis.ts +11 -0
  413. package/analyzer-template/project/runMultiScenarioServer.ts +11 -10
  414. package/analyzer-template/project/serverOnlyModules.ts +413 -0
  415. package/analyzer-template/project/start.ts +64 -15
  416. package/analyzer-template/project/startScenarioCapture.ts +88 -41
  417. package/analyzer-template/project/writeClientLogRoute.ts +125 -0
  418. package/analyzer-template/project/writeMockDataTsx.ts +458 -65
  419. package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
  420. package/analyzer-template/project/writeScenarioComponents.ts +1529 -237
  421. package/analyzer-template/project/writeScenarioFiles.ts +26 -0
  422. package/analyzer-template/project/writeSimpleRoot.ts +31 -23
  423. package/analyzer-template/project/writeUniversalMocks.ts +32 -11
  424. package/analyzer-template/scripts/comboWorkerLoop.cjs +99 -50
  425. package/analyzer-template/scripts/defaultCmd.sh +9 -0
  426. package/analyzer-template/tsconfig.json +14 -1
  427. package/background/src/lib/local/createLocalAnalyzer.js +2 -30
  428. package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
  429. package/background/src/lib/local/execAsync.js +1 -1
  430. package/background/src/lib/local/execAsync.js.map +1 -1
  431. package/background/src/lib/virtualized/common/execAsync.js +1 -1
  432. package/background/src/lib/virtualized/common/execAsync.js.map +1 -1
  433. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +7 -1
  434. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
  435. package/background/src/lib/virtualized/project/analyzeBranchCommit.js +2 -1
  436. package/background/src/lib/virtualized/project/analyzeBranchCommit.js.map +1 -1
  437. package/background/src/lib/virtualized/project/analyzeFileEntities.js +2 -1
  438. package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
  439. package/background/src/lib/virtualized/project/analyzeRegularCommit.js +7 -1
  440. package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
  441. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
  442. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
  443. package/background/src/lib/virtualized/project/constructMockCode.js +1283 -144
  444. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  445. package/background/src/lib/virtualized/project/controller/startController.js +11 -1
  446. package/background/src/lib/virtualized/project/controller/startController.js.map +1 -1
  447. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
  448. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
  449. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js +6 -3
  450. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js.map +1 -1
  451. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +34 -9
  452. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
  453. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js +7 -7
  454. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js.map +1 -1
  455. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
  456. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
  457. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +12 -6
  458. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
  459. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +73 -36
  460. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  461. package/background/src/lib/virtualized/project/orchestrateCapture.js +69 -11
  462. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  463. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +211 -3
  464. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  465. package/background/src/lib/virtualized/project/runAnalysis.js +9 -0
  466. package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
  467. package/background/src/lib/virtualized/project/runMultiScenarioServer.js +11 -9
  468. package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
  469. package/background/src/lib/virtualized/project/serverOnlyModules.js +338 -0
  470. package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -0
  471. package/background/src/lib/virtualized/project/start.js +55 -15
  472. package/background/src/lib/virtualized/project/start.js.map +1 -1
  473. package/background/src/lib/virtualized/project/startScenarioCapture.js +66 -31
  474. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  475. package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
  476. package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
  477. package/background/src/lib/virtualized/project/writeMockDataTsx.js +393 -54
  478. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  479. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js +15 -0
  480. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js.map +1 -0
  481. package/background/src/lib/virtualized/project/writeScenarioComponents.js +1129 -161
  482. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  483. package/background/src/lib/virtualized/project/writeScenarioFiles.js +19 -0
  484. package/background/src/lib/virtualized/project/writeScenarioFiles.js.map +1 -1
  485. package/background/src/lib/virtualized/project/writeSimpleRoot.js +31 -21
  486. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  487. package/background/src/lib/virtualized/project/writeUniversalMocks.js +27 -12
  488. package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
  489. package/codeyam-cli/scripts/apply-setup.js +386 -9
  490. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  491. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
  492. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
  493. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
  494. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
  495. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
  496. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
  497. package/codeyam-cli/src/cli.js +39 -22
  498. package/codeyam-cli/src/cli.js.map +1 -1
  499. package/codeyam-cli/src/codeyam-cli.js +18 -2
  500. package/codeyam-cli/src/codeyam-cli.js.map +1 -1
  501. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +56 -0
  502. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -0
  503. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +101 -47
  504. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
  505. package/codeyam-cli/src/commands/analyze.js +22 -10
  506. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  507. package/codeyam-cli/src/commands/baseline.js +176 -0
  508. package/codeyam-cli/src/commands/baseline.js.map +1 -0
  509. package/codeyam-cli/src/commands/debug.js +44 -18
  510. package/codeyam-cli/src/commands/debug.js.map +1 -1
  511. package/codeyam-cli/src/commands/default.js +43 -35
  512. package/codeyam-cli/src/commands/default.js.map +1 -1
  513. package/codeyam-cli/src/commands/editor.js +4283 -0
  514. package/codeyam-cli/src/commands/editor.js.map +1 -0
  515. package/codeyam-cli/src/commands/init.js +147 -292
  516. package/codeyam-cli/src/commands/init.js.map +1 -1
  517. package/codeyam-cli/src/commands/memory.js +278 -0
  518. package/codeyam-cli/src/commands/memory.js.map +1 -0
  519. package/codeyam-cli/src/commands/recapture.js +228 -0
  520. package/codeyam-cli/src/commands/recapture.js.map +1 -0
  521. package/codeyam-cli/src/commands/report.js +72 -24
  522. package/codeyam-cli/src/commands/report.js.map +1 -1
  523. package/codeyam-cli/src/commands/setup-sandbox.js +2 -0
  524. package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
  525. package/codeyam-cli/src/commands/setup-simulations.js +284 -0
  526. package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
  527. package/codeyam-cli/src/commands/start.js +8 -12
  528. package/codeyam-cli/src/commands/start.js.map +1 -1
  529. package/codeyam-cli/src/commands/status.js +23 -1
  530. package/codeyam-cli/src/commands/status.js.map +1 -1
  531. package/codeyam-cli/src/commands/test-startup.js +3 -1
  532. package/codeyam-cli/src/commands/test-startup.js.map +1 -1
  533. package/codeyam-cli/src/commands/verify.js +14 -2
  534. package/codeyam-cli/src/commands/verify.js.map +1 -1
  535. package/codeyam-cli/src/commands/wipe.js +108 -0
  536. package/codeyam-cli/src/commands/wipe.js.map +1 -0
  537. package/codeyam-cli/src/data/techStacks.js +77 -0
  538. package/codeyam-cli/src/data/techStacks.js.map +1 -0
  539. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js +173 -0
  540. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js.map +1 -0
  541. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js +46 -0
  542. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js.map +1 -0
  543. package/codeyam-cli/src/utils/__tests__/devServerState.test.js +134 -0
  544. package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -0
  545. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +137 -0
  546. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -0
  547. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +987 -0
  548. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  549. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
  550. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
  551. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js +93 -0
  552. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js.map +1 -0
  553. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js +100 -0
  554. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js.map +1 -0
  555. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +304 -0
  556. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  557. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +124 -0
  558. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -0
  559. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +222 -0
  560. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
  561. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js +294 -0
  562. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js.map +1 -0
  563. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +542 -0
  564. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  565. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +594 -0
  566. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -0
  567. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +435 -0
  568. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
  569. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  570. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  571. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +217 -0
  572. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  573. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +353 -0
  574. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  575. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +153 -0
  576. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -0
  577. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js +139 -0
  578. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js.map +1 -0
  579. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +221 -0
  580. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -0
  581. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +1431 -0
  582. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  583. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +280 -0
  584. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -0
  585. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js +143 -0
  586. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js.map +1 -0
  587. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
  588. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
  589. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
  590. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
  591. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +1829 -0
  592. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -0
  593. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  594. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  595. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +107 -0
  596. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -0
  597. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +185 -0
  598. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
  599. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +129 -0
  600. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -0
  601. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
  602. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
  603. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  604. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  605. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
  606. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
  607. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +227 -0
  608. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -0
  609. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  610. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  611. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +493 -0
  612. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -0
  613. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js +81 -0
  614. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js.map +1 -0
  615. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +175 -82
  616. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  617. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js +51 -0
  618. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js.map +1 -0
  619. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +142 -0
  620. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -0
  621. package/codeyam-cli/src/utils/analysisRunner.js +32 -16
  622. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  623. package/codeyam-cli/src/utils/analyzer.js +16 -0
  624. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  625. package/codeyam-cli/src/utils/analyzerFinalization.js +100 -0
  626. package/codeyam-cli/src/utils/analyzerFinalization.js.map +1 -0
  627. package/codeyam-cli/src/utils/backgroundServer.js +204 -31
  628. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  629. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  630. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  631. package/codeyam-cli/src/utils/database.js +128 -7
  632. package/codeyam-cli/src/utils/database.js.map +1 -1
  633. package/codeyam-cli/src/utils/devModeEvents.js +40 -0
  634. package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
  635. package/codeyam-cli/src/utils/devServerState.js +71 -0
  636. package/codeyam-cli/src/utils/devServerState.js.map +1 -0
  637. package/codeyam-cli/src/utils/editorApi.js +79 -0
  638. package/codeyam-cli/src/utils/editorApi.js.map +1 -0
  639. package/codeyam-cli/src/utils/editorAudit.js +210 -0
  640. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  641. package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
  642. package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
  643. package/codeyam-cli/src/utils/editorCapture.js +102 -0
  644. package/codeyam-cli/src/utils/editorCapture.js.map +1 -0
  645. package/codeyam-cli/src/utils/editorDeleteScenario.js +67 -0
  646. package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
  647. package/codeyam-cli/src/utils/editorDevServer.js +197 -0
  648. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  649. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +44 -0
  650. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -0
  651. package/codeyam-cli/src/utils/editorEntityHelpers.js +129 -0
  652. package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
  653. package/codeyam-cli/src/utils/editorImageVerifier.js +155 -0
  654. package/codeyam-cli/src/utils/editorImageVerifier.js.map +1 -0
  655. package/codeyam-cli/src/utils/editorJournal.js +225 -0
  656. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  657. package/codeyam-cli/src/utils/editorLoaderHelpers.js +152 -0
  658. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -0
  659. package/codeyam-cli/src/utils/editorMigration.js +224 -0
  660. package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
  661. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  662. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  663. package/codeyam-cli/src/utils/editorPreloadHelpers.js +135 -0
  664. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  665. package/codeyam-cli/src/utils/editorPreview.js +137 -0
  666. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  667. package/codeyam-cli/src/utils/editorScenarioSwitch.js +112 -0
  668. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -0
  669. package/codeyam-cli/src/utils/editorScenarios.js +523 -0
  670. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  671. package/codeyam-cli/src/utils/editorSeedAdapter.js +422 -0
  672. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -0
  673. package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
  674. package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
  675. package/codeyam-cli/src/utils/entityChangeStatus.js +360 -0
  676. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
  677. package/codeyam-cli/src/utils/entityChangeStatus.server.js +196 -0
  678. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -0
  679. package/codeyam-cli/src/utils/fileMetadata.js +5 -0
  680. package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
  681. package/codeyam-cli/src/utils/fileWatcher.js +25 -9
  682. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  683. package/codeyam-cli/src/utils/generateReport.js +253 -106
  684. package/codeyam-cli/src/utils/generateReport.js.map +1 -1
  685. package/codeyam-cli/src/utils/git.js +182 -0
  686. package/codeyam-cli/src/utils/git.js.map +1 -0
  687. package/codeyam-cli/src/utils/install-skills.js +129 -44
  688. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  689. package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
  690. package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
  691. package/codeyam-cli/src/utils/labsAutoCheck.js +19 -0
  692. package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
  693. package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
  694. package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
  695. package/codeyam-cli/src/utils/parseRegisterArg.js +31 -0
  696. package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -0
  697. package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
  698. package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
  699. package/codeyam-cli/src/utils/progress.js +8 -1
  700. package/codeyam-cli/src/utils/progress.js.map +1 -1
  701. package/codeyam-cli/src/utils/project.js +15 -5
  702. package/codeyam-cli/src/utils/project.js.map +1 -1
  703. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
  704. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
  705. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +60 -0
  706. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  707. package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
  708. package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
  709. package/codeyam-cli/src/utils/queue/job.js +319 -17
  710. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  711. package/codeyam-cli/src/utils/queue/manager.js +26 -7
  712. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  713. package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
  714. package/codeyam-cli/src/utils/requireSimulations.js +10 -0
  715. package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
  716. package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
  717. package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
  718. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
  719. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
  720. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +229 -0
  721. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
  722. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
  723. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
  724. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
  725. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
  726. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
  727. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
  728. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
  729. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
  730. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +74 -0
  731. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
  732. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +376 -0
  733. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
  734. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +113 -0
  735. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
  736. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
  737. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
  738. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
  739. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
  740. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
  741. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
  742. package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
  743. package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
  744. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
  745. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
  746. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
  747. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
  748. package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
  749. package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
  750. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
  751. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
  752. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
  753. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
  754. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
  755. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
  756. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
  757. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
  758. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
  759. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
  760. package/codeyam-cli/src/utils/rules/index.js +7 -0
  761. package/codeyam-cli/src/utils/rules/index.js.map +1 -0
  762. package/codeyam-cli/src/utils/rules/parser.js +93 -0
  763. package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
  764. package/codeyam-cli/src/utils/rules/pathMatcher.js +49 -0
  765. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
  766. package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
  767. package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
  768. package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
  769. package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
  770. package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
  771. package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
  772. package/codeyam-cli/src/utils/rules/staleness.js +137 -0
  773. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
  774. package/codeyam-cli/src/utils/scenarioCoverage.js +74 -0
  775. package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -0
  776. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  777. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  778. package/codeyam-cli/src/utils/scenariosManifest.js +249 -0
  779. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -0
  780. package/codeyam-cli/src/utils/serverState.js +94 -12
  781. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  782. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +96 -45
  783. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  784. package/codeyam-cli/src/utils/simulationGateMiddleware.js +166 -0
  785. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
  786. package/codeyam-cli/src/utils/slugUtils.js +25 -0
  787. package/codeyam-cli/src/utils/slugUtils.js.map +1 -0
  788. package/codeyam-cli/src/utils/syncMocksMiddleware.js +7 -26
  789. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  790. package/codeyam-cli/src/utils/testRunner.js +158 -0
  791. package/codeyam-cli/src/utils/testRunner.js.map +1 -0
  792. package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
  793. package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
  794. package/codeyam-cli/src/utils/versionInfo.js +67 -15
  795. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  796. package/codeyam-cli/src/utils/webappDetection.js +35 -2
  797. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  798. package/codeyam-cli/src/utils/wipe.js +128 -0
  799. package/codeyam-cli/src/utils/wipe.js.map +1 -0
  800. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +35 -0
  801. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
  802. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +40 -0
  803. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -0
  804. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js +66 -0
  805. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
  806. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +567 -0
  807. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -0
  808. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +146 -0
  809. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -0
  810. package/codeyam-cli/src/webserver/app/lib/clientErrors.js +65 -0
  811. package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -0
  812. package/codeyam-cli/src/webserver/app/lib/database.js +159 -33
  813. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  814. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  815. package/codeyam-cli/src/webserver/app/lib/git.js +397 -0
  816. package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -0
  817. package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
  818. package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
  819. package/codeyam-cli/src/webserver/backgroundServer.js +187 -28
  820. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  821. package/codeyam-cli/src/webserver/bootstrap.js +60 -0
  822. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -0
  823. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CzTDWkF2.js +1 -0
  824. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-BFbq6iFk.js +11 -0
  825. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
  826. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-B6OMi58N.js +41 -0
  827. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-DuYodzo1.js +1 -0
  828. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-CXo9EeCl.js +25 -0
  829. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DYCNb2It.js +3 -0
  830. package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-By5zI316.js +6 -0
  831. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-CZgY3sxX.js +3 -0
  832. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-CnYYwRDw.js +11 -0
  833. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CDoF7ZpU.js +1 -0
  834. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-DrnfvaLL.js +10 -0
  835. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Df3UCi8k.js +34 -0
  836. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
  837. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-DRKR9T0U.js +1 -0
  838. package/codeyam-cli/src/webserver/build/client/assets/_index-ClR-g3tY.js +11 -0
  839. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-DTH6ydEA.js +27 -0
  840. package/codeyam-cli/src/webserver/build/client/assets/addon-canvas-DpzMmAy5.js +1 -0
  841. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-YJmn1quW.js +12 -0
  842. package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-74hnHF59.js +1 -0
  843. package/codeyam-cli/src/webserver/build/client/assets/addon-webgl-DI8QOUvO.js +58 -0
  844. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-B8CYhCO9.js +22 -0
  845. package/codeyam-cli/src/webserver/build/client/assets/api.agent-transcripts-l0sNRNKZ.js +1 -0
  846. package/codeyam-cli/src/webserver/build/client/assets/api.dev-mode-events-l0sNRNKZ.js +1 -0
  847. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  848. package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
  849. package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
  850. package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
  851. package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
  852. package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
  853. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-diff-l0sNRNKZ.js +1 -0
  854. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
  855. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
  856. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
  857. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
  858. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
  859. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
  860. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  861. package/codeyam-cli/src/webserver/build/client/assets/api.editor-project-info-l0sNRNKZ.js +1 -0
  862. package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
  863. package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
  864. package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
  865. package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
  866. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-coverage-l0sNRNKZ.js +1 -0
  867. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
  868. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
  869. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
  870. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
  871. package/codeyam-cli/src/webserver/build/client/assets/api.editor-session-l0sNRNKZ.js +1 -0
  872. package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
  873. package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
  874. package/codeyam-cli/src/webserver/build/client/assets/api.health-l0sNRNKZ.js +1 -0
  875. package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-l0sNRNKZ.js +1 -0
  876. package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
  877. package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
  878. package/codeyam-cli/src/webserver/build/client/assets/api.rule-path-l0sNRNKZ.js +1 -0
  879. package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
  880. package/codeyam-cli/src/webserver/build/client/assets/book-open-CLaoh4ac.js +6 -0
  881. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-BZ2DZxbW.js +6 -0
  882. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-BBXArFPl.js +43 -0
  883. package/codeyam-cli/src/webserver/build/client/assets/circle-check-CT4unAk-.js +6 -0
  884. package/codeyam-cli/src/webserver/build/client/assets/copy-zK0B6Nu-.js +11 -0
  885. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-DJB0YQJL.js +41 -0
  886. package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-C1gnJVOL.svg → cy-logo-cli-CCKUIm0S.svg} +2 -2
  887. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +1 -0
  888. package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-CwLmCS0J.js → dev.empty-CkXFP_i-.js} +1 -1
  889. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-DPw7NZHc.js +1 -0
  890. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-Dmg9cGK3.js +58 -0
  891. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-DBa7T2FK.js +41 -0
  892. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-FHOVOgFN.js → entity._sha._-BqAN7hyG.js} +22 -15
  893. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-BOi8kpwd.js +6 -0
  894. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-Dg1NhIms.js +6 -0
  895. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CJX6kkkV.js +6 -0
  896. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-BhVjZhKg.js +5 -0
  897. package/codeyam-cli/src/webserver/build/client/assets/entry.client-_gzKltPN.js +29 -0
  898. package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
  899. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
  900. package/codeyam-cli/src/webserver/build/client/assets/files-CV_17tZS.js +1 -0
  901. package/codeyam-cli/src/webserver/build/client/assets/git-D-YXmMbR.js +1 -0
  902. package/codeyam-cli/src/webserver/build/client/assets/globals-Bqg9V6XV.css +1 -0
  903. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
  904. package/codeyam-cli/src/webserver/build/client/assets/index-Blo6EK8G.js +15 -0
  905. package/codeyam-cli/src/webserver/build/client/assets/index-BsX0F-9C.js +9 -0
  906. package/codeyam-cli/src/webserver/build/client/assets/index-CCrgCshv.js +3 -0
  907. package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
  908. package/codeyam-cli/src/webserver/build/client/assets/labs-Byazq8Pv.js +1 -0
  909. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-DVQ0oHR7.js +6 -0
  910. package/codeyam-cli/src/webserver/build/client/assets/manifest-422a3551.js +1 -0
  911. package/codeyam-cli/src/webserver/build/client/assets/memory-b-VmA2Vj.js +101 -0
  912. package/codeyam-cli/src/webserver/build/client/assets/pause-DGcndCAa.js +11 -0
  913. package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
  914. package/codeyam-cli/src/webserver/build/client/assets/root-ue8uWVRS.js +67 -0
  915. package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
  916. package/codeyam-cli/src/webserver/build/client/assets/search-C0Uw0bcK.js +6 -0
  917. package/codeyam-cli/src/webserver/build/client/assets/settings-OoNgHIfW.js +1 -0
  918. package/codeyam-cli/src/webserver/build/client/assets/simulations-Bcemfu8a.js +1 -0
  919. package/codeyam-cli/src/webserver/build/client/assets/terminal-BgMmG7R9.js +11 -0
  920. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-Cs87hJYK.js +6 -0
  921. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BR3Rs7JY.js +1 -0
  922. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-BxxP_XF9.js +2 -0
  923. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-BermyNU5.js +1 -0
  924. package/codeyam-cli/src/webserver/build/client/assets/useToast-a_QN_W9_.js +1 -0
  925. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  926. package/codeyam-cli/src/webserver/build/client/sound-test.html +98 -0
  927. package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-DXQyOV0G.js +13 -0
  928. package/codeyam-cli/src/webserver/build/server/assets/index-CHSrVJtC.js +1 -0
  929. package/codeyam-cli/src/webserver/build/server/assets/init-DL8vWZ6m.js +10 -0
  930. package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
  931. package/codeyam-cli/src/webserver/build/server/assets/server-build-BUKVjBSZ.js +501 -0
  932. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  933. package/codeyam-cli/src/webserver/build-info.json +5 -5
  934. package/codeyam-cli/src/webserver/devServer.js +40 -8
  935. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  936. package/codeyam-cli/src/webserver/editorProxy.js +901 -0
  937. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
  938. package/codeyam-cli/src/webserver/idleDetector.js +73 -0
  939. package/codeyam-cli/src/webserver/idleDetector.js.map +1 -0
  940. package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
  941. package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
  942. package/codeyam-cli/src/webserver/public/sound-test.html +98 -0
  943. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +414 -0
  944. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +230 -0
  945. package/codeyam-cli/src/webserver/server.js +344 -26
  946. package/codeyam-cli/src/webserver/server.js.map +1 -1
  947. package/codeyam-cli/src/webserver/terminalServer.js +831 -0
  948. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
  949. package/codeyam-cli/templates/chrome-extension-react/EXTENSION_SETUP.md +75 -0
  950. package/codeyam-cli/templates/chrome-extension-react/README.md +46 -0
  951. package/codeyam-cli/templates/chrome-extension-react/gitignore +15 -0
  952. package/codeyam-cli/templates/chrome-extension-react/index.html +12 -0
  953. package/codeyam-cli/templates/chrome-extension-react/package.json +27 -0
  954. package/codeyam-cli/templates/chrome-extension-react/popup.html +12 -0
  955. package/codeyam-cli/templates/chrome-extension-react/public/manifest.json +15 -0
  956. package/codeyam-cli/templates/chrome-extension-react/src/background/service-worker.ts +7 -0
  957. package/codeyam-cli/templates/chrome-extension-react/src/globals.css +6 -0
  958. package/codeyam-cli/templates/chrome-extension-react/src/lib/storage.ts +37 -0
  959. package/codeyam-cli/templates/chrome-extension-react/src/popup/App.tsx +12 -0
  960. package/codeyam-cli/templates/chrome-extension-react/src/popup/main.tsx +10 -0
  961. package/codeyam-cli/templates/chrome-extension-react/tsconfig.json +24 -0
  962. package/codeyam-cli/templates/chrome-extension-react/vite.config.ts +41 -0
  963. package/codeyam-cli/templates/codeyam-editor-claude.md +147 -0
  964. package/codeyam-cli/templates/codeyam-memory-hook.sh +199 -0
  965. package/codeyam-cli/templates/commands/codeyam-diagnose.md +481 -0
  966. package/codeyam-cli/templates/editor-step-hook.py +321 -0
  967. package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +89 -0
  968. package/codeyam-cli/templates/expo-react-native/README.md +41 -0
  969. package/codeyam-cli/templates/expo-react-native/app/(tabs)/_layout.tsx +33 -0
  970. package/codeyam-cli/templates/expo-react-native/app/(tabs)/index.tsx +12 -0
  971. package/codeyam-cli/templates/expo-react-native/app/(tabs)/settings.tsx +12 -0
  972. package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +12 -0
  973. package/codeyam-cli/templates/expo-react-native/app.json +18 -0
  974. package/codeyam-cli/templates/expo-react-native/babel.config.js +9 -0
  975. package/codeyam-cli/templates/expo-react-native/gitignore +12 -0
  976. package/codeyam-cli/templates/expo-react-native/global.css +3 -0
  977. package/codeyam-cli/templates/expo-react-native/lib/storage.ts +32 -0
  978. package/codeyam-cli/templates/expo-react-native/metro.config.js +6 -0
  979. package/codeyam-cli/templates/expo-react-native/nativewind-env.d.ts +1 -0
  980. package/codeyam-cli/templates/expo-react-native/package.json +38 -0
  981. package/codeyam-cli/templates/expo-react-native/tailwind.config.js +10 -0
  982. package/codeyam-cli/templates/expo-react-native/tsconfig.json +10 -0
  983. package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
  984. package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
  985. package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
  986. package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
  987. package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
  988. package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
  989. package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
  990. package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_PATTERNS.md +308 -0
  991. package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_UPGRADE.md +304 -0
  992. package/codeyam-cli/templates/nextjs-prisma-sqlite/DATABASE.md +126 -0
  993. package/codeyam-cli/templates/nextjs-prisma-sqlite/FEATURE_PATTERNS.md +37 -0
  994. package/codeyam-cli/templates/nextjs-prisma-sqlite/README.md +53 -0
  995. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
  996. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/codeyam-isolate/layout.tsx +12 -0
  997. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
  998. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
  999. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +24 -0
  1000. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
  1001. package/codeyam-cli/templates/nextjs-prisma-sqlite/env +4 -0
  1002. package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
  1003. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +64 -0
  1004. package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
  1005. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +39 -0
  1006. package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
  1007. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
  1008. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +40 -0
  1009. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
  1010. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +127 -0
  1011. package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
  1012. package/codeyam-cli/templates/nextjs-prisma-sqlite/vitest.config.ts +13 -0
  1013. package/codeyam-cli/templates/nextjs-prisma-supabase/README.md +52 -0
  1014. package/codeyam-cli/templates/nextjs-prisma-supabase/SUPABASE_SETUP.md +104 -0
  1015. package/codeyam-cli/templates/nextjs-prisma-supabase/app/api/todos/route.ts +17 -0
  1016. package/codeyam-cli/templates/nextjs-prisma-supabase/app/globals.css +26 -0
  1017. package/codeyam-cli/templates/nextjs-prisma-supabase/app/layout.tsx +34 -0
  1018. package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/prisma.ts +20 -0
  1019. package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/supabase.ts +12 -0
  1020. package/codeyam-cli/templates/nextjs-prisma-supabase/app/page.tsx +10 -0
  1021. package/codeyam-cli/templates/nextjs-prisma-supabase/env +9 -0
  1022. package/codeyam-cli/templates/nextjs-prisma-supabase/eslint.config.mjs +11 -0
  1023. package/codeyam-cli/templates/nextjs-prisma-supabase/gitignore +40 -0
  1024. package/codeyam-cli/templates/nextjs-prisma-supabase/next.config.ts +11 -0
  1025. package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +37 -0
  1026. package/codeyam-cli/templates/nextjs-prisma-supabase/postcss.config.mjs +7 -0
  1027. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/schema.prisma +27 -0
  1028. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/seed.ts +39 -0
  1029. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma.config.ts +12 -0
  1030. package/codeyam-cli/templates/nextjs-prisma-supabase/tsconfig.json +34 -0
  1031. package/codeyam-cli/templates/prompts/conversation-guidance.txt +44 -0
  1032. package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
  1033. package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
  1034. package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
  1035. package/codeyam-cli/templates/rule-notification-hook.py +83 -0
  1036. package/codeyam-cli/templates/rule-reflection-hook.py +647 -0
  1037. package/codeyam-cli/templates/rules-instructions.md +78 -0
  1038. package/codeyam-cli/templates/seed-adapters/supabase.ts +282 -0
  1039. package/codeyam-cli/templates/{codeyam-debug-skill.md → skills/codeyam-debug/SKILL.md} +48 -4
  1040. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
  1041. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +211 -0
  1042. package/codeyam-cli/templates/skills/codeyam-memory/SKILL.md +611 -0
  1043. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  1044. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
  1045. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
  1046. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  1047. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
  1048. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
  1049. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  1050. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
  1051. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
  1052. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
  1053. package/codeyam-cli/templates/skills/codeyam-new-rule/SKILL.md +11 -0
  1054. package/codeyam-cli/templates/{codeyam-setup-skill.md → skills/codeyam-setup/SKILL.md} +151 -4
  1055. package/codeyam-cli/templates/{codeyam-sim-skill.md → skills/codeyam-sim/SKILL.md} +1 -1
  1056. package/codeyam-cli/templates/{codeyam-test-skill.md → skills/codeyam-test/SKILL.md} +1 -1
  1057. package/codeyam-cli/templates/{codeyam-verify-skill.md → skills/codeyam-verify/SKILL.md} +1 -1
  1058. package/package.json +39 -29
  1059. package/packages/ai/index.js +8 -6
  1060. package/packages/ai/index.js.map +1 -1
  1061. package/packages/ai/src/lib/analyzeScope.js +181 -13
  1062. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  1063. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
  1064. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
  1065. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +176 -13
  1066. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  1067. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js +435 -0
  1068. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js.map +1 -0
  1069. package/packages/ai/src/lib/astScopes/methodSemantics.js +138 -23
  1070. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  1071. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
  1072. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
  1073. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js +8 -0
  1074. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js.map +1 -1
  1075. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +23 -0
  1076. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
  1077. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +138 -1
  1078. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
  1079. package/packages/ai/src/lib/astScopes/processExpression.js +1235 -104
  1080. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  1081. package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
  1082. package/packages/ai/src/lib/astScopes/sharedPatterns.js.map +1 -1
  1083. package/packages/ai/src/lib/checkAllAttributes.js +24 -9
  1084. package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
  1085. package/packages/ai/src/lib/completionCall.js +188 -38
  1086. package/packages/ai/src/lib/completionCall.js.map +1 -1
  1087. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +2192 -224
  1088. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  1089. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +19 -4
  1090. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  1091. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +661 -0
  1092. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
  1093. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +180 -56
  1094. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  1095. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
  1096. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
  1097. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
  1098. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
  1099. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +66 -2
  1100. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  1101. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +139 -13
  1102. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  1103. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
  1104. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
  1105. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
  1106. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
  1107. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +142 -12
  1108. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  1109. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
  1110. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
  1111. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
  1112. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
  1113. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
  1114. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
  1115. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +355 -77
  1116. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  1117. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
  1118. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
  1119. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
  1120. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
  1121. package/packages/ai/src/lib/dataStructureChunking.js +130 -0
  1122. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
  1123. package/packages/ai/src/lib/deepEqual.js +32 -0
  1124. package/packages/ai/src/lib/deepEqual.js.map +1 -0
  1125. package/packages/ai/src/lib/e2eDataTracking.js +241 -0
  1126. package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
  1127. package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
  1128. package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
  1129. package/packages/ai/src/lib/generateChangesEntityScenarioData.js +62 -5
  1130. package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
  1131. package/packages/ai/src/lib/generateChangesEntityScenarios.js +81 -90
  1132. package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
  1133. package/packages/ai/src/lib/generateEntityDataStructure.js +50 -1
  1134. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  1135. package/packages/ai/src/lib/generateEntityScenarioData.js +1183 -85
  1136. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  1137. package/packages/ai/src/lib/generateEntityScenarios.js +193 -83
  1138. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  1139. package/packages/ai/src/lib/generateExecutionFlows.js +484 -0
  1140. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -0
  1141. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js +380 -0
  1142. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js.map +1 -0
  1143. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +1807 -0
  1144. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
  1145. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
  1146. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
  1147. package/packages/ai/src/lib/getConditionalUsagesFromCode.js +84 -14
  1148. package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
  1149. package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -1
  1150. package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
  1151. package/packages/ai/src/lib/isolateScopes.js +270 -7
  1152. package/packages/ai/src/lib/isolateScopes.js.map +1 -1
  1153. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
  1154. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
  1155. package/packages/ai/src/lib/mergeStatements.js +88 -46
  1156. package/packages/ai/src/lib/mergeStatements.js.map +1 -1
  1157. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
  1158. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
  1159. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +16 -4
  1160. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  1161. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
  1162. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
  1163. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -64
  1164. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
  1165. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
  1166. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
  1167. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +83 -6
  1168. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
  1169. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -34
  1170. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
  1171. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js +45 -0
  1172. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js.map +1 -0
  1173. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +16 -3
  1174. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
  1175. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
  1176. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
  1177. package/packages/ai/src/lib/resolvePathToControllable.js +677 -0
  1178. package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -0
  1179. package/packages/ai/src/lib/splitOutsideParentheses.js +3 -1
  1180. package/packages/ai/src/lib/splitOutsideParentheses.js.map +1 -1
  1181. package/packages/ai/src/lib/worker/SerializableDataStructure.js +29 -0
  1182. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  1183. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +98 -1
  1184. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  1185. package/packages/analyze/index.js +1 -0
  1186. package/packages/analyze/index.js.map +1 -1
  1187. package/packages/analyze/src/lib/FileAnalyzer.js +75 -36
  1188. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  1189. package/packages/analyze/src/lib/ProjectAnalyzer.js +109 -30
  1190. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  1191. package/packages/analyze/src/lib/analysisContext.js +30 -5
  1192. package/packages/analyze/src/lib/analysisContext.js.map +1 -1
  1193. package/packages/analyze/src/lib/asts/index.js +4 -2
  1194. package/packages/analyze/src/lib/asts/index.js.map +1 -1
  1195. package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
  1196. package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
  1197. package/packages/analyze/src/lib/asts/nodes/index.js +1 -0
  1198. package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
  1199. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js +52 -0
  1200. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js.map +1 -0
  1201. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
  1202. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
  1203. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
  1204. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
  1205. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
  1206. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
  1207. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
  1208. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
  1209. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
  1210. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
  1211. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
  1212. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
  1213. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +428 -123
  1214. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  1215. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +49 -1
  1216. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  1217. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +11 -0
  1218. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  1219. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
  1220. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  1221. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -10
  1222. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  1223. package/packages/analyze/src/lib/files/analyzeChange.js +21 -11
  1224. package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
  1225. package/packages/analyze/src/lib/files/analyzeEntity.js +9 -8
  1226. package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
  1227. package/packages/analyze/src/lib/files/analyzeInitial.js +9 -10
  1228. package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
  1229. package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
  1230. package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
  1231. package/packages/analyze/src/lib/files/enums/steps.js +1 -1
  1232. package/packages/analyze/src/lib/files/enums/steps.js.map +1 -1
  1233. package/packages/analyze/src/lib/files/getImportedExports.js +17 -8
  1234. package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
  1235. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +907 -0
  1236. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
  1237. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +255 -0
  1238. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -0
  1239. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
  1240. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
  1241. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +525 -61
  1242. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  1243. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js +1 -1
  1244. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js.map +1 -1
  1245. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +29 -34
  1246. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
  1247. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +469 -85
  1248. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  1249. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +104 -0
  1250. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
  1251. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +56 -69
  1252. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
  1253. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +4 -8
  1254. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
  1255. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +891 -143
  1256. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  1257. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
  1258. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
  1259. package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
  1260. package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
  1261. package/packages/analyze/src/lib/index.js +1 -0
  1262. package/packages/analyze/src/lib/index.js.map +1 -1
  1263. package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
  1264. package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
  1265. package/packages/aws/src/lib/ecs/ecsDefineContainer.js +2 -2
  1266. package/packages/aws/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  1267. package/packages/aws/src/lib/ecs/ecsTaskFactory.js +17 -61
  1268. package/packages/aws/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  1269. package/packages/database/index.js +1 -0
  1270. package/packages/database/index.js.map +1 -1
  1271. package/packages/database/src/lib/analysisBranchToDb.js +1 -1
  1272. package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
  1273. package/packages/database/src/lib/analysisToDb.js +1 -1
  1274. package/packages/database/src/lib/analysisToDb.js.map +1 -1
  1275. package/packages/database/src/lib/branchToDb.js +1 -1
  1276. package/packages/database/src/lib/branchToDb.js.map +1 -1
  1277. package/packages/database/src/lib/commitBranchToDb.js +1 -1
  1278. package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
  1279. package/packages/database/src/lib/commitToDb.js +1 -1
  1280. package/packages/database/src/lib/commitToDb.js.map +1 -1
  1281. package/packages/database/src/lib/fileToDb.js +1 -1
  1282. package/packages/database/src/lib/fileToDb.js.map +1 -1
  1283. package/packages/database/src/lib/kysely/db.js +18 -3
  1284. package/packages/database/src/lib/kysely/db.js.map +1 -1
  1285. package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
  1286. package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  1287. package/packages/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  1288. package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  1289. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +149 -0
  1290. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  1291. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  1292. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  1293. package/packages/database/src/lib/loadAnalyses.js +45 -2
  1294. package/packages/database/src/lib/loadAnalyses.js.map +1 -1
  1295. package/packages/database/src/lib/loadAnalysis.js +8 -0
  1296. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  1297. package/packages/database/src/lib/loadBranch.js +11 -1
  1298. package/packages/database/src/lib/loadBranch.js.map +1 -1
  1299. package/packages/database/src/lib/loadCommit.js +7 -0
  1300. package/packages/database/src/lib/loadCommit.js.map +1 -1
  1301. package/packages/database/src/lib/loadCommits.js +45 -14
  1302. package/packages/database/src/lib/loadCommits.js.map +1 -1
  1303. package/packages/database/src/lib/loadEntities.js +23 -10
  1304. package/packages/database/src/lib/loadEntities.js.map +1 -1
  1305. package/packages/database/src/lib/loadEntityBranches.js +9 -0
  1306. package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
  1307. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +5 -3
  1308. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  1309. package/packages/database/src/lib/projectToDb.js +1 -1
  1310. package/packages/database/src/lib/projectToDb.js.map +1 -1
  1311. package/packages/database/src/lib/saveFiles.js +1 -1
  1312. package/packages/database/src/lib/saveFiles.js.map +1 -1
  1313. package/packages/database/src/lib/scenarioToDb.js +1 -1
  1314. package/packages/database/src/lib/scenarioToDb.js.map +1 -1
  1315. package/packages/database/src/lib/updateCommitMetadata.js +76 -89
  1316. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  1317. package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  1318. package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  1319. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  1320. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  1321. package/packages/generate/index.js +3 -0
  1322. package/packages/generate/index.js.map +1 -1
  1323. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  1324. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  1325. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +217 -0
  1326. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  1327. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  1328. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  1329. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +41 -9
  1330. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  1331. package/packages/generate/src/lib/deepMerge.js +27 -1
  1332. package/packages/generate/src/lib/deepMerge.js.map +1 -1
  1333. package/packages/generate/src/lib/getComponentScenarioPath.js +7 -3
  1334. package/packages/generate/src/lib/getComponentScenarioPath.js.map +1 -1
  1335. package/packages/generate/src/lib/scenarioComponentForServer.js +89 -0
  1336. package/packages/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  1337. package/packages/github/src/lib/loadOrCreateCommit.js +10 -0
  1338. package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
  1339. package/packages/github/src/lib/syncPrimaryBranch.js +3 -0
  1340. package/packages/github/src/lib/syncPrimaryBranch.js.map +1 -1
  1341. package/packages/process/index.js +3 -0
  1342. package/packages/process/index.js.map +1 -0
  1343. package/packages/process/src/GlobalProcessManager.js.map +1 -0
  1344. package/{background/src/lib/process → packages/process/src}/ProcessManager.js +1 -1
  1345. package/packages/process/src/ProcessManager.js.map +1 -0
  1346. package/packages/process/src/index.js.map +1 -0
  1347. package/packages/process/src/managedExecAsync.js.map +1 -0
  1348. package/packages/types/index.js.map +1 -1
  1349. package/packages/types/src/enums/ProjectFramework.js +2 -0
  1350. package/packages/types/src/enums/ProjectFramework.js.map +1 -1
  1351. package/packages/utils/src/lib/applyUniversalMocks.js +26 -2
  1352. package/packages/utils/src/lib/applyUniversalMocks.js.map +1 -1
  1353. package/packages/utils/src/lib/fs/rsyncCopy.js +98 -3
  1354. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  1355. package/packages/utils/src/lib/lightweightEntityExtractor.js +25 -0
  1356. package/packages/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  1357. package/packages/utils/src/lib/safeFileName.js +29 -3
  1358. package/packages/utils/src/lib/safeFileName.js.map +1 -1
  1359. package/scripts/npm-post-install.cjs +34 -0
  1360. package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
  1361. package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -197
  1362. package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -271
  1363. package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -294
  1364. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
  1365. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -115
  1366. package/analyzer-template/process/INTEGRATION_COMPLETE.md +0 -333
  1367. package/analyzer-template/process/INTEGRATION_EXAMPLE.md +0 -525
  1368. package/analyzer-template/process/README.md +0 -507
  1369. package/background/src/lib/process/GlobalProcessManager.js.map +0 -1
  1370. package/background/src/lib/process/ProcessManager.js.map +0 -1
  1371. package/background/src/lib/process/index.js.map +0 -1
  1372. package/background/src/lib/process/managedExecAsync.js.map +0 -1
  1373. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
  1374. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
  1375. package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -118
  1376. package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
  1377. package/codeyam-cli/src/commands/list.js +0 -31
  1378. package/codeyam-cli/src/commands/list.js.map +0 -1
  1379. package/codeyam-cli/src/commands/webapp-info.js +0 -146
  1380. package/codeyam-cli/src/commands/webapp-info.js.map +0 -1
  1381. package/codeyam-cli/src/utils/universal-mocks.js +0 -152
  1382. package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
  1383. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-CWKV2GEz.js +0 -1
  1384. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-DQeyk25_.js +0 -1
  1385. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-D2hFeDeg.js +0 -1
  1386. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-C8K-4kKP.js +0 -26
  1387. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DgXLv61M.js +0 -3
  1388. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-DFdLQbPS.js +0 -3
  1389. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DlRDjT4h.js +0 -1
  1390. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-7UkVL-UI.js +0 -1
  1391. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-XjtsGuPo.js +0 -5
  1392. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-ayCJdUAc.js +0 -1
  1393. package/codeyam-cli/src/webserver/build/client/assets/_index-D2eJjWLf.js +0 -1
  1394. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-w6sbwlOd.js +0 -7
  1395. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-BBNQ8hup.js +0 -1
  1396. package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-Bex4RrGs.js +0 -26
  1397. package/codeyam-cli/src/webserver/build/client/assets/circle-check-cdhjVtom.js +0 -1
  1398. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-DkgmwwRC.js +0 -1
  1399. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-YZ-kM3ZG.js +0 -1
  1400. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-BeQlz94_.js +0 -5
  1401. package/codeyam-cli/src/webserver/build/client/assets/entry.client-DN2XXM7Z.js +0 -5
  1402. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-CUeAIQNI.js +0 -1
  1403. package/codeyam-cli/src/webserver/build/client/assets/files-ccMQfhGf.js +0 -1
  1404. package/codeyam-cli/src/webserver/build/client/assets/git-JmESAHx5.js +0 -12
  1405. package/codeyam-cli/src/webserver/build/client/assets/globals-CO-U8Bpo.css +0 -1
  1406. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +0 -5
  1407. package/codeyam-cli/src/webserver/build/client/assets/index-DsL9BiOc.js +0 -8
  1408. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-COYCR2oZ.js +0 -1
  1409. package/codeyam-cli/src/webserver/build/client/assets/manifest-90adba57.js +0 -1
  1410. package/codeyam-cli/src/webserver/build/client/assets/root-DfbVEEjF.js +0 -16
  1411. package/codeyam-cli/src/webserver/build/client/assets/search-DvK9iMBu.js +0 -1
  1412. package/codeyam-cli/src/webserver/build/client/assets/server-build-CMKNK2uU.css +0 -1
  1413. package/codeyam-cli/src/webserver/build/client/assets/settings-9LTbit4Z.js +0 -1
  1414. package/codeyam-cli/src/webserver/build/client/assets/simulations-BrxN5ZtV.js +0 -1
  1415. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-Iv0p8T-1.js +0 -1
  1416. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-DOGXmJcI.js +0 -2
  1417. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-BWmSRPH6.js +0 -1
  1418. package/codeyam-cli/src/webserver/build/client/assets/useToast-C07gRg7Z.js +0 -1
  1419. package/codeyam-cli/src/webserver/build/server/assets/index-CE_1qXCG.js +0 -1
  1420. package/codeyam-cli/src/webserver/build/server/assets/server-build-BY_VDhiD.js +0 -166
  1421. package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
  1422. package/codeyam-cli/templates/debug-command.md +0 -141
  1423. package/packages/ai/src/lib/findMatchingAttribute.js +0 -77
  1424. package/packages/ai/src/lib/findMatchingAttribute.js.map +0 -1
  1425. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +0 -136
  1426. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
  1427. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -220
  1428. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
  1429. package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -241
  1430. package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +0 -1
  1431. package/packages/ai/src/lib/isFrontend.js +0 -5
  1432. package/packages/ai/src/lib/isFrontend.js.map +0 -1
  1433. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js +0 -40
  1434. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js.map +0 -1
  1435. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +0 -72
  1436. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
  1437. package/scripts/finalize-analyzer.cjs +0 -79
  1438. /package/analyzer-template/{process → packages/process/src}/GlobalProcessManager.ts +0 -0
  1439. /package/analyzer-template/{process → packages/process/src}/ProcessManager.ts +0 -0
  1440. /package/analyzer-template/{process → packages/process/src}/index.ts +0 -0
  1441. /package/analyzer-template/{process → packages/process/src}/managedExecAsync.ts +0 -0
  1442. /package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CMKNK2uU.css → styles-CMKNK2uU.css} +0 -0
  1443. /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
  1444. /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
  1445. /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +0 -0
@@ -0,0 +1,1829 @@
1
+ import { buildReverseDependencyGraph, classifyDirectChanges, computeEntityChangeStatus, buildChangedFilesMap, pageNameFromUrl, scenarioEntityName, buildEntityInfosFromScenarios, buildEntityInfosFromGlossary, filterGroupsByChangeStatus, filterGlossaryByChangeStatus, filterScenarioScreenshotsByChangeStatus, } from "../entityChangeStatus.js";
2
+ import { scanPageFilePaths, detectFirstFeature, readFeatureStartedAt, readEditorStep, readEditorSessionId, } from "../entityChangeStatus.server.js";
3
+ import * as fsModule from 'fs';
4
+ import * as pathModule from 'path';
5
+ import * as os from 'os';
6
+ // ── Helpers ──────────────────────────────────────────────────────────────
7
+ /** Shorthand to build an EntityInfo with importedBy metadata */
8
+ function entity(name, filePath, importedBy) {
9
+ if (!importedBy)
10
+ return { name, filePath };
11
+ // Convert simplified { filePath: [importerName, ...] } to DB format
12
+ const dbFormat = {};
13
+ for (const [fp, importers] of Object.entries(importedBy)) {
14
+ dbFormat[fp] = {};
15
+ for (const imp of importers) {
16
+ dbFormat[fp][imp] = { shas: ['test-sha'] };
17
+ }
18
+ }
19
+ return { name, filePath, importedBy: dbFormat };
20
+ }
21
+ /** Helper: get sorted impactedBy names from a result */
22
+ function impactNames(result, entityName) {
23
+ return (result[entityName]?.impactedBy || []).map((d) => d.name).sort();
24
+ }
25
+ // ── Tests ────────────────────────────────────────────────────────────────
26
+ describe('entityChangeStatus', () => {
27
+ // ── buildChangedFilesMap ───────────────────────────────────────────────
28
+ describe('buildChangedFilesMap', () => {
29
+ it('should map "added" files to "new"', () => {
30
+ const files = [
31
+ { path: 'components/New.tsx', status: 'added' },
32
+ ];
33
+ const result = buildChangedFilesMap(files, false);
34
+ expect(result.get('components/New.tsx')).toBe('new');
35
+ });
36
+ it('should map "untracked" files to "new"', () => {
37
+ const files = [
38
+ { path: 'components/Untracked.tsx', status: 'untracked' },
39
+ ];
40
+ const result = buildChangedFilesMap(files, false);
41
+ expect(result.get('components/Untracked.tsx')).toBe('new');
42
+ });
43
+ it('should map "modified" files to "edited"', () => {
44
+ const files = [
45
+ { path: 'components/Modified.tsx', status: 'modified' },
46
+ ];
47
+ const result = buildChangedFilesMap(files, false);
48
+ expect(result.get('components/Modified.tsx')).toBe('edited');
49
+ });
50
+ it('should ignore "deleted" files', () => {
51
+ const files = [
52
+ { path: 'components/Deleted.tsx', status: 'deleted' },
53
+ ];
54
+ const result = buildChangedFilesMap(files, false);
55
+ expect(result.size).toBe(0);
56
+ });
57
+ it('should ignore "renamed" files', () => {
58
+ const files = [
59
+ { path: 'components/Renamed.tsx', status: 'renamed' },
60
+ ];
61
+ const result = buildChangedFilesMap(files, false);
62
+ expect(result.size).toBe(0);
63
+ });
64
+ it('should treat ALL non-deleted files as "new" when isFirstFeature is true', () => {
65
+ const files = [
66
+ { path: 'components/Modified.tsx', status: 'modified' },
67
+ { path: 'components/Added.tsx', status: 'added' },
68
+ { path: 'components/Untracked.tsx', status: 'untracked' },
69
+ { path: 'components/Renamed.tsx', status: 'renamed' },
70
+ { path: 'components/Deleted.tsx', status: 'deleted' },
71
+ ];
72
+ const result = buildChangedFilesMap(files, true);
73
+ // Everything except deleted should be 'new'
74
+ expect(result.get('components/Modified.tsx')).toBe('new');
75
+ expect(result.get('components/Added.tsx')).toBe('new');
76
+ expect(result.get('components/Untracked.tsx')).toBe('new');
77
+ expect(result.get('components/Renamed.tsx')).toBe('new');
78
+ expect(result.has('components/Deleted.tsx')).toBe(false);
79
+ });
80
+ it('should return empty map for empty input', () => {
81
+ expect(buildChangedFilesMap([], false).size).toBe(0);
82
+ expect(buildChangedFilesMap([], true).size).toBe(0);
83
+ });
84
+ it('should handle mix of statuses correctly', () => {
85
+ const files = [
86
+ { path: 'a.tsx', status: 'added' },
87
+ { path: 'b.tsx', status: 'modified' },
88
+ { path: 'c.tsx', status: 'untracked' },
89
+ { path: 'd.tsx', status: 'deleted' },
90
+ ];
91
+ const result = buildChangedFilesMap(files, false);
92
+ expect(result.get('a.tsx')).toBe('new');
93
+ expect(result.get('b.tsx')).toBe('edited');
94
+ expect(result.get('c.tsx')).toBe('new');
95
+ expect(result.has('d.tsx')).toBe(false);
96
+ expect(result.size).toBe(3);
97
+ });
98
+ });
99
+ // ── pageNameFromUrl ───────────────────────────────────────────────────
100
+ describe('pageNameFromUrl', () => {
101
+ it('should return "Home" for null', () => {
102
+ expect(pageNameFromUrl(null)).toBe('Home');
103
+ });
104
+ it('should return "Home" for undefined', () => {
105
+ expect(pageNameFromUrl(undefined)).toBe('Home');
106
+ });
107
+ it('should return "Home" for root path "/"', () => {
108
+ expect(pageNameFromUrl('/')).toBe('Home');
109
+ });
110
+ it('should capitalize first segment for simple paths', () => {
111
+ expect(pageNameFromUrl('/about')).toBe('About');
112
+ expect(pageNameFromUrl('/drinks')).toBe('Drinks');
113
+ expect(pageNameFromUrl('/settings')).toBe('Settings');
114
+ });
115
+ it('should use only the first segment for nested paths', () => {
116
+ expect(pageNameFromUrl('/drinks/123')).toBe('Drinks');
117
+ expect(pageNameFromUrl('/blog/posts/latest')).toBe('Blog');
118
+ });
119
+ it('should strip query parameters', () => {
120
+ expect(pageNameFromUrl('/settings?tab=profile')).toBe('Settings');
121
+ expect(pageNameFromUrl('/drinks?sort=name&filter=ipa')).toBe('Drinks');
122
+ });
123
+ it('should handle paths without leading slash', () => {
124
+ expect(pageNameFromUrl('about')).toBe('About');
125
+ });
126
+ it('should handle empty string as Home', () => {
127
+ // Empty string: after stripping '/', split gives [''], charAt(0) is ''
128
+ // This is an edge case — empty string is falsy so returns Home
129
+ expect(pageNameFromUrl('')).toBe('Home');
130
+ });
131
+ it('should return Home for root path with query string', () => {
132
+ expect(pageNameFromUrl('/?demo=empty')).toBe('Home');
133
+ expect(pageNameFromUrl('/?state=seeded')).toBe('Home');
134
+ expect(pageNameFromUrl('/?tab=overview&sort=date')).toBe('Home');
135
+ });
136
+ it('should handle dynamic route segments', () => {
137
+ expect(pageNameFromUrl('/drinks/[id]')).toBe('Drinks');
138
+ expect(pageNameFromUrl('/users/[userId]/posts')).toBe('Users');
139
+ });
140
+ it('should strip file extensions from URL segments', () => {
141
+ expect(pageNameFromUrl('/library.html')).toBe('Library');
142
+ expect(pageNameFromUrl('/about.htm')).toBe('About');
143
+ expect(pageNameFromUrl('/library.html?article=a1')).toBe('Library');
144
+ });
145
+ });
146
+ // ── buildEntityInfosFromScenarios ─────────────────────────────────────
147
+ describe('buildEntityInfosFromScenarios', () => {
148
+ it('should extract component entity from scenario with componentName/componentPath', () => {
149
+ const scenarios = [
150
+ {
151
+ componentName: 'DrinkCard',
152
+ componentPath: 'components/DrinkCard.tsx',
153
+ },
154
+ ];
155
+ const result = buildEntityInfosFromScenarios(scenarios, {}, []);
156
+ expect(result).toEqual([
157
+ { name: 'DrinkCard', filePath: 'components/DrinkCard.tsx' },
158
+ ]);
159
+ });
160
+ it('should extract page entity from scenario with URL', () => {
161
+ const scenarios = [
162
+ { componentName: null, componentPath: null, url: '/' },
163
+ ];
164
+ const pageFilePaths = { Home: 'app/page.tsx' };
165
+ const result = buildEntityInfosFromScenarios(scenarios, pageFilePaths, []);
166
+ expect(result).toEqual([{ name: 'Home', filePath: 'app/page.tsx' }]);
167
+ });
168
+ it('should derive page name from URL using pageNameFromUrl', () => {
169
+ const scenarios = [
170
+ { componentName: null, componentPath: null, url: '/drinks/123' },
171
+ ];
172
+ const pageFilePaths = { Drinks: 'app/drinks/page.tsx' };
173
+ const result = buildEntityInfosFromScenarios(scenarios, pageFilePaths, []);
174
+ expect(result).toEqual([
175
+ { name: 'Drinks', filePath: 'app/drinks/page.tsx' },
176
+ ]);
177
+ });
178
+ it('should skip page scenarios when page file path is not found', () => {
179
+ const scenarios = [
180
+ { componentName: null, componentPath: null, url: '/nonexistent' },
181
+ ];
182
+ const result = buildEntityInfosFromScenarios(scenarios, {}, []);
183
+ expect(result).toEqual([]);
184
+ });
185
+ it('should deduplicate by entity name (first occurrence wins)', () => {
186
+ const scenarios = [
187
+ {
188
+ componentName: 'DrinkCard',
189
+ componentPath: 'components/DrinkCard.tsx',
190
+ },
191
+ {
192
+ componentName: 'DrinkCard',
193
+ componentPath: 'components/DrinkCard.tsx',
194
+ },
195
+ {
196
+ componentName: 'DrinkCard',
197
+ componentPath: 'components/DrinkCard2.tsx',
198
+ },
199
+ ];
200
+ const result = buildEntityInfosFromScenarios(scenarios, {}, []);
201
+ expect(result).toHaveLength(1);
202
+ expect(result[0].filePath).toBe('components/DrinkCard.tsx');
203
+ });
204
+ it('should enrich entities with importedBy metadata from entity DB', () => {
205
+ const scenarios = [
206
+ {
207
+ componentName: 'DrinkCard',
208
+ componentPath: 'components/DrinkCard.tsx',
209
+ },
210
+ ];
211
+ const entitiesWithMetadata = [
212
+ {
213
+ name: 'DrinkCard',
214
+ metadata: {
215
+ importedBy: {
216
+ 'components/DrinkCard.tsx': {
217
+ DrinkList: { shas: ['abc'] },
218
+ },
219
+ },
220
+ },
221
+ },
222
+ ];
223
+ const result = buildEntityInfosFromScenarios(scenarios, {}, entitiesWithMetadata);
224
+ expect(result[0].importedBy).toEqual({
225
+ 'components/DrinkCard.tsx': {
226
+ DrinkList: { shas: ['abc'] },
227
+ },
228
+ });
229
+ });
230
+ it('should handle entities without matching metadata (no importedBy)', () => {
231
+ const scenarios = [
232
+ {
233
+ componentName: 'DrinkCard',
234
+ componentPath: 'components/DrinkCard.tsx',
235
+ },
236
+ ];
237
+ const entitiesWithMetadata = [
238
+ { name: 'UnrelatedEntity', metadata: null },
239
+ ];
240
+ const result = buildEntityInfosFromScenarios(scenarios, {}, entitiesWithMetadata);
241
+ expect(result[0].importedBy).toBeUndefined();
242
+ });
243
+ it('should handle mixed component and page scenarios', () => {
244
+ const scenarios = [
245
+ {
246
+ componentName: 'DrinkCard',
247
+ componentPath: 'components/DrinkCard.tsx',
248
+ },
249
+ { componentName: null, componentPath: null, url: '/' },
250
+ { componentName: 'Header', componentPath: 'components/Header.tsx' },
251
+ { componentName: null, componentPath: null, url: '/drinks' },
252
+ ];
253
+ const pageFilePaths = {
254
+ Home: 'app/page.tsx',
255
+ Drinks: 'app/drinks/page.tsx',
256
+ };
257
+ const result = buildEntityInfosFromScenarios(scenarios, pageFilePaths, []);
258
+ expect(result.map((e) => e.name)).toEqual([
259
+ 'DrinkCard',
260
+ 'Home',
261
+ 'Header',
262
+ 'Drinks',
263
+ ]);
264
+ });
265
+ it('should skip scenarios with componentName but no componentPath', () => {
266
+ const scenarios = [
267
+ { componentName: 'DrinkCard', componentPath: null },
268
+ ];
269
+ const result = buildEntityInfosFromScenarios(scenarios, {}, []);
270
+ expect(result).toEqual([]);
271
+ });
272
+ it('should handle empty inputs', () => {
273
+ expect(buildEntityInfosFromScenarios([], {}, [])).toEqual([]);
274
+ });
275
+ it('should handle scenarios where url is undefined (not a page scenario)', () => {
276
+ // A scenario with no componentName and no url — should be skipped
277
+ const scenarios = [
278
+ { componentName: null, componentPath: null },
279
+ ];
280
+ const result = buildEntityInfosFromScenarios(scenarios, {}, []);
281
+ expect(result).toEqual([]);
282
+ });
283
+ it('should handle entity metadata with null metadata field', () => {
284
+ const scenarios = [
285
+ { componentName: 'Card', componentPath: 'components/Card.tsx' },
286
+ ];
287
+ const metadata = [
288
+ { name: 'Card', metadata: null },
289
+ ];
290
+ const result = buildEntityInfosFromScenarios(scenarios, {}, metadata);
291
+ expect(result[0].importedBy).toBeUndefined();
292
+ });
293
+ });
294
+ // ── buildReverseDependencyGraph ──────────────────────────────────────
295
+ describe('buildReverseDependencyGraph', () => {
296
+ it('should return empty map for empty entities', () => {
297
+ expect(buildReverseDependencyGraph([]).size).toBe(0);
298
+ });
299
+ it('should build reverse graph from a single importer', () => {
300
+ const result = buildReverseDependencyGraph([
301
+ entity('DrinkCard', 'components/DrinkCard.tsx', {
302
+ 'components/DrinkCard.tsx': ['DrinkList'],
303
+ }),
304
+ ]);
305
+ expect(result.get('DrinkCard')).toEqual(new Set(['DrinkList']));
306
+ });
307
+ it('should collect multiple importers across file paths', () => {
308
+ const result = buildReverseDependencyGraph([
309
+ entity('Button', 'components/Button.tsx', {
310
+ 'components/Button.tsx': ['LoginForm'],
311
+ 'lib/ui/Button.tsx': ['SignupForm'],
312
+ }),
313
+ ]);
314
+ expect(result.get('Button')).toEqual(new Set(['LoginForm', 'SignupForm']));
315
+ });
316
+ it('should deduplicate importers appearing under multiple file paths', () => {
317
+ const result = buildReverseDependencyGraph([
318
+ entity('Icon', 'components/Icon.tsx', {
319
+ 'components/Icon.tsx': ['Header'],
320
+ 'lib/Icon.tsx': ['Header'],
321
+ }),
322
+ ]);
323
+ expect(result.get('Icon')).toEqual(new Set(['Header']));
324
+ });
325
+ it('should skip entities with no importedBy metadata', () => {
326
+ const result = buildReverseDependencyGraph([
327
+ entity('Orphan', 'components/Orphan.tsx'),
328
+ entity('Used', 'components/Used.tsx', {
329
+ 'components/Used.tsx': ['Parent'],
330
+ }),
331
+ ]);
332
+ expect(result.has('Orphan')).toBe(false);
333
+ expect(result.get('Used')).toEqual(new Set(['Parent']));
334
+ });
335
+ it('should handle empty importedBy object gracefully', () => {
336
+ const entities = [
337
+ { name: 'Empty', filePath: 'components/Empty.tsx', importedBy: {} },
338
+ ];
339
+ const result = buildReverseDependencyGraph(entities);
340
+ expect(result.has('Empty')).toBe(false);
341
+ });
342
+ it('should handle multiple importers under a single file path', () => {
343
+ const result = buildReverseDependencyGraph([
344
+ entity('utils', 'lib/utils.ts', {
345
+ 'lib/utils.ts': ['DrinkCard', 'DrinkList', 'Header'],
346
+ }),
347
+ ]);
348
+ expect(result.get('utils')).toEqual(new Set(['DrinkCard', 'DrinkList', 'Header']));
349
+ });
350
+ });
351
+ // ── classifyDirectChanges ────────────────────────────────────────────
352
+ describe('classifyDirectChanges', () => {
353
+ it('should classify entities whose file paths match changed files', () => {
354
+ const changedFiles = new Map([
355
+ ['components/DrinkCard.tsx', 'edited'],
356
+ ['app/page.tsx', 'new'],
357
+ ]);
358
+ const entities = [
359
+ entity('DrinkCard', 'components/DrinkCard.tsx'),
360
+ entity('Home', 'app/page.tsx'),
361
+ entity('Header', 'components/Header.tsx'),
362
+ ];
363
+ const result = classifyDirectChanges(changedFiles, entities);
364
+ expect(result.get('DrinkCard')).toBe('edited');
365
+ expect(result.get('Home')).toBe('new');
366
+ expect(result.has('Header')).toBe(false);
367
+ });
368
+ it('should return empty map when no files match', () => {
369
+ const changedFiles = new Map([
370
+ ['unrelated/file.ts', 'edited'],
371
+ ]);
372
+ const result = classifyDirectChanges(changedFiles, [
373
+ entity('DrinkCard', 'components/DrinkCard.tsx'),
374
+ ]);
375
+ expect(result.size).toBe(0);
376
+ });
377
+ it('should return empty map for empty inputs', () => {
378
+ expect(classifyDirectChanges(new Map(), [])).toEqual(new Map());
379
+ });
380
+ it('should match file paths exactly (no normalization)', () => {
381
+ const changedFiles = new Map([
382
+ ['components/DrinkCard.tsx', 'edited'],
383
+ ]);
384
+ // Slightly different path should NOT match
385
+ const result = classifyDirectChanges(changedFiles, [
386
+ entity('DrinkCard', './components/DrinkCard.tsx'),
387
+ ]);
388
+ expect(result.size).toBe(0);
389
+ });
390
+ });
391
+ // ── computeEntityChangeStatus ────────────────────────────────────────
392
+ describe('computeEntityChangeStatus', () => {
393
+ // ── Basic classification ───────────────────────────────────────────
394
+ it('should mark entity as "new" when its file is added', () => {
395
+ const result = computeEntityChangeStatus(new Map([['components/DrinkCard.tsx', 'new']]), [entity('DrinkCard', 'components/DrinkCard.tsx')]);
396
+ expect(result['DrinkCard']).toEqual({ status: 'new' });
397
+ });
398
+ it('should mark entity as "edited" when its file is modified', () => {
399
+ const result = computeEntityChangeStatus(new Map([['components/DrinkCard.tsx', 'edited']]), [entity('DrinkCard', 'components/DrinkCard.tsx')]);
400
+ expect(result['DrinkCard']).toEqual({ status: 'edited' });
401
+ });
402
+ it('should omit unchanged entities with no impacted deps', () => {
403
+ const result = computeEntityChangeStatus(new Map([['components/DrinkCard.tsx', 'edited']]), [
404
+ entity('DrinkCard', 'components/DrinkCard.tsx'),
405
+ entity('Header', 'components/Header.tsx'),
406
+ ]);
407
+ expect(result['DrinkCard']).toBeDefined();
408
+ expect(result['Header']).toBeUndefined();
409
+ });
410
+ it('should return empty map for empty inputs', () => {
411
+ expect(computeEntityChangeStatus(new Map(), [])).toEqual({});
412
+ });
413
+ it('should return empty map when changedFiles has entries but no entity matches', () => {
414
+ const result = computeEntityChangeStatus(new Map([['unrelated/file.ts', 'edited']]), [entity('DrinkCard', 'components/DrinkCard.tsx')]);
415
+ expect(result).toEqual({});
416
+ });
417
+ // ── Single-level impact ────────────────────────────────────────────
418
+ it('should mark single-level impact: A imports B, B edited → A impacted by B', () => {
419
+ const result = computeEntityChangeStatus(new Map([['components/DrinkCard.tsx', 'edited']]), [
420
+ entity('DrinkCard', 'components/DrinkCard.tsx', {
421
+ 'components/DrinkCard.tsx': ['DrinkList'],
422
+ }),
423
+ entity('DrinkList', 'components/DrinkList.tsx'),
424
+ ]);
425
+ expect(result['DrinkCard']).toEqual({ status: 'edited' });
426
+ expect(result['DrinkList']).toEqual({
427
+ status: 'impacted',
428
+ impactedBy: [
429
+ {
430
+ name: 'DrinkCard',
431
+ filePath: 'components/DrinkCard.tsx',
432
+ changeType: 'edited',
433
+ },
434
+ ],
435
+ });
436
+ });
437
+ it('should preserve changeType correctly: "new" root cause shows as "new" in impactedBy', () => {
438
+ const result = computeEntityChangeStatus(new Map([['components/DrinkCard.tsx', 'new']]), [
439
+ entity('DrinkCard', 'components/DrinkCard.tsx', {
440
+ 'components/DrinkCard.tsx': ['DrinkList'],
441
+ }),
442
+ entity('DrinkList', 'components/DrinkList.tsx'),
443
+ ]);
444
+ expect(result['DrinkList']?.impactedBy?.[0]?.changeType).toBe('new');
445
+ });
446
+ // ── Multi-level transitive ─────────────────────────────────────────
447
+ it('should trace multi-level transitive: Icon→DrinkCard→DrinkList, Icon edited → all impacted by Icon', () => {
448
+ const result = computeEntityChangeStatus(new Map([['components/Icon.tsx', 'edited']]), [
449
+ entity('Icon', 'components/Icon.tsx', {
450
+ 'components/Icon.tsx': ['DrinkCard'],
451
+ }),
452
+ entity('DrinkCard', 'components/DrinkCard.tsx', {
453
+ 'components/DrinkCard.tsx': ['DrinkList'],
454
+ }),
455
+ entity('DrinkList', 'components/DrinkList.tsx'),
456
+ ]);
457
+ expect(result['Icon']).toEqual({ status: 'edited' });
458
+ // Both should trace back to Icon as root cause (not intermediate DrinkCard)
459
+ expect(result['DrinkCard']?.impactedBy).toEqual([
460
+ { name: 'Icon', filePath: 'components/Icon.tsx', changeType: 'edited' },
461
+ ]);
462
+ expect(result['DrinkList']?.impactedBy).toEqual([
463
+ { name: 'Icon', filePath: 'components/Icon.tsx', changeType: 'edited' },
464
+ ]);
465
+ });
466
+ // ── Multiple root causes ───────────────────────────────────────────
467
+ it('should track multiple root causes: DrinkCard imports Icon and utils (both changed)', () => {
468
+ const result = computeEntityChangeStatus(new Map([
469
+ ['components/Icon.tsx', 'edited'],
470
+ ['lib/utils.ts', 'new'],
471
+ ]), [
472
+ entity('Icon', 'components/Icon.tsx', {
473
+ 'components/Icon.tsx': ['DrinkCard'],
474
+ }),
475
+ entity('utils', 'lib/utils.ts', {
476
+ 'lib/utils.ts': ['DrinkCard'],
477
+ }),
478
+ entity('DrinkCard', 'components/DrinkCard.tsx'),
479
+ ]);
480
+ expect(result['DrinkCard']?.status).toBe('impacted');
481
+ expect(impactNames(result, 'DrinkCard')).toEqual(['Icon', 'utils']);
482
+ // Verify changeTypes are preserved
483
+ const iconDep = result['DrinkCard']?.impactedBy?.find((d) => d.name === 'Icon');
484
+ const utilsDep = result['DrinkCard']?.impactedBy?.find((d) => d.name === 'utils');
485
+ expect(iconDep?.changeType).toBe('edited');
486
+ expect(utilsDep?.changeType).toBe('new');
487
+ });
488
+ // ── Diamond dependency (BFS root cause propagation) ────────────────
489
+ it('should propagate ALL root causes through diamond: D1→A→C→E, D2→B→C→E', () => {
490
+ // This tests that when two paths converge at C and C has downstream
491
+ // importers (E), ALL root causes propagate through — not just the
492
+ // ones from whichever path was processed first.
493
+ //
494
+ // D1(edited) ──importedBy──→ A ──importedBy──→ C ──importedBy──→ E
495
+ // D2(new) ──importedBy──→ B ──importedBy──→ C
496
+ //
497
+ const result = computeEntityChangeStatus(new Map([
498
+ ['components/D1.tsx', 'edited'],
499
+ ['components/D2.tsx', 'new'],
500
+ ]), [
501
+ entity('D1', 'components/D1.tsx', {
502
+ 'components/D1.tsx': ['A'],
503
+ }),
504
+ entity('D2', 'components/D2.tsx', {
505
+ 'components/D2.tsx': ['B'],
506
+ }),
507
+ entity('A', 'components/A.tsx', {
508
+ 'components/A.tsx': ['C'],
509
+ }),
510
+ entity('B', 'components/B.tsx', {
511
+ 'components/B.tsx': ['C'],
512
+ }),
513
+ entity('C', 'components/C.tsx', {
514
+ 'components/C.tsx': ['E'],
515
+ }),
516
+ entity('E', 'components/E.tsx'),
517
+ ]);
518
+ // C should have both root causes
519
+ expect(result['C']?.status).toBe('impacted');
520
+ expect(impactNames(result, 'C')).toEqual(['D1', 'D2']);
521
+ // E (downstream of C) must also have both root causes
522
+ expect(result['E']?.status).toBe('impacted');
523
+ expect(impactNames(result, 'E')).toEqual(['D1', 'D2']);
524
+ });
525
+ it('should propagate root causes through diamond with unequal path lengths', () => {
526
+ // D1 reaches C directly (depth 1), D2 reaches C via B (depth 2).
527
+ // C has downstream E. E must get both root causes.
528
+ //
529
+ // D1(edited) ──importedBy──→ C ──importedBy──→ E
530
+ // D2(new) ──importedBy──→ B ──importedBy──→ C
531
+ //
532
+ const result = computeEntityChangeStatus(new Map([
533
+ ['components/D1.tsx', 'edited'],
534
+ ['components/D2.tsx', 'new'],
535
+ ]), [
536
+ entity('D1', 'components/D1.tsx', {
537
+ 'components/D1.tsx': ['C'],
538
+ }),
539
+ entity('D2', 'components/D2.tsx', {
540
+ 'components/D2.tsx': ['B'],
541
+ }),
542
+ entity('B', 'components/B.tsx', {
543
+ 'components/B.tsx': ['C'],
544
+ }),
545
+ entity('C', 'components/C.tsx', {
546
+ 'components/C.tsx': ['E'],
547
+ }),
548
+ entity('E', 'components/E.tsx'),
549
+ ]);
550
+ expect(impactNames(result, 'C')).toEqual(['D1', 'D2']);
551
+ expect(impactNames(result, 'E')).toEqual(['D1', 'D2']);
552
+ });
553
+ // ── Cycles ─────────────────────────────────────────────────────────
554
+ it('should handle simple cycle without infinite loop: A↔B, A edited', () => {
555
+ const result = computeEntityChangeStatus(new Map([['components/A.tsx', 'edited']]), [
556
+ entity('A', 'components/A.tsx', {
557
+ 'components/A.tsx': ['B'],
558
+ }),
559
+ entity('B', 'components/B.tsx', {
560
+ 'components/B.tsx': ['A'],
561
+ }),
562
+ ]);
563
+ expect(result['A']).toEqual({ status: 'edited' });
564
+ expect(result['B']).toEqual({
565
+ status: 'impacted',
566
+ impactedBy: [
567
+ { name: 'A', filePath: 'components/A.tsx', changeType: 'edited' },
568
+ ],
569
+ });
570
+ });
571
+ it('should handle three-node cycle: A→B→C→A, A edited', () => {
572
+ const result = computeEntityChangeStatus(new Map([['components/A.tsx', 'edited']]), [
573
+ entity('A', 'components/A.tsx', {
574
+ 'components/A.tsx': ['B'],
575
+ }),
576
+ entity('B', 'components/B.tsx', {
577
+ 'components/B.tsx': ['C'],
578
+ }),
579
+ entity('C', 'components/C.tsx', {
580
+ 'components/C.tsx': ['A'],
581
+ }),
582
+ ]);
583
+ expect(result['A']).toEqual({ status: 'edited' });
584
+ expect(result['B']?.status).toBe('impacted');
585
+ expect(result['C']?.status).toBe('impacted');
586
+ expect(impactNames(result, 'B')).toEqual(['A']);
587
+ expect(impactNames(result, 'C')).toEqual(['A']);
588
+ });
589
+ it('should handle cycle with multiple seeds: A→B→C→A, A and C both edited', () => {
590
+ const result = computeEntityChangeStatus(new Map([
591
+ ['components/A.tsx', 'edited'],
592
+ ['components/C.tsx', 'new'],
593
+ ]), [
594
+ entity('A', 'components/A.tsx', {
595
+ 'components/A.tsx': ['B'],
596
+ }),
597
+ entity('B', 'components/B.tsx', {
598
+ 'components/B.tsx': ['C'],
599
+ }),
600
+ entity('C', 'components/C.tsx', {
601
+ 'components/C.tsx': ['A'],
602
+ }),
603
+ ]);
604
+ // A and C directly changed
605
+ expect(result['A']).toEqual({ status: 'edited' });
606
+ expect(result['C']).toEqual({ status: 'new' });
607
+ // B is impacted by both (A importedBy B via A→B, C importedBy B via C→...→B)
608
+ expect(result['B']?.status).toBe('impacted');
609
+ expect(impactNames(result, 'B')).toEqual(['A', 'C']);
610
+ });
611
+ it('should handle self-import cycle gracefully', () => {
612
+ // Entity lists itself as its own importer
613
+ const result = computeEntityChangeStatus(new Map([['components/A.tsx', 'edited']]), [
614
+ entity('A', 'components/A.tsx', {
615
+ 'components/A.tsx': ['A'],
616
+ }),
617
+ ]);
618
+ // A is directly changed — self-loop should not create an impacted entry
619
+ expect(result['A']).toEqual({ status: 'edited' });
620
+ });
621
+ // ── Direct change priority ─────────────────────────────────────────
622
+ it('should NOT mark directly-changed entities as impacted even if they import other changed entities', () => {
623
+ const result = computeEntityChangeStatus(new Map([
624
+ ['components/A.tsx', 'edited'],
625
+ ['components/B.tsx', 'new'],
626
+ ]), [
627
+ entity('A', 'components/A.tsx', {
628
+ 'components/A.tsx': ['B'],
629
+ }),
630
+ entity('B', 'components/B.tsx'),
631
+ ]);
632
+ expect(result['A']).toEqual({ status: 'edited' });
633
+ expect(result['B']).toEqual({ status: 'new' });
634
+ });
635
+ it('should not produce impacted entries when ALL entities are directly changed', () => {
636
+ const result = computeEntityChangeStatus(new Map([
637
+ ['components/A.tsx', 'edited'],
638
+ ['components/B.tsx', 'new'],
639
+ ['components/C.tsx', 'edited'],
640
+ ]), [
641
+ entity('A', 'components/A.tsx', {
642
+ 'components/A.tsx': ['B'],
643
+ }),
644
+ entity('B', 'components/B.tsx', {
645
+ 'components/B.tsx': ['C'],
646
+ }),
647
+ entity('C', 'components/C.tsx'),
648
+ ]);
649
+ expect(Object.values(result).every((s) => s.status !== 'impacted')).toBe(true);
650
+ expect(result['A']?.status).toBe('edited');
651
+ expect(result['B']?.status).toBe('new');
652
+ expect(result['C']?.status).toBe('edited');
653
+ });
654
+ // ── Missing metadata / graceful degradation ────────────────────────
655
+ it('should handle missing importedBy metadata gracefully (no impact propagation)', () => {
656
+ const result = computeEntityChangeStatus(new Map([['components/DrinkCard.tsx', 'edited']]), [
657
+ entity('DrinkCard', 'components/DrinkCard.tsx'),
658
+ entity('DrinkList', 'components/DrinkList.tsx'),
659
+ ]);
660
+ expect(result['DrinkCard']).toEqual({ status: 'edited' });
661
+ expect(result['DrinkList']).toBeUndefined();
662
+ });
663
+ it('should skip phantom importers (importedBy references entity not in entities list)', () => {
664
+ // DrinkCard's importedBy references "PhantomPage" which is not in entities
665
+ const result = computeEntityChangeStatus(new Map([['components/DrinkCard.tsx', 'edited']]), [
666
+ entity('DrinkCard', 'components/DrinkCard.tsx', {
667
+ 'components/DrinkCard.tsx': ['PhantomPage', 'DrinkList'],
668
+ }),
669
+ entity('DrinkList', 'components/DrinkList.tsx'),
670
+ ]);
671
+ // PhantomPage should not appear in results (not in entities list)
672
+ expect(result['PhantomPage']).toBeUndefined();
673
+ // DrinkList should still be impacted
674
+ expect(result['DrinkList']?.status).toBe('impacted');
675
+ });
676
+ // ── maxDepth ───────────────────────────────────────────────────────
677
+ it('should enforce maxDepth and stop propagation beyond limit', () => {
678
+ // Chain: D → C → B → A
679
+ const result = computeEntityChangeStatus(new Map([['components/D.tsx', 'edited']]), [
680
+ entity('D', 'components/D.tsx', { 'components/D.tsx': ['C'] }),
681
+ entity('C', 'components/C.tsx', { 'components/C.tsx': ['B'] }),
682
+ entity('B', 'components/B.tsx', { 'components/B.tsx': ['A'] }),
683
+ entity('A', 'components/A.tsx'),
684
+ ], 2);
685
+ expect(result['D']).toEqual({ status: 'edited' });
686
+ expect(result['C']?.status).toBe('impacted');
687
+ expect(result['B']?.status).toBe('impacted');
688
+ // A at depth 3 is cut off
689
+ expect(result['A']).toBeUndefined();
690
+ });
691
+ it('should use default maxDepth of 20 when not specified', () => {
692
+ // Build a chain of depth 15 — should all be reached with default maxDepth
693
+ const entities = [];
694
+ for (let i = 0; i < 16; i++) {
695
+ const name = `E${i}`;
696
+ const filePath = `components/${name}.tsx`;
697
+ if (i < 15) {
698
+ entities.push(entity(name, filePath, { [filePath]: [`E${i + 1}`] }));
699
+ }
700
+ else {
701
+ entities.push(entity(name, filePath));
702
+ }
703
+ }
704
+ const result = computeEntityChangeStatus(new Map([['components/E0.tsx', 'edited']]), entities);
705
+ // E15 at depth 15 should still be reached (within default maxDepth of 20)
706
+ expect(result['E15']?.status).toBe('impacted');
707
+ });
708
+ // ── Fan-out ────────────────────────────────────────────────────────
709
+ it('should handle large fan-out: one changed entity imported by many', () => {
710
+ const importers = Array.from({ length: 10 }, (_, i) => `Comp${i}`);
711
+ const entities = [
712
+ entity('SharedUtil', 'lib/shared.ts', {
713
+ 'lib/shared.ts': importers,
714
+ }),
715
+ ...importers.map((name) => entity(name, `components/${name}.tsx`)),
716
+ ];
717
+ const result = computeEntityChangeStatus(new Map([['lib/shared.ts', 'edited']]), entities);
718
+ expect(result['SharedUtil']).toEqual({ status: 'edited' });
719
+ for (const name of importers) {
720
+ expect(result[name]?.status).toBe('impacted');
721
+ expect(result[name]?.impactedBy).toEqual([
722
+ {
723
+ name: 'SharedUtil',
724
+ filePath: 'lib/shared.ts',
725
+ changeType: 'edited',
726
+ },
727
+ ]);
728
+ }
729
+ });
730
+ // ── Deterministic output ───────────────────────────────────────────
731
+ it('should sort impactedBy array by name for deterministic output', () => {
732
+ const result = computeEntityChangeStatus(new Map([
733
+ ['components/Zebra.tsx', 'edited'],
734
+ ['components/Apple.tsx', 'new'],
735
+ ['components/Mango.tsx', 'edited'],
736
+ ]), [
737
+ entity('Zebra', 'components/Zebra.tsx', {
738
+ 'components/Zebra.tsx': ['Target'],
739
+ }),
740
+ entity('Apple', 'components/Apple.tsx', {
741
+ 'components/Apple.tsx': ['Target'],
742
+ }),
743
+ entity('Mango', 'components/Mango.tsx', {
744
+ 'components/Mango.tsx': ['Target'],
745
+ }),
746
+ entity('Target', 'components/Target.tsx'),
747
+ ]);
748
+ expect(impactNames(result, 'Target')).toEqual([
749
+ 'Apple',
750
+ 'Mango',
751
+ 'Zebra',
752
+ ]);
753
+ });
754
+ // ── Realistic integration-style scenarios ──────────────────────────
755
+ it('should compute correct status for a realistic Next.js app scenario', () => {
756
+ // Simulates a real editor session:
757
+ // - User edited DrinkCard component and added a new formatPrice utility
758
+ // - DrinkCard is imported by DrinkList component and Home page
759
+ // - formatPrice is imported by DrinkCard
760
+ // - Header is unchanged and imports nothing changed
761
+ //
762
+ // Expected:
763
+ // - DrinkCard: edited (directly changed)
764
+ // - formatPrice: new (directly changed)
765
+ // - DrinkList: impacted by [DrinkCard, formatPrice] (DrinkCard is edited,
766
+ // and formatPrice flows through DrinkCard)
767
+ // - Home: impacted by [DrinkCard, formatPrice] (same reasoning)
768
+ // - Header: not in results (unchanged, no changed deps)
769
+ const result = computeEntityChangeStatus(new Map([
770
+ ['components/DrinkCard.tsx', 'edited'],
771
+ ['lib/formatPrice.ts', 'new'],
772
+ ]), [
773
+ entity('formatPrice', 'lib/formatPrice.ts', {
774
+ 'lib/formatPrice.ts': ['DrinkCard'],
775
+ }),
776
+ entity('DrinkCard', 'components/DrinkCard.tsx', {
777
+ 'components/DrinkCard.tsx': ['DrinkList', 'Home'],
778
+ }),
779
+ entity('DrinkList', 'components/DrinkList.tsx'),
780
+ entity('Home', 'app/page.tsx'),
781
+ entity('Header', 'components/Header.tsx'),
782
+ ]);
783
+ expect(result['formatPrice']).toEqual({ status: 'new' });
784
+ expect(result['DrinkCard']).toEqual({ status: 'edited' });
785
+ expect(result['Header']).toBeUndefined();
786
+ // DrinkList and Home are impacted by DrinkCard (directly, its an importer)
787
+ // AND by formatPrice (transitively via DrinkCard)
788
+ expect(result['DrinkList']?.status).toBe('impacted');
789
+ expect(impactNames(result, 'DrinkList')).toEqual([
790
+ 'DrinkCard',
791
+ 'formatPrice',
792
+ ]);
793
+ expect(result['Home']?.status).toBe('impacted');
794
+ expect(impactNames(result, 'Home')).toEqual(['DrinkCard', 'formatPrice']);
795
+ });
796
+ it('should handle a realistic scenario where component is both directly changed AND an intermediate', () => {
797
+ // DrinkCard is edited AND it imports formatPrice (also changed).
798
+ // DrinkCard should be marked 'edited' (direct), not 'impacted'.
799
+ // DrinkList imports DrinkCard → impacted by both DrinkCard and formatPrice.
800
+ const result = computeEntityChangeStatus(new Map([
801
+ ['components/DrinkCard.tsx', 'edited'],
802
+ ['lib/formatPrice.ts', 'new'],
803
+ ]), [
804
+ entity('formatPrice', 'lib/formatPrice.ts', {
805
+ 'lib/formatPrice.ts': ['DrinkCard'],
806
+ }),
807
+ entity('DrinkCard', 'components/DrinkCard.tsx', {
808
+ 'components/DrinkCard.tsx': ['DrinkList'],
809
+ }),
810
+ entity('DrinkList', 'components/DrinkList.tsx'),
811
+ ]);
812
+ // DrinkCard is directly changed — status should be 'edited', no impactedBy
813
+ expect(result['DrinkCard']).toEqual({ status: 'edited' });
814
+ // DrinkList is impacted by BOTH root causes
815
+ expect(result['DrinkList']?.status).toBe('impacted');
816
+ expect(impactNames(result, 'DrinkList')).toEqual([
817
+ 'DrinkCard',
818
+ 'formatPrice',
819
+ ]);
820
+ });
821
+ // ── End-to-end pipeline test ───────────────────────────────────────
822
+ it('should produce correct results through the full pipeline: git files → scenarios → entity infos → status', () => {
823
+ // This tests the complete data flow that both route handlers execute:
824
+ // 1. buildChangedFilesMap from git status
825
+ // 2. buildEntityInfosFromScenarios from scenario data + metadata
826
+ // 3. computeEntityChangeStatus from the above
827
+ // Step 1: Git status
828
+ const gitFiles = [
829
+ { path: 'components/DrinkCard.tsx', status: 'modified' },
830
+ { path: 'lib/formatPrice.ts', status: 'added' },
831
+ { path: 'components/Header.tsx', status: 'deleted' },
832
+ ];
833
+ const changedFiles = buildChangedFilesMap(gitFiles, false);
834
+ expect(changedFiles.get('components/DrinkCard.tsx')).toBe('edited');
835
+ expect(changedFiles.get('lib/formatPrice.ts')).toBe('new');
836
+ expect(changedFiles.has('components/Header.tsx')).toBe(false);
837
+ // Step 2: Build entity infos from scenarios
838
+ const scenarios = [
839
+ {
840
+ componentName: 'DrinkCard',
841
+ componentPath: 'components/DrinkCard.tsx',
842
+ },
843
+ { componentName: null, componentPath: null, url: '/' },
844
+ {
845
+ componentName: 'DrinkList',
846
+ componentPath: 'components/DrinkList.tsx',
847
+ },
848
+ ];
849
+ const pageFilePaths = { Home: 'app/page.tsx' };
850
+ const metadata = [
851
+ {
852
+ name: 'DrinkCard',
853
+ metadata: {
854
+ importedBy: {
855
+ 'components/DrinkCard.tsx': {
856
+ DrinkList: { shas: ['sha1'] },
857
+ Home: { shas: ['sha2'] },
858
+ },
859
+ },
860
+ },
861
+ },
862
+ { name: 'DrinkList', metadata: null },
863
+ ];
864
+ const entityInfos = buildEntityInfosFromScenarios(scenarios, pageFilePaths, metadata);
865
+ expect(entityInfos).toHaveLength(3);
866
+ expect(entityInfos.find((e) => e.name === 'DrinkCard')?.importedBy).toBeDefined();
867
+ // Step 3: Compute status
868
+ const result = computeEntityChangeStatus(changedFiles, entityInfos);
869
+ expect(result['DrinkCard']).toEqual({ status: 'edited' });
870
+ expect(result['DrinkList']?.status).toBe('impacted');
871
+ expect(result['Home']?.status).toBe('impacted');
872
+ expect(impactNames(result, 'DrinkList')).toEqual(['DrinkCard']);
873
+ expect(impactNames(result, 'Home')).toEqual(['DrinkCard']);
874
+ });
875
+ it('should produce correct results for first-feature pipeline (all files new)', () => {
876
+ const gitFiles = [
877
+ { path: 'components/DrinkCard.tsx', status: 'modified' },
878
+ { path: 'app/page.tsx', status: 'modified' },
879
+ { path: 'components/Header.tsx', status: 'untracked' },
880
+ ];
881
+ // isFirstFeature = true → all become 'new'
882
+ const changedFiles = buildChangedFilesMap(gitFiles, true);
883
+ expect(changedFiles.get('components/DrinkCard.tsx')).toBe('new');
884
+ expect(changedFiles.get('app/page.tsx')).toBe('new');
885
+ expect(changedFiles.get('components/Header.tsx')).toBe('new');
886
+ const scenarios = [
887
+ {
888
+ componentName: 'DrinkCard',
889
+ componentPath: 'components/DrinkCard.tsx',
890
+ },
891
+ { componentName: null, componentPath: null, url: '/' },
892
+ { componentName: 'Header', componentPath: 'components/Header.tsx' },
893
+ ];
894
+ const entityInfos = buildEntityInfosFromScenarios(scenarios, { Home: 'app/page.tsx' }, []);
895
+ const result = computeEntityChangeStatus(changedFiles, entityInfos);
896
+ // All should be 'new' — none impacted
897
+ expect(result['DrinkCard']).toEqual({ status: 'new' });
898
+ expect(result['Home']).toEqual({ status: 'new' });
899
+ expect(result['Header']).toEqual({ status: 'new' });
900
+ expect(Object.values(result).some((s) => s.status === 'impacted')).toBe(false);
901
+ });
902
+ // ── Pass-through propagation ─────────────────────────────────────
903
+ it('should propagate root causes THROUGH a directly-changed intermediate entity', () => {
904
+ // D is edited, A is also edited, A importedBy B.
905
+ // D importedBy A (so D flows through A).
906
+ // B should be impacted by BOTH D (transitive through A) and A (direct importer).
907
+ //
908
+ // D(edited) ──importedBy──→ A(edited) ──importedBy──→ B
909
+ //
910
+ const result = computeEntityChangeStatus(new Map([
911
+ ['components/D.tsx', 'edited'],
912
+ ['components/A.tsx', 'edited'],
913
+ ]), [
914
+ entity('D', 'components/D.tsx', {
915
+ 'components/D.tsx': ['A'],
916
+ }),
917
+ entity('A', 'components/A.tsx', {
918
+ 'components/A.tsx': ['B'],
919
+ }),
920
+ entity('B', 'components/B.tsx'),
921
+ ]);
922
+ expect(result['D']).toEqual({ status: 'edited' });
923
+ expect(result['A']).toEqual({ status: 'edited' });
924
+ // B must see BOTH root causes — D propagated through A
925
+ expect(result['B']?.status).toBe('impacted');
926
+ expect(impactNames(result, 'B')).toEqual(['A', 'D']);
927
+ });
928
+ it('should propagate through a chain of directly-changed entities: D→C→B→A all changed except A', () => {
929
+ // D, C, B all directly changed. A imports B.
930
+ // A should see D, C, B as root causes.
931
+ const result = computeEntityChangeStatus(new Map([
932
+ ['components/D.tsx', 'edited'],
933
+ ['components/C.tsx', 'new'],
934
+ ['components/B.tsx', 'edited'],
935
+ ]), [
936
+ entity('D', 'components/D.tsx', { 'components/D.tsx': ['C'] }),
937
+ entity('C', 'components/C.tsx', { 'components/C.tsx': ['B'] }),
938
+ entity('B', 'components/B.tsx', { 'components/B.tsx': ['A'] }),
939
+ entity('A', 'components/A.tsx'),
940
+ ]);
941
+ expect(result['A']?.status).toBe('impacted');
942
+ expect(impactNames(result, 'A')).toEqual(['B', 'C', 'D']);
943
+ });
944
+ // ── Wide diamond ─────────────────────────────────────────────────
945
+ it('should handle wide diamond: 3+ paths converging then fanning out', () => {
946
+ // D1, D2, D3 all edited, all importedBy Merge, Merge importedBy [Out1, Out2]
947
+ //
948
+ // D1 ─┐
949
+ // D2 ─┼──importedBy──→ Merge ──importedBy──→ Out1
950
+ // D3 ─┘ └──importedBy──→ Out2
951
+ //
952
+ const result = computeEntityChangeStatus(new Map([
953
+ ['components/D1.tsx', 'edited'],
954
+ ['components/D2.tsx', 'new'],
955
+ ['components/D3.tsx', 'edited'],
956
+ ]), [
957
+ entity('D1', 'components/D1.tsx', { 'components/D1.tsx': ['Merge'] }),
958
+ entity('D2', 'components/D2.tsx', { 'components/D2.tsx': ['Merge'] }),
959
+ entity('D3', 'components/D3.tsx', { 'components/D3.tsx': ['Merge'] }),
960
+ entity('Merge', 'components/Merge.tsx', {
961
+ 'components/Merge.tsx': ['Out1', 'Out2'],
962
+ }),
963
+ entity('Out1', 'components/Out1.tsx'),
964
+ entity('Out2', 'components/Out2.tsx'),
965
+ ]);
966
+ // Merge gets all 3 root causes
967
+ expect(impactNames(result, 'Merge')).toEqual(['D1', 'D2', 'D3']);
968
+ // Out1 and Out2 also get all 3 root causes (propagated through Merge)
969
+ expect(impactNames(result, 'Out1')).toEqual(['D1', 'D2', 'D3']);
970
+ expect(impactNames(result, 'Out2')).toEqual(['D1', 'D2', 'D3']);
971
+ });
972
+ // ── changedFiles with non-entity entries ─────────────────────────
973
+ it('should ignore changedFiles entries that do not match any entity file path', () => {
974
+ // Git shows many changed files, but only some are entities
975
+ const result = computeEntityChangeStatus(new Map([
976
+ ['components/DrinkCard.tsx', 'edited'],
977
+ ['package.json', 'edited'],
978
+ ['README.md', 'new'],
979
+ ['.env', 'edited'],
980
+ ['tsconfig.json', 'edited'],
981
+ ]), [
982
+ entity('DrinkCard', 'components/DrinkCard.tsx', {
983
+ 'components/DrinkCard.tsx': ['DrinkList'],
984
+ }),
985
+ entity('DrinkList', 'components/DrinkList.tsx'),
986
+ ]);
987
+ expect(result['DrinkCard']).toEqual({ status: 'edited' });
988
+ expect(result['DrinkList']?.status).toBe('impacted');
989
+ // Only entities should appear in results
990
+ expect(Object.keys(result)).toEqual(['DrinkCard', 'DrinkList']);
991
+ });
992
+ });
993
+ // ── buildEntityInfosFromScenarios — additional edge cases ────────
994
+ describe('buildEntityInfosFromScenarios (edge cases)', () => {
995
+ it('should deduplicate page scenarios with different URLs resolving to same name', () => {
996
+ // /drinks and /drinks/123 both resolve to "Drinks"
997
+ const scenarios = [
998
+ { componentName: null, componentPath: null, url: '/drinks' },
999
+ { componentName: null, componentPath: null, url: '/drinks/123' },
1000
+ {
1001
+ componentName: null,
1002
+ componentPath: null,
1003
+ url: '/drinks/456?tab=reviews',
1004
+ },
1005
+ ];
1006
+ const pageFilePaths = { Drinks: 'app/drinks/page.tsx' };
1007
+ const result = buildEntityInfosFromScenarios(scenarios, pageFilePaths, []);
1008
+ // Should deduplicate to a single "Drinks" entity
1009
+ expect(result).toHaveLength(1);
1010
+ expect(result[0]).toEqual({
1011
+ name: 'Drinks',
1012
+ filePath: 'app/drinks/page.tsx',
1013
+ });
1014
+ });
1015
+ it('should handle component and page scenario with same conceptual name (component wins)', () => {
1016
+ // A component named "Home" AND a page URL "/" both produce name "Home"
1017
+ // Component scenario comes first — it should win
1018
+ const scenarios = [
1019
+ { componentName: 'Home', componentPath: 'components/Home.tsx' },
1020
+ { componentName: null, componentPath: null, url: '/' },
1021
+ ];
1022
+ const pageFilePaths = { Home: 'app/page.tsx' };
1023
+ const result = buildEntityInfosFromScenarios(scenarios, pageFilePaths, []);
1024
+ expect(result).toHaveLength(1);
1025
+ // Component path should win (first occurrence)
1026
+ expect(result[0].filePath).toBe('components/Home.tsx');
1027
+ });
1028
+ it('should handle multiple scenarios for the same component (only first is included)', () => {
1029
+ const scenarios = [
1030
+ {
1031
+ componentName: 'DrinkCard',
1032
+ componentPath: 'components/DrinkCard.tsx',
1033
+ },
1034
+ {
1035
+ componentName: 'DrinkCard',
1036
+ componentPath: 'components/DrinkCard.tsx',
1037
+ },
1038
+ {
1039
+ componentName: 'DrinkCard',
1040
+ componentPath: 'components/DrinkCard.tsx',
1041
+ },
1042
+ ];
1043
+ const metadata = [
1044
+ {
1045
+ name: 'DrinkCard',
1046
+ metadata: {
1047
+ importedBy: {
1048
+ 'components/DrinkCard.tsx': { DrinkList: { shas: ['abc'] } },
1049
+ },
1050
+ },
1051
+ },
1052
+ ];
1053
+ const result = buildEntityInfosFromScenarios(scenarios, {}, metadata);
1054
+ expect(result).toHaveLength(1);
1055
+ expect(result[0].importedBy).toBeDefined();
1056
+ });
1057
+ });
1058
+ // ── Full pipeline regression tests ───────────────────────────────
1059
+ describe('full pipeline regression tests', () => {
1060
+ it('regression: entity with changed file AND imported by other unchanged entities should propagate', () => {
1061
+ // This catches the old regex-based bug: previously, "impacted" was marked
1062
+ // for every entity not directly changed, even if no dependency was actually changed.
1063
+ // With the new system, only entities that transitively import a changed entity get impacted.
1064
+ const gitFiles = [
1065
+ { path: 'lib/formatPrice.ts', status: 'added' },
1066
+ ];
1067
+ const changedFiles = buildChangedFilesMap(gitFiles, false);
1068
+ const scenarios = [
1069
+ {
1070
+ componentName: 'DrinkCard',
1071
+ componentPath: 'components/DrinkCard.tsx',
1072
+ },
1073
+ { componentName: 'Header', componentPath: 'components/Header.tsx' },
1074
+ { componentName: null, componentPath: null, url: '/' },
1075
+ ];
1076
+ const pageFilePaths = { Home: 'app/page.tsx' };
1077
+ const metadata = [
1078
+ {
1079
+ name: 'formatPrice',
1080
+ metadata: {
1081
+ importedBy: {
1082
+ 'lib/formatPrice.ts': { DrinkCard: { shas: ['sha1'] } },
1083
+ },
1084
+ },
1085
+ },
1086
+ {
1087
+ name: 'DrinkCard',
1088
+ metadata: {
1089
+ importedBy: {
1090
+ 'components/DrinkCard.tsx': { Home: { shas: ['sha2'] } },
1091
+ },
1092
+ },
1093
+ },
1094
+ ];
1095
+ // formatPrice is not a scenario entity — only DrinkCard, Header, Home are.
1096
+ // But formatPrice IS in the metadata as importedBy DrinkCard.
1097
+ // We need to include formatPrice in entityInfos for the graph to work.
1098
+ // However, buildEntityInfosFromScenarios only builds from scenarios,
1099
+ // so formatPrice won't be in the entities list → DrinkCard won't be impacted.
1100
+ //
1101
+ // This test documents the current behavior: only entities from scenarios
1102
+ // participate in the change status graph. Changed files that aren't entities
1103
+ // don't propagate impact (they'd need to be in the entities list).
1104
+ const entityInfos = buildEntityInfosFromScenarios(scenarios, pageFilePaths, metadata);
1105
+ const result = computeEntityChangeStatus(changedFiles, entityInfos);
1106
+ // formatPrice is not in scenarios, so not in entityInfos
1107
+ expect(entityInfos.find((e) => e.name === 'formatPrice')).toBeUndefined();
1108
+ // No entity files match changed files → empty result
1109
+ // DrinkCard and Home are NOT impacted because formatPrice is not in entities
1110
+ expect(result['DrinkCard']).toBeUndefined();
1111
+ expect(result['Header']).toBeUndefined();
1112
+ expect(result['Home']).toBeUndefined();
1113
+ });
1114
+ it('pipeline: changed utility file that IS an entity propagates impact correctly', () => {
1115
+ // When the changed utility IS registered as a scenario entity,
1116
+ // the full chain works end-to-end.
1117
+ const gitFiles = [
1118
+ { path: 'lib/formatPrice.ts', status: 'added' },
1119
+ ];
1120
+ const changedFiles = buildChangedFilesMap(gitFiles, false);
1121
+ const scenarios = [
1122
+ { componentName: 'formatPrice', componentPath: 'lib/formatPrice.ts' },
1123
+ {
1124
+ componentName: 'DrinkCard',
1125
+ componentPath: 'components/DrinkCard.tsx',
1126
+ },
1127
+ { componentName: null, componentPath: null, url: '/' },
1128
+ ];
1129
+ const pageFilePaths = { Home: 'app/page.tsx' };
1130
+ const metadata = [
1131
+ {
1132
+ name: 'formatPrice',
1133
+ metadata: {
1134
+ importedBy: {
1135
+ 'lib/formatPrice.ts': { DrinkCard: { shas: ['sha1'] } },
1136
+ },
1137
+ },
1138
+ },
1139
+ {
1140
+ name: 'DrinkCard',
1141
+ metadata: {
1142
+ importedBy: {
1143
+ 'components/DrinkCard.tsx': { Home: { shas: ['sha2'] } },
1144
+ },
1145
+ },
1146
+ },
1147
+ ];
1148
+ const entityInfos = buildEntityInfosFromScenarios(scenarios, pageFilePaths, metadata);
1149
+ const result = computeEntityChangeStatus(changedFiles, entityInfos);
1150
+ expect(result['formatPrice']).toEqual({ status: 'new' });
1151
+ expect(result['DrinkCard']?.status).toBe('impacted');
1152
+ expect(impactNames(result, 'DrinkCard')).toEqual(['formatPrice']);
1153
+ expect(result['Home']?.status).toBe('impacted');
1154
+ expect(impactNames(result, 'Home')).toEqual(['formatPrice']);
1155
+ });
1156
+ it('pipeline: renamed file status is correctly ignored', () => {
1157
+ const gitFiles = [
1158
+ { path: 'components/OldName.tsx', status: 'renamed' },
1159
+ { path: 'components/DrinkCard.tsx', status: 'modified' },
1160
+ ];
1161
+ const changedFiles = buildChangedFilesMap(gitFiles, false);
1162
+ // Renamed file should not appear
1163
+ expect(changedFiles.has('components/OldName.tsx')).toBe(false);
1164
+ expect(changedFiles.get('components/DrinkCard.tsx')).toBe('edited');
1165
+ });
1166
+ it('pipeline: first feature mode with import graph still marks everything new', () => {
1167
+ // Even with importedBy metadata, first-feature mode should mark
1168
+ // all entities as 'new' with no 'impacted' entries.
1169
+ const gitFiles = [
1170
+ { path: 'components/DrinkCard.tsx', status: 'modified' },
1171
+ { path: 'app/page.tsx', status: 'modified' },
1172
+ ];
1173
+ const changedFiles = buildChangedFilesMap(gitFiles, true); // first feature!
1174
+ const scenarios = [
1175
+ {
1176
+ componentName: 'DrinkCard',
1177
+ componentPath: 'components/DrinkCard.tsx',
1178
+ },
1179
+ { componentName: null, componentPath: null, url: '/' },
1180
+ ];
1181
+ const metadata = [
1182
+ {
1183
+ name: 'DrinkCard',
1184
+ metadata: {
1185
+ importedBy: {
1186
+ 'components/DrinkCard.tsx': { Home: { shas: ['sha1'] } },
1187
+ },
1188
+ },
1189
+ },
1190
+ ];
1191
+ const entityInfos = buildEntityInfosFromScenarios(scenarios, { Home: 'app/page.tsx' }, metadata);
1192
+ const result = computeEntityChangeStatus(changedFiles, entityInfos);
1193
+ // Both are directly changed (new) → no impact propagation
1194
+ expect(result['DrinkCard']).toEqual({ status: 'new' });
1195
+ expect(result['Home']).toEqual({ status: 'new' });
1196
+ });
1197
+ });
1198
+ // ── filterGroupsByChangeStatus ──────────────────────────────────────────
1199
+ describe('filterGroupsByChangeStatus', () => {
1200
+ const groups = [
1201
+ ['Home', ['s1', 's2']],
1202
+ ['About', ['s3']],
1203
+ ['Header', ['s4']],
1204
+ ];
1205
+ it('should return all groups when entityChangeStatus is undefined', () => {
1206
+ expect(filterGroupsByChangeStatus(groups, undefined)).toEqual(groups);
1207
+ });
1208
+ it('should return all groups when entityChangeStatus is empty', () => {
1209
+ expect(filterGroupsByChangeStatus(groups, {})).toEqual(groups);
1210
+ });
1211
+ it('should filter to only groups with a change status', () => {
1212
+ const status = {
1213
+ Home: { status: 'new' },
1214
+ Header: { status: 'edited' },
1215
+ };
1216
+ const result = filterGroupsByChangeStatus(groups, status);
1217
+ expect(result).toEqual([
1218
+ ['Home', ['s1', 's2']],
1219
+ ['Header', ['s4']],
1220
+ ]);
1221
+ });
1222
+ it('should return empty array when no groups match', () => {
1223
+ const status = {
1224
+ Footer: { status: 'new' },
1225
+ };
1226
+ const result = filterGroupsByChangeStatus(groups, status);
1227
+ expect(result).toEqual([]);
1228
+ });
1229
+ });
1230
+ // ── buildEntityInfosFromGlossary ────────────────────────────────────
1231
+ describe('buildEntityInfosFromGlossary', () => {
1232
+ it('should convert glossary entries to EntityInfo with name and filePath', () => {
1233
+ const glossary = [
1234
+ { name: 'pad', filePath: 'app/lib/calendar.ts' },
1235
+ { name: 'formatDate', filePath: 'app/lib/calendar.ts' },
1236
+ ];
1237
+ const result = buildEntityInfosFromGlossary(glossary);
1238
+ expect(result).toEqual([
1239
+ { name: 'pad', filePath: 'app/lib/calendar.ts' },
1240
+ { name: 'formatDate', filePath: 'app/lib/calendar.ts' },
1241
+ ]);
1242
+ });
1243
+ it('should deduplicate by name (first occurrence wins)', () => {
1244
+ const glossary = [
1245
+ { name: 'pad', filePath: 'app/lib/calendar.ts' },
1246
+ { name: 'pad', filePath: 'app/lib/other.ts' },
1247
+ ];
1248
+ const result = buildEntityInfosFromGlossary(glossary);
1249
+ expect(result).toHaveLength(1);
1250
+ expect(result[0].filePath).toBe('app/lib/calendar.ts');
1251
+ });
1252
+ it('should skip entries already present in existingNames set', () => {
1253
+ const glossary = [
1254
+ { name: 'Home', filePath: 'app/lib/calendar.ts' },
1255
+ { name: 'pad', filePath: 'app/lib/calendar.ts' },
1256
+ ];
1257
+ const existing = new Set(['Home']);
1258
+ const result = buildEntityInfosFromGlossary(glossary, existing);
1259
+ expect(result).toHaveLength(1);
1260
+ expect(result[0].name).toBe('pad');
1261
+ });
1262
+ it('should return empty array for empty input', () => {
1263
+ expect(buildEntityInfosFromGlossary([])).toEqual([]);
1264
+ });
1265
+ });
1266
+ // ── filterGlossaryByChangeStatus ──────────────────────────────────────
1267
+ describe('filterGlossaryByChangeStatus', () => {
1268
+ const functions = [
1269
+ {
1270
+ name: 'pad',
1271
+ filePath: 'lib/calendar.ts',
1272
+ description: '',
1273
+ testFile: 'test.ts',
1274
+ },
1275
+ {
1276
+ name: 'formatDate',
1277
+ filePath: 'lib/calendar.ts',
1278
+ description: '',
1279
+ testFile: 'test.ts',
1280
+ },
1281
+ {
1282
+ name: 'getDays',
1283
+ filePath: 'lib/calendar.ts',
1284
+ description: '',
1285
+ testFile: 'test.ts',
1286
+ },
1287
+ ];
1288
+ it('should return all functions when entityChangeStatus is undefined', () => {
1289
+ expect(filterGlossaryByChangeStatus(functions, undefined)).toEqual(functions);
1290
+ });
1291
+ it('should return all functions when entityChangeStatus is empty', () => {
1292
+ expect(filterGlossaryByChangeStatus(functions, {})).toEqual(functions);
1293
+ });
1294
+ it('should filter to only functions with a change status', () => {
1295
+ const status = {
1296
+ pad: { status: 'new' },
1297
+ getDays: { status: 'edited' },
1298
+ };
1299
+ const result = filterGlossaryByChangeStatus(functions, status);
1300
+ expect(result).toHaveLength(2);
1301
+ expect(result.map((f) => f.name)).toEqual(['pad', 'getDays']);
1302
+ });
1303
+ it('should return empty array when no functions match', () => {
1304
+ const status = {
1305
+ SomeOtherThing: { status: 'new' },
1306
+ };
1307
+ const result = filterGlossaryByChangeStatus(functions, status);
1308
+ expect(result).toEqual([]);
1309
+ });
1310
+ });
1311
+ // ── scenarioEntityName ──────────────────────────────────────────────
1312
+ describe('scenarioEntityName', () => {
1313
+ it('should return componentName when set', () => {
1314
+ expect(scenarioEntityName({
1315
+ componentName: 'ReviewCard',
1316
+ url: '/isolated-components/ReviewCard?s=Default',
1317
+ })).toBe('ReviewCard');
1318
+ });
1319
+ it('should return page name from URL when componentName is null', () => {
1320
+ expect(scenarioEntityName({ componentName: null, url: '/drinks/1' })).toBe('Drinks');
1321
+ });
1322
+ it('should return Home for root URL when componentName is null', () => {
1323
+ expect(scenarioEntityName({ componentName: null, url: '/' })).toBe('Home');
1324
+ });
1325
+ it('should return Home when both componentName and url are null', () => {
1326
+ expect(scenarioEntityName({ componentName: null, url: null })).toBe('Home');
1327
+ });
1328
+ it('should return page name when componentName is undefined', () => {
1329
+ expect(scenarioEntityName({ url: '/settings' })).toBe('Settings');
1330
+ });
1331
+ it('should return Home when no fields provided', () => {
1332
+ expect(scenarioEntityName({})).toBe('Home');
1333
+ });
1334
+ });
1335
+ // ── filterScenarioScreenshotsByChangeStatus ───────────────────────────
1336
+ describe('filterScenarioScreenshotsByChangeStatus', () => {
1337
+ it('should return all screenshots when entityChangeStatus is undefined', () => {
1338
+ const screenshots = [
1339
+ { name: 'Busy Month', path: 'busy.png', componentName: null, url: '/' },
1340
+ {
1341
+ name: 'EventPill - Default',
1342
+ path: 'pill.png',
1343
+ componentName: 'EventPill',
1344
+ url: '/isolated-components/EventPill',
1345
+ },
1346
+ ];
1347
+ expect(filterScenarioScreenshotsByChangeStatus(screenshots, undefined)).toEqual(screenshots);
1348
+ });
1349
+ it('should return all screenshots when entityChangeStatus is empty', () => {
1350
+ const screenshots = [
1351
+ { name: 'Busy Month', path: 'busy.png', componentName: null, url: '/' },
1352
+ ];
1353
+ expect(filterScenarioScreenshotsByChangeStatus(screenshots, {})).toEqual(screenshots);
1354
+ });
1355
+ it('should include component scenarios whose entity has a change status', () => {
1356
+ const screenshots = [
1357
+ {
1358
+ name: 'EventPill - Default',
1359
+ path: 'pill.png',
1360
+ componentName: 'EventPill',
1361
+ url: '/isolated-components/EventPill',
1362
+ },
1363
+ {
1364
+ name: 'ErrorState - Server Error',
1365
+ path: 'error.png',
1366
+ componentName: 'ErrorState',
1367
+ url: '/isolated-components/ErrorState',
1368
+ },
1369
+ {
1370
+ name: 'CalendarGrid - Default',
1371
+ path: 'grid.png',
1372
+ componentName: 'CalendarGrid',
1373
+ url: '/isolated-components/CalendarGrid',
1374
+ },
1375
+ ];
1376
+ const status = {
1377
+ ErrorState: { status: 'new' },
1378
+ EventPill: { status: 'edited' },
1379
+ };
1380
+ const result = filterScenarioScreenshotsByChangeStatus(screenshots, status);
1381
+ expect(result.map((s) => s.name)).toEqual([
1382
+ 'EventPill - Default',
1383
+ 'ErrorState - Server Error',
1384
+ ]);
1385
+ });
1386
+ it('should include page scenarios whose page entity has a change status', () => {
1387
+ const screenshots = [
1388
+ { name: 'Busy Month', path: 'busy.png', componentName: null, url: '/' },
1389
+ {
1390
+ name: 'Empty Calendar',
1391
+ path: 'empty.png',
1392
+ componentName: null,
1393
+ url: '/',
1394
+ },
1395
+ ];
1396
+ const status = {
1397
+ Home: { status: 'edited' },
1398
+ };
1399
+ const result = filterScenarioScreenshotsByChangeStatus(screenshots, status);
1400
+ expect(result).toEqual(screenshots);
1401
+ });
1402
+ it('should exclude page scenarios when their page entity has no status', () => {
1403
+ const screenshots = [
1404
+ { name: 'Busy Month', path: 'busy.png', componentName: null, url: '/' },
1405
+ {
1406
+ name: 'EventPill - Default',
1407
+ path: 'pill.png',
1408
+ componentName: 'EventPill',
1409
+ url: '/isolated-components/EventPill',
1410
+ },
1411
+ ];
1412
+ const status = {
1413
+ SomeComponent: { status: 'new' },
1414
+ };
1415
+ const result = filterScenarioScreenshotsByChangeStatus(screenshots, status);
1416
+ // Home page has no status, so "Busy Month" is excluded
1417
+ // SomeComponent doesn't match EventPill either
1418
+ expect(result).toEqual([]);
1419
+ });
1420
+ it('should include both page and component scenarios when both entities have status', () => {
1421
+ const screenshots = [
1422
+ { name: 'Busy Month', path: 'busy.png', componentName: null, url: '/' },
1423
+ {
1424
+ name: 'Empty Calendar',
1425
+ path: 'empty.png',
1426
+ componentName: null,
1427
+ url: '/',
1428
+ },
1429
+ {
1430
+ name: 'EventPill - Default',
1431
+ path: 'pill.png',
1432
+ componentName: 'EventPill',
1433
+ url: '/isolated-components/EventPill',
1434
+ },
1435
+ ];
1436
+ const status = {
1437
+ Home: { status: 'edited' },
1438
+ EventPill: { status: 'new' },
1439
+ };
1440
+ const result = filterScenarioScreenshotsByChangeStatus(screenshots, status);
1441
+ expect(result.map((s) => s.name)).toEqual([
1442
+ 'Busy Month',
1443
+ 'Empty Calendar',
1444
+ 'EventPill - Default',
1445
+ ]);
1446
+ });
1447
+ it('should handle page scenarios with dashes in names using URL, not name parsing', () => {
1448
+ // The original bug: "Drink Detail - Earl Grey" was parsed as component "Drink Detail"
1449
+ const screenshots = [
1450
+ {
1451
+ name: 'Drink Detail - Earl Grey',
1452
+ path: 'earl.png',
1453
+ componentName: null,
1454
+ url: '/drinks/1',
1455
+ },
1456
+ {
1457
+ name: 'Drink Detail - No Reviews',
1458
+ path: 'no-reviews.png',
1459
+ componentName: null,
1460
+ url: '/drinks/1',
1461
+ },
1462
+ {
1463
+ name: 'ReviewCard - Default',
1464
+ path: 'review.png',
1465
+ componentName: 'ReviewCard',
1466
+ url: '/isolated-components/ReviewCard',
1467
+ },
1468
+ {
1469
+ name: 'Full Catalog',
1470
+ path: 'catalog.png',
1471
+ componentName: null,
1472
+ url: '/',
1473
+ },
1474
+ ];
1475
+ const status = {
1476
+ Drinks: { status: 'new' },
1477
+ ReviewCard: { status: 'new' },
1478
+ Home: { status: 'edited' },
1479
+ };
1480
+ const result = filterScenarioScreenshotsByChangeStatus(screenshots, status);
1481
+ expect(result.map((s) => s.name)).toEqual([
1482
+ 'Drink Detail - Earl Grey',
1483
+ 'Drink Detail - No Reviews',
1484
+ 'ReviewCard - Default',
1485
+ 'Full Catalog',
1486
+ ]);
1487
+ });
1488
+ it('should exclude page scenarios for unchanged pages even with dashes in names', () => {
1489
+ const screenshots = [
1490
+ {
1491
+ name: 'Drink Detail - Earl Grey',
1492
+ path: 'earl.png',
1493
+ componentName: null,
1494
+ url: '/drinks/1',
1495
+ },
1496
+ {
1497
+ name: 'ReviewCard - Default',
1498
+ path: 'review.png',
1499
+ componentName: 'ReviewCard',
1500
+ url: '/isolated-components/ReviewCard',
1501
+ },
1502
+ ];
1503
+ const status = {
1504
+ ReviewCard: { status: 'edited' },
1505
+ };
1506
+ const result = filterScenarioScreenshotsByChangeStatus(screenshots, status);
1507
+ // Drinks page has no status, so "Drink Detail" page scenarios are excluded
1508
+ expect(result.map((s) => s.name)).toEqual(['ReviewCard - Default']);
1509
+ });
1510
+ it('should use componentName for matching, not the name prefix', () => {
1511
+ const screenshots = [
1512
+ {
1513
+ name: 'Card Loading State - Spinner',
1514
+ path: 'spinner.png',
1515
+ componentName: 'LoadingCard',
1516
+ url: '/isolated-components/LoadingCard',
1517
+ },
1518
+ ];
1519
+ const status = {
1520
+ LoadingCard: { status: 'new' },
1521
+ };
1522
+ const result = filterScenarioScreenshotsByChangeStatus(screenshots, status);
1523
+ expect(result.map((s) => s.name)).toEqual([
1524
+ 'Card Loading State - Spinner',
1525
+ ]);
1526
+ });
1527
+ it('should exclude component scenario when its entity has no status', () => {
1528
+ const screenshots = [
1529
+ {
1530
+ name: 'Card Loading State - Spinner',
1531
+ path: 'spinner.png',
1532
+ componentName: 'LoadingCard',
1533
+ url: '/isolated-components/LoadingCard',
1534
+ },
1535
+ ];
1536
+ const status = {
1537
+ SomeOtherComponent: { status: 'new' },
1538
+ };
1539
+ const result = filterScenarioScreenshotsByChangeStatus(screenshots, status);
1540
+ expect(result).toEqual([]);
1541
+ });
1542
+ it('should filter per-page independently (not all-or-nothing for pages)', () => {
1543
+ // Only Drinks page changed, not Home — scenarios for each page should be filtered independently
1544
+ const screenshots = [
1545
+ {
1546
+ name: 'Full Catalog',
1547
+ path: 'catalog.png',
1548
+ componentName: null,
1549
+ url: '/',
1550
+ },
1551
+ {
1552
+ name: 'Drink Detail - Earl Grey',
1553
+ path: 'earl.png',
1554
+ componentName: null,
1555
+ url: '/drinks/1',
1556
+ },
1557
+ ];
1558
+ const status = {
1559
+ Drinks: { status: 'new' },
1560
+ };
1561
+ const result = filterScenarioScreenshotsByChangeStatus(screenshots, status);
1562
+ // Home page has no status, so "Full Catalog" is excluded
1563
+ // Drinks page has status, so "Drink Detail" is included
1564
+ expect(result.map((s) => s.name)).toEqual(['Drink Detail - Earl Grey']);
1565
+ });
1566
+ it('should fall back to name-based parsing when componentName is not present (backward compat)', () => {
1567
+ const screenshots = [
1568
+ { name: 'EventPill - Default', path: 'pill.png' },
1569
+ { name: 'Full Calendar', path: 'cal.png' },
1570
+ ];
1571
+ const status = {
1572
+ EventPill: { status: 'new' },
1573
+ Home: { status: 'edited' },
1574
+ };
1575
+ const result = filterScenarioScreenshotsByChangeStatus(screenshots, status);
1576
+ expect(result.map((s) => s.name)).toEqual([
1577
+ 'EventPill - Default',
1578
+ 'Full Calendar',
1579
+ ]);
1580
+ });
1581
+ });
1582
+ // ── scanPageFilePaths ───────────────────────────────────────────────────
1583
+ describe('scanPageFilePaths', () => {
1584
+ let tempDir;
1585
+ beforeEach(() => {
1586
+ tempDir = fsModule.mkdtempSync(pathModule.join(os.tmpdir(), 'scanpages-test-'));
1587
+ });
1588
+ afterEach(() => {
1589
+ fsModule.rmSync(tempDir, { recursive: true, force: true });
1590
+ });
1591
+ it('should find page.tsx files in nested app/ structure', () => {
1592
+ const appDir = pathModule.join(tempDir, 'app');
1593
+ fsModule.mkdirSync(appDir, { recursive: true });
1594
+ fsModule.writeFileSync(pathModule.join(appDir, 'page.tsx'), '');
1595
+ fsModule.mkdirSync(pathModule.join(appDir, 'drinks'), {
1596
+ recursive: true,
1597
+ });
1598
+ fsModule.writeFileSync(pathModule.join(appDir, 'drinks', 'page.tsx'), '');
1599
+ fsModule.mkdirSync(pathModule.join(appDir, 'settings', 'profile'), {
1600
+ recursive: true,
1601
+ });
1602
+ fsModule.writeFileSync(pathModule.join(appDir, 'settings', 'profile', 'page.tsx'), '');
1603
+ const result = scanPageFilePaths(tempDir);
1604
+ expect(result.map).toEqual({
1605
+ Home: 'app/page.tsx',
1606
+ Drinks: 'app/drinks/page.tsx',
1607
+ Settings: 'app/settings/profile/page.tsx',
1608
+ });
1609
+ });
1610
+ it('should find page.js files', () => {
1611
+ const appDir = pathModule.join(tempDir, 'app');
1612
+ fsModule.mkdirSync(appDir, { recursive: true });
1613
+ fsModule.writeFileSync(pathModule.join(appDir, 'page.js'), '');
1614
+ const result = scanPageFilePaths(tempDir);
1615
+ expect(result.map).toEqual({ Home: 'app/page.js' });
1616
+ });
1617
+ it('should skip isolated-components directories', () => {
1618
+ const appDir = pathModule.join(tempDir, 'app');
1619
+ fsModule.mkdirSync(pathModule.join(appDir, 'isolated-components', 'test'), {
1620
+ recursive: true,
1621
+ });
1622
+ fsModule.writeFileSync(pathModule.join(appDir, 'isolated-components', 'test', 'page.tsx'), '');
1623
+ const result = scanPageFilePaths(tempDir);
1624
+ expect(result.map).toEqual({});
1625
+ });
1626
+ it('should return empty map when app/ does not exist', () => {
1627
+ const result = scanPageFilePaths(tempDir);
1628
+ expect(result.map).toEqual({});
1629
+ });
1630
+ // ── Expo Router support ──────────────────────────────────────────────
1631
+ it('should find index.tsx as Home page (Expo Router)', () => {
1632
+ const appDir = pathModule.join(tempDir, 'app');
1633
+ fsModule.mkdirSync(appDir, { recursive: true });
1634
+ fsModule.writeFileSync(pathModule.join(appDir, 'index.tsx'), '');
1635
+ const result = scanPageFilePaths(tempDir);
1636
+ expect(result.map).toEqual({ Home: 'app/index.tsx' });
1637
+ });
1638
+ it('should find named route files as pages (Expo Router)', () => {
1639
+ const appDir = pathModule.join(tempDir, 'app');
1640
+ fsModule.mkdirSync(appDir, { recursive: true });
1641
+ fsModule.writeFileSync(pathModule.join(appDir, 'index.tsx'), '');
1642
+ fsModule.writeFileSync(pathModule.join(appDir, 'add-tea.tsx'), '');
1643
+ fsModule.mkdirSync(pathModule.join(appDir, 'tea'), { recursive: true });
1644
+ fsModule.writeFileSync(pathModule.join(appDir, 'tea', '[id].tsx'), '');
1645
+ const result = scanPageFilePaths(tempDir);
1646
+ expect(result.map).toEqual({
1647
+ Home: 'app/index.tsx',
1648
+ 'Add-tea': 'app/add-tea.tsx',
1649
+ Tea: 'app/tea/[id].tsx',
1650
+ });
1651
+ });
1652
+ it('should skip _layout.tsx files (Expo Router)', () => {
1653
+ const appDir = pathModule.join(tempDir, 'app');
1654
+ fsModule.mkdirSync(appDir, { recursive: true });
1655
+ fsModule.writeFileSync(pathModule.join(appDir, '_layout.tsx'), '');
1656
+ fsModule.writeFileSync(pathModule.join(appDir, 'index.tsx'), '');
1657
+ const result = scanPageFilePaths(tempDir);
1658
+ expect(result.map).toEqual({ Home: 'app/index.tsx' });
1659
+ });
1660
+ it('should handle route groups like (tabs) transparently (Expo Router)', () => {
1661
+ const appDir = pathModule.join(tempDir, 'app');
1662
+ const tabsDir = pathModule.join(appDir, '(tabs)');
1663
+ fsModule.mkdirSync(tabsDir, { recursive: true });
1664
+ fsModule.writeFileSync(pathModule.join(tabsDir, '_layout.tsx'), '');
1665
+ fsModule.writeFileSync(pathModule.join(tabsDir, 'index.tsx'), '');
1666
+ fsModule.writeFileSync(pathModule.join(tabsDir, 'settings.tsx'), '');
1667
+ const result = scanPageFilePaths(tempDir);
1668
+ expect(result.map).toEqual({
1669
+ Home: 'app/(tabs)/index.tsx',
1670
+ Settings: 'app/(tabs)/settings.tsx',
1671
+ });
1672
+ });
1673
+ it('should prefer page.tsx over index.tsx when both exist (Next.js priority)', () => {
1674
+ const appDir = pathModule.join(tempDir, 'app');
1675
+ fsModule.mkdirSync(appDir, { recursive: true });
1676
+ fsModule.writeFileSync(pathModule.join(appDir, 'page.tsx'), '');
1677
+ fsModule.writeFileSync(pathModule.join(appDir, 'index.tsx'), '');
1678
+ const result = scanPageFilePaths(tempDir);
1679
+ expect(result.map).toEqual({ Home: 'app/page.tsx' });
1680
+ });
1681
+ it('should include all page files in allFiles when multiple routes share a page name', () => {
1682
+ const appDir = pathModule.join(tempDir, 'app');
1683
+ fsModule.mkdirSync(appDir, { recursive: true });
1684
+ fsModule.writeFileSync(pathModule.join(appDir, 'page.tsx'), '');
1685
+ fsModule.mkdirSync(pathModule.join(appDir, 'feedback', '[id]', 'edit'), {
1686
+ recursive: true,
1687
+ });
1688
+ fsModule.mkdirSync(pathModule.join(appDir, 'feedback', 'new'), {
1689
+ recursive: true,
1690
+ });
1691
+ fsModule.writeFileSync(pathModule.join(appDir, 'feedback', '[id]', 'page.tsx'), '');
1692
+ fsModule.writeFileSync(pathModule.join(appDir, 'feedback', '[id]', 'edit', 'page.tsx'), '');
1693
+ fsModule.writeFileSync(pathModule.join(appDir, 'feedback', 'new', 'page.tsx'), '');
1694
+ const result = scanPageFilePaths(tempDir);
1695
+ // Map picks one canonical file per page name
1696
+ expect(result.map['Home']).toBe('app/page.tsx');
1697
+ expect(result.map['Feedback']).toBeDefined();
1698
+ // allFiles includes ALL page files, even those that collided on page name
1699
+ expect(result.allFiles.sort()).toEqual([
1700
+ 'app/feedback/[id]/edit/page.tsx',
1701
+ 'app/feedback/[id]/page.tsx',
1702
+ 'app/feedback/new/page.tsx',
1703
+ 'app/page.tsx',
1704
+ ]);
1705
+ });
1706
+ });
1707
+ // ── detectFirstFeature ─────────────────────────────────────────────────
1708
+ describe('detectFirstFeature', () => {
1709
+ it('should return true when git has 0 or 1 commits', () => {
1710
+ const tempDir = fsModule.mkdtempSync(pathModule.join(os.tmpdir(), 'firstfeat-test-'));
1711
+ try {
1712
+ // Init a git repo with no commits
1713
+ require('child_process').execSync('git init', {
1714
+ cwd: tempDir,
1715
+ stdio: 'ignore',
1716
+ });
1717
+ expect(detectFirstFeature(tempDir)).toBe(true);
1718
+ }
1719
+ finally {
1720
+ fsModule.rmSync(tempDir, { recursive: true, force: true });
1721
+ }
1722
+ });
1723
+ it('should return false when git has multiple commits', () => {
1724
+ const tempDir = fsModule.mkdtempSync(pathModule.join(os.tmpdir(), 'firstfeat-test-'));
1725
+ try {
1726
+ require('child_process').execSync('git init && git config user.email "test@test.com" && git config user.name "test" && git commit --allow-empty -m "first" && git commit --allow-empty -m "second"', { cwd: tempDir, stdio: 'ignore' });
1727
+ expect(detectFirstFeature(tempDir)).toBe(false);
1728
+ }
1729
+ finally {
1730
+ fsModule.rmSync(tempDir, { recursive: true, force: true });
1731
+ }
1732
+ });
1733
+ it('should return true when not a git repo', () => {
1734
+ const tempDir = fsModule.mkdtempSync(pathModule.join(os.tmpdir(), 'firstfeat-test-'));
1735
+ try {
1736
+ expect(detectFirstFeature(tempDir)).toBe(true);
1737
+ }
1738
+ finally {
1739
+ fsModule.rmSync(tempDir, { recursive: true, force: true });
1740
+ }
1741
+ });
1742
+ });
1743
+ // ── readFeatureStartedAt ───────────────────────────────────────────────
1744
+ describe('readFeatureStartedAt', () => {
1745
+ let tempDir;
1746
+ beforeEach(() => {
1747
+ tempDir = fsModule.mkdtempSync(pathModule.join(os.tmpdir(), 'featurets-test-'));
1748
+ fsModule.mkdirSync(pathModule.join(tempDir, '.codeyam'), {
1749
+ recursive: true,
1750
+ });
1751
+ });
1752
+ afterEach(() => {
1753
+ fsModule.rmSync(tempDir, { recursive: true, force: true });
1754
+ });
1755
+ it('should return featureStartedAt from editor-step.json', () => {
1756
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'editor-step.json'), JSON.stringify({ featureStartedAt: '2026-03-01T10:00:00.000Z' }));
1757
+ expect(readFeatureStartedAt(tempDir)).toBe('2026-03-01T10:00:00.000Z');
1758
+ });
1759
+ it('should return null when file does not exist', () => {
1760
+ expect(readFeatureStartedAt(tempDir)).toBeNull();
1761
+ });
1762
+ it('should return null when featureStartedAt is not set', () => {
1763
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'editor-step.json'), JSON.stringify({ step: 5 }));
1764
+ expect(readFeatureStartedAt(tempDir)).toBeNull();
1765
+ });
1766
+ it('should return null for invalid JSON', () => {
1767
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'editor-step.json'), 'not json');
1768
+ expect(readFeatureStartedAt(tempDir)).toBeNull();
1769
+ });
1770
+ });
1771
+ // ── readEditorStep ──────────────────────────────────────────────────────
1772
+ describe('readEditorStep', () => {
1773
+ let tempDir;
1774
+ beforeEach(() => {
1775
+ tempDir = fsModule.mkdtempSync(pathModule.join(os.tmpdir(), 'editorstep-test-'));
1776
+ fsModule.mkdirSync(pathModule.join(tempDir, '.codeyam'), {
1777
+ recursive: true,
1778
+ });
1779
+ });
1780
+ afterEach(() => {
1781
+ fsModule.rmSync(tempDir, { recursive: true, force: true });
1782
+ });
1783
+ it('should return step and label from editor-step.json', () => {
1784
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'editor-step.json'), JSON.stringify({ step: 3, label: 'Confirm', feature: 'Add login' }));
1785
+ expect(readEditorStep(tempDir)).toEqual({ step: 3, label: 'Confirm' });
1786
+ });
1787
+ it('should return null when file does not exist', () => {
1788
+ expect(readEditorStep(tempDir)).toBeNull();
1789
+ });
1790
+ it('should return null when step field is missing', () => {
1791
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'editor-step.json'), JSON.stringify({ feature: 'Add login' }));
1792
+ expect(readEditorStep(tempDir)).toBeNull();
1793
+ });
1794
+ it('should return null for invalid JSON', () => {
1795
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'editor-step.json'), 'not json');
1796
+ expect(readEditorStep(tempDir)).toBeNull();
1797
+ });
1798
+ });
1799
+ // ── readEditorSessionId ─────────────────────────────────────────────────
1800
+ describe('readEditorSessionId', () => {
1801
+ let tempDir;
1802
+ beforeEach(() => {
1803
+ tempDir = fsModule.mkdtempSync(pathModule.join(os.tmpdir(), 'sessionid-test-'));
1804
+ fsModule.mkdirSync(pathModule.join(tempDir, '.codeyam'), {
1805
+ recursive: true,
1806
+ });
1807
+ });
1808
+ afterEach(() => {
1809
+ fsModule.rmSync(tempDir, { recursive: true, force: true });
1810
+ });
1811
+ it('should return session ID from claude-session-id.txt', () => {
1812
+ const uuid = '550e8400-e29b-41d4-a716-446655440000';
1813
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'claude-session-id.txt'), uuid);
1814
+ expect(readEditorSessionId(tempDir)).toBe(uuid);
1815
+ });
1816
+ it('should trim whitespace from session ID', () => {
1817
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'claude-session-id.txt'), ' abc-123 \n');
1818
+ expect(readEditorSessionId(tempDir)).toBe('abc-123');
1819
+ });
1820
+ it('should return null when file does not exist', () => {
1821
+ expect(readEditorSessionId(tempDir)).toBeNull();
1822
+ });
1823
+ it('should return null when file is empty', () => {
1824
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'claude-session-id.txt'), '');
1825
+ expect(readEditorSessionId(tempDir)).toBeNull();
1826
+ });
1827
+ });
1828
+ });
1829
+ //# sourceMappingURL=entityChangeStatus.test.js.map