@codeyam/codeyam-cli 0.1.0-staging.d0ad4ae → 0.1.0-staging.d52b24f

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 (1249) hide show
  1. package/analyzer-template/.build-info.json +8 -8
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +27 -27
  4. package/analyzer-template/packages/ai/index.ts +21 -5
  5. package/analyzer-template/packages/ai/package.json +3 -3
  6. package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
  7. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +226 -24
  8. package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
  9. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +217 -13
  10. package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
  11. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +181 -23
  12. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
  13. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.ts +18 -0
  14. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +15 -0
  15. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +181 -1
  16. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +1215 -29
  17. package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
  18. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +265 -6
  19. package/analyzer-template/packages/ai/src/lib/completionCall.ts +247 -66
  20. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +2020 -334
  21. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +5 -1
  22. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +205 -0
  23. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +10 -2
  24. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +16 -3
  25. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +6 -4
  26. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +54 -3
  27. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +129 -20
  28. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
  29. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
  30. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +140 -14
  31. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
  32. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
  33. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +393 -90
  34. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
  35. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
  36. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +183 -0
  37. package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
  38. package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
  39. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +4 -3
  40. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +86 -149
  41. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +59 -3
  42. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1458 -65
  43. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +200 -196
  44. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +677 -0
  45. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
  46. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +2484 -0
  47. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
  48. package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +5 -5
  49. package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +328 -7
  50. package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
  51. package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +111 -87
  52. package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
  53. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +10 -7
  54. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
  55. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +28 -170
  56. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
  57. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
  58. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +110 -6
  59. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -89
  60. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
  61. package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +11 -11
  62. package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
  63. package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +824 -0
  64. package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
  65. package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
  66. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +122 -3
  67. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
  68. package/analyzer-template/packages/analyze/index.ts +2 -0
  69. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +65 -59
  70. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +132 -33
  71. package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
  72. package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
  73. package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
  74. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
  75. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
  76. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
  77. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
  78. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
  79. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
  80. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +447 -255
  81. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +39 -4
  82. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +12 -0
  83. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
  84. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -10
  85. package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +14 -14
  86. package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +4 -4
  87. package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +11 -12
  88. package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
  89. package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
  90. package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +14 -12
  91. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1352 -0
  92. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +193 -76
  93. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +203 -41
  94. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -188
  95. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +355 -23
  96. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +166 -0
  97. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +1 -0
  98. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +2 -3
  99. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +845 -72
  100. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
  101. package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
  102. package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
  103. package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
  104. package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
  105. package/analyzer-template/packages/aws/package.json +10 -10
  106. package/analyzer-template/packages/database/index.ts +1 -0
  107. package/analyzer-template/packages/database/package.json +4 -4
  108. package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
  109. package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
  110. package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
  111. package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
  112. package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
  113. package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
  114. package/analyzer-template/packages/database/src/lib/kysely/db.ts +22 -1
  115. package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
  116. package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +17 -1
  117. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +164 -0
  118. package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
  119. package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
  120. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
  121. package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
  122. package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
  123. package/analyzer-template/packages/database/src/lib/loadCommits.ts +58 -19
  124. package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -9
  125. package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
  126. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +5 -6
  127. package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
  128. package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
  129. package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
  130. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +96 -152
  131. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
  132. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
  133. package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
  134. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +29 -1
  135. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +33 -5
  136. package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
  137. package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
  138. package/analyzer-template/packages/github/dist/database/index.js +1 -0
  139. package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
  140. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
  141. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
  142. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
  143. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
  144. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
  145. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
  146. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
  147. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
  148. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
  149. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
  150. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
  151. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
  152. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +4 -0
  153. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  154. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +16 -1
  155. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  156. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -18
  157. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
  158. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
  159. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
  160. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
  161. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  162. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +17 -1
  163. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
  164. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  165. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +29 -0
  166. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
  167. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +149 -0
  168. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  169. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts +23 -0
  170. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
  171. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  172. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  173. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +6 -6
  174. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  175. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
  176. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
  177. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
  178. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
  179. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  180. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
  181. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  182. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
  183. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
  184. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
  185. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
  186. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
  187. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
  188. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  189. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +45 -14
  190. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  191. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
  192. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  193. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -10
  194. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  195. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
  196. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
  197. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
  198. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  199. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +5 -5
  200. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  201. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +1 -1
  202. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
  203. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
  204. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
  205. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
  206. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
  207. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
  208. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  209. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +76 -89
  210. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  211. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
  212. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  213. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  214. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
  215. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  216. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  217. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -1
  218. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  219. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  220. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  221. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  222. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  223. package/analyzer-template/packages/github/dist/types/index.d.ts +3 -4
  224. package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
  225. package/analyzer-template/packages/github/dist/types/index.js +0 -1
  226. package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
  227. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts +2 -0
  228. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
  229. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js +2 -0
  230. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js.map +1 -1
  231. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +71 -27
  232. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
  233. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
  234. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
  235. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +8 -0
  236. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  237. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +13 -54
  238. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  239. package/analyzer-template/packages/github/dist/types/src/types/Scenario.js +1 -21
  240. package/analyzer-template/packages/github/dist/types/src/types/Scenario.js.map +1 -1
  241. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +153 -5
  242. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  243. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  244. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  245. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts +2 -0
  246. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  247. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
  248. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  249. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
  250. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
  251. package/analyzer-template/packages/github/package.json +2 -2
  252. package/analyzer-template/packages/types/index.ts +3 -6
  253. package/analyzer-template/packages/types/src/enums/ProjectFramework.ts +2 -0
  254. package/analyzer-template/packages/types/src/types/Analysis.ts +87 -27
  255. package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
  256. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +8 -0
  257. package/analyzer-template/packages/types/src/types/Scenario.ts +13 -77
  258. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +181 -5
  259. package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
  260. package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
  261. package/analyzer-template/packages/ui-components/package.json +1 -1
  262. package/analyzer-template/packages/utils/dist/types/index.d.ts +3 -4
  263. package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
  264. package/analyzer-template/packages/utils/dist/types/index.js +0 -1
  265. package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
  266. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts +2 -0
  267. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
  268. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js +2 -0
  269. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js.map +1 -1
  270. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +71 -27
  271. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
  272. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
  273. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
  274. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +8 -0
  275. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  276. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +13 -54
  277. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  278. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js +1 -21
  279. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js.map +1 -1
  280. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +153 -5
  281. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  282. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  283. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  284. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts +2 -0
  285. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  286. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  287. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +98 -3
  288. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  289. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
  290. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  291. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
  292. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
  293. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +121 -3
  294. package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
  295. package/analyzer-template/playwright/capture.ts +20 -8
  296. package/analyzer-template/playwright/captureFromUrl.ts +89 -82
  297. package/analyzer-template/playwright/captureStatic.ts +1 -1
  298. package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
  299. package/analyzer-template/project/analyzeBaselineCommit.ts +9 -0
  300. package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
  301. package/analyzer-template/project/analyzeFileEntities.ts +4 -0
  302. package/analyzer-template/project/analyzeRegularCommit.ts +9 -0
  303. package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
  304. package/analyzer-template/project/constructMockCode.ts +593 -91
  305. package/analyzer-template/project/controller/startController.ts +16 -1
  306. package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
  307. package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
  308. package/analyzer-template/project/loadReadyToBeCaptured.ts +65 -41
  309. package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
  310. package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
  311. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +18 -7
  312. package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
  313. package/analyzer-template/project/orchestrateCapture.ts +75 -7
  314. package/analyzer-template/project/reconcileMockDataKeys.ts +220 -1
  315. package/analyzer-template/project/runAnalysis.ts +6 -0
  316. package/analyzer-template/project/start.ts +49 -12
  317. package/analyzer-template/project/startScenarioCapture.ts +9 -0
  318. package/analyzer-template/project/writeClientLogRoute.ts +125 -0
  319. package/analyzer-template/project/writeMockDataTsx.ts +312 -10
  320. package/analyzer-template/project/writeScenarioComponents.ts +314 -43
  321. package/analyzer-template/project/writeSimpleRoot.ts +21 -11
  322. package/analyzer-template/scripts/comboWorkerLoop.cjs +98 -50
  323. package/analyzer-template/tsconfig.json +14 -1
  324. package/background/src/lib/local/createLocalAnalyzer.js +1 -1
  325. package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
  326. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +7 -1
  327. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
  328. package/background/src/lib/virtualized/project/analyzeBranchCommit.js +2 -1
  329. package/background/src/lib/virtualized/project/analyzeBranchCommit.js.map +1 -1
  330. package/background/src/lib/virtualized/project/analyzeFileEntities.js +2 -1
  331. package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
  332. package/background/src/lib/virtualized/project/analyzeRegularCommit.js +7 -1
  333. package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
  334. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
  335. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
  336. package/background/src/lib/virtualized/project/constructMockCode.js +493 -52
  337. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  338. package/background/src/lib/virtualized/project/controller/startController.js +11 -1
  339. package/background/src/lib/virtualized/project/controller/startController.js.map +1 -1
  340. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
  341. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
  342. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js +6 -3
  343. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js.map +1 -1
  344. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +19 -8
  345. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
  346. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js +7 -7
  347. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js.map +1 -1
  348. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
  349. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
  350. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +7 -5
  351. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  352. package/background/src/lib/virtualized/project/orchestrateCapture.js +62 -7
  353. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  354. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +184 -1
  355. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  356. package/background/src/lib/virtualized/project/runAnalysis.js +5 -0
  357. package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
  358. package/background/src/lib/virtualized/project/start.js +44 -12
  359. package/background/src/lib/virtualized/project/start.js.map +1 -1
  360. package/background/src/lib/virtualized/project/startScenarioCapture.js +5 -0
  361. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  362. package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
  363. package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
  364. package/background/src/lib/virtualized/project/writeMockDataTsx.js +263 -6
  365. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  366. package/background/src/lib/virtualized/project/writeScenarioComponents.js +237 -41
  367. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  368. package/background/src/lib/virtualized/project/writeSimpleRoot.js +21 -11
  369. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  370. package/codeyam-cli/scripts/apply-setup.js +386 -9
  371. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  372. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
  373. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
  374. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
  375. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
  376. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
  377. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
  378. package/codeyam-cli/src/cli.js +35 -24
  379. package/codeyam-cli/src/cli.js.map +1 -1
  380. package/codeyam-cli/src/codeyam-cli.js +18 -2
  381. package/codeyam-cli/src/codeyam-cli.js.map +1 -1
  382. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +56 -0
  383. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -0
  384. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +101 -47
  385. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
  386. package/codeyam-cli/src/commands/analyze.js +21 -9
  387. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  388. package/codeyam-cli/src/commands/baseline.js +10 -11
  389. package/codeyam-cli/src/commands/baseline.js.map +1 -1
  390. package/codeyam-cli/src/commands/debug.js +37 -23
  391. package/codeyam-cli/src/commands/debug.js.map +1 -1
  392. package/codeyam-cli/src/commands/default.js +43 -35
  393. package/codeyam-cli/src/commands/default.js.map +1 -1
  394. package/codeyam-cli/src/commands/editor.js +4283 -0
  395. package/codeyam-cli/src/commands/editor.js.map +1 -0
  396. package/codeyam-cli/src/commands/init.js +147 -292
  397. package/codeyam-cli/src/commands/init.js.map +1 -1
  398. package/codeyam-cli/src/commands/memory.js +278 -0
  399. package/codeyam-cli/src/commands/memory.js.map +1 -0
  400. package/codeyam-cli/src/commands/recapture.js +31 -18
  401. package/codeyam-cli/src/commands/recapture.js.map +1 -1
  402. package/codeyam-cli/src/commands/report.js +46 -1
  403. package/codeyam-cli/src/commands/report.js.map +1 -1
  404. package/codeyam-cli/src/commands/setup-sandbox.js +2 -0
  405. package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
  406. package/codeyam-cli/src/commands/setup-simulations.js +284 -0
  407. package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
  408. package/codeyam-cli/src/commands/start.js +8 -12
  409. package/codeyam-cli/src/commands/start.js.map +1 -1
  410. package/codeyam-cli/src/commands/test-startup.js +2 -0
  411. package/codeyam-cli/src/commands/test-startup.js.map +1 -1
  412. package/codeyam-cli/src/commands/verify.js +14 -2
  413. package/codeyam-cli/src/commands/verify.js.map +1 -1
  414. package/codeyam-cli/src/data/techStacks.js +77 -0
  415. package/codeyam-cli/src/data/techStacks.js.map +1 -0
  416. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js +173 -0
  417. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js.map +1 -0
  418. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js +46 -0
  419. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js.map +1 -0
  420. package/codeyam-cli/src/utils/__tests__/devServerState.test.js +134 -0
  421. package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -0
  422. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +137 -0
  423. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -0
  424. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +987 -0
  425. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  426. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
  427. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
  428. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js +93 -0
  429. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js.map +1 -0
  430. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js +100 -0
  431. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js.map +1 -0
  432. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +304 -0
  433. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  434. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +124 -0
  435. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -0
  436. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +261 -0
  437. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
  438. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js +294 -0
  439. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js.map +1 -0
  440. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +542 -0
  441. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  442. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +594 -0
  443. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -0
  444. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +435 -0
  445. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
  446. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  447. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  448. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +217 -0
  449. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  450. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +353 -0
  451. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  452. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +153 -0
  453. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -0
  454. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js +139 -0
  455. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js.map +1 -0
  456. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +221 -0
  457. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -0
  458. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +1483 -0
  459. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  460. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +280 -0
  461. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -0
  462. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js +143 -0
  463. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js.map +1 -0
  464. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
  465. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
  466. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
  467. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
  468. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +1857 -0
  469. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -0
  470. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  471. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  472. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +107 -0
  473. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -0
  474. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +185 -0
  475. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
  476. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +129 -0
  477. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -0
  478. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
  479. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
  480. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  481. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  482. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
  483. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
  484. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +227 -0
  485. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -0
  486. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  487. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  488. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +493 -0
  489. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -0
  490. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js +81 -0
  491. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js.map +1 -0
  492. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +175 -82
  493. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  494. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js +51 -0
  495. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js.map +1 -0
  496. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +142 -0
  497. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -0
  498. package/codeyam-cli/src/utils/analysisRunner.js +32 -16
  499. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  500. package/codeyam-cli/src/utils/analyzer.js +16 -0
  501. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  502. package/codeyam-cli/src/utils/analyzerFinalization.js +100 -0
  503. package/codeyam-cli/src/utils/analyzerFinalization.js.map +1 -0
  504. package/codeyam-cli/src/utils/backgroundServer.js +202 -29
  505. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  506. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  507. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  508. package/codeyam-cli/src/utils/database.js +37 -2
  509. package/codeyam-cli/src/utils/database.js.map +1 -1
  510. package/codeyam-cli/src/utils/devModeEvents.js +40 -0
  511. package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
  512. package/codeyam-cli/src/utils/devServerState.js +71 -0
  513. package/codeyam-cli/src/utils/devServerState.js.map +1 -0
  514. package/codeyam-cli/src/utils/editorApi.js +79 -0
  515. package/codeyam-cli/src/utils/editorApi.js.map +1 -0
  516. package/codeyam-cli/src/utils/editorAudit.js +210 -0
  517. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  518. package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
  519. package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
  520. package/codeyam-cli/src/utils/editorCapture.js +102 -0
  521. package/codeyam-cli/src/utils/editorCapture.js.map +1 -0
  522. package/codeyam-cli/src/utils/editorDeleteScenario.js +67 -0
  523. package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
  524. package/codeyam-cli/src/utils/editorDevServer.js +197 -0
  525. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  526. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +44 -0
  527. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -0
  528. package/codeyam-cli/src/utils/editorEntityHelpers.js +129 -0
  529. package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
  530. package/codeyam-cli/src/utils/editorImageVerifier.js +155 -0
  531. package/codeyam-cli/src/utils/editorImageVerifier.js.map +1 -0
  532. package/codeyam-cli/src/utils/editorJournal.js +225 -0
  533. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  534. package/codeyam-cli/src/utils/editorLoaderHelpers.js +152 -0
  535. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -0
  536. package/codeyam-cli/src/utils/editorMigration.js +224 -0
  537. package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
  538. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  539. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  540. package/codeyam-cli/src/utils/editorPreloadHelpers.js +135 -0
  541. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  542. package/codeyam-cli/src/utils/editorPreview.js +137 -0
  543. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  544. package/codeyam-cli/src/utils/editorScenarioSwitch.js +112 -0
  545. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -0
  546. package/codeyam-cli/src/utils/editorScenarios.js +548 -0
  547. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  548. package/codeyam-cli/src/utils/editorSeedAdapter.js +422 -0
  549. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -0
  550. package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
  551. package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
  552. package/codeyam-cli/src/utils/entityChangeStatus.js +366 -0
  553. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
  554. package/codeyam-cli/src/utils/entityChangeStatus.server.js +196 -0
  555. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -0
  556. package/codeyam-cli/src/utils/fileMetadata.js +5 -0
  557. package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
  558. package/codeyam-cli/src/utils/fileWatcher.js +63 -9
  559. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  560. package/codeyam-cli/src/utils/generateReport.js +4 -3
  561. package/codeyam-cli/src/utils/generateReport.js.map +1 -1
  562. package/codeyam-cli/src/utils/git.js +103 -0
  563. package/codeyam-cli/src/utils/git.js.map +1 -1
  564. package/codeyam-cli/src/utils/install-skills.js +129 -39
  565. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  566. package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
  567. package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
  568. package/codeyam-cli/src/utils/labsAutoCheck.js +19 -0
  569. package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
  570. package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
  571. package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
  572. package/codeyam-cli/src/utils/parseRegisterArg.js +31 -0
  573. package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -0
  574. package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
  575. package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
  576. package/codeyam-cli/src/utils/progress.js +8 -1
  577. package/codeyam-cli/src/utils/progress.js.map +1 -1
  578. package/codeyam-cli/src/utils/project.js +15 -5
  579. package/codeyam-cli/src/utils/project.js.map +1 -1
  580. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
  581. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
  582. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +22 -0
  583. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  584. package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
  585. package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
  586. package/codeyam-cli/src/utils/queue/job.js +75 -1
  587. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  588. package/codeyam-cli/src/utils/queue/manager.js +7 -0
  589. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  590. package/codeyam-cli/src/utils/requireSimulations.js +10 -0
  591. package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
  592. package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
  593. package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
  594. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
  595. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
  596. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +229 -0
  597. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
  598. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
  599. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
  600. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
  601. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
  602. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
  603. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
  604. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
  605. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
  606. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +74 -0
  607. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
  608. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +376 -0
  609. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
  610. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +113 -0
  611. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
  612. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
  613. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
  614. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
  615. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
  616. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
  617. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
  618. package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
  619. package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
  620. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
  621. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
  622. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
  623. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
  624. package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
  625. package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
  626. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
  627. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
  628. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
  629. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
  630. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
  631. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
  632. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
  633. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
  634. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
  635. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
  636. package/codeyam-cli/src/utils/rules/index.js +7 -0
  637. package/codeyam-cli/src/utils/rules/index.js.map +1 -0
  638. package/codeyam-cli/src/utils/rules/parser.js +93 -0
  639. package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
  640. package/codeyam-cli/src/utils/rules/pathMatcher.js +49 -0
  641. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
  642. package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
  643. package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
  644. package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
  645. package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
  646. package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
  647. package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
  648. package/codeyam-cli/src/utils/rules/staleness.js +137 -0
  649. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
  650. package/codeyam-cli/src/utils/scenarioCoverage.js +74 -0
  651. package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -0
  652. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  653. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  654. package/codeyam-cli/src/utils/scenariosManifest.js +249 -0
  655. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -0
  656. package/codeyam-cli/src/utils/serverState.js +94 -12
  657. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  658. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +96 -45
  659. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  660. package/codeyam-cli/src/utils/simulationGateMiddleware.js +166 -0
  661. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
  662. package/codeyam-cli/src/utils/slugUtils.js +25 -0
  663. package/codeyam-cli/src/utils/slugUtils.js.map +1 -0
  664. package/codeyam-cli/src/utils/syncMocksMiddleware.js +7 -26
  665. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  666. package/codeyam-cli/src/utils/testRunner.js +158 -0
  667. package/codeyam-cli/src/utils/testRunner.js.map +1 -0
  668. package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
  669. package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
  670. package/codeyam-cli/src/utils/versionInfo.js +67 -15
  671. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  672. package/codeyam-cli/src/utils/webappDetection.js +35 -2
  673. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  674. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +35 -0
  675. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
  676. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +40 -0
  677. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -0
  678. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js +66 -0
  679. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
  680. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +567 -0
  681. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -0
  682. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +146 -0
  683. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -0
  684. package/codeyam-cli/src/webserver/app/lib/clientErrors.js +65 -0
  685. package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -0
  686. package/codeyam-cli/src/webserver/app/lib/database.js +63 -33
  687. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  688. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  689. package/codeyam-cli/src/webserver/app/lib/git.js +397 -0
  690. package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -0
  691. package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
  692. package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
  693. package/codeyam-cli/src/webserver/backgroundServer.js +182 -18
  694. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  695. package/codeyam-cli/src/webserver/bootstrap.js +51 -0
  696. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
  697. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CzTDWkF2.js +1 -0
  698. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-BFbq6iFk.js +11 -0
  699. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
  700. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-B6OMi58N.js +41 -0
  701. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-DuYodzo1.js +1 -0
  702. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-CXo9EeCl.js +25 -0
  703. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DYCNb2It.js +3 -0
  704. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-B0GLXMsr.js → LoadingDots-By5zI316.js} +1 -1
  705. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-xgeCVgSM.js → LogViewer-CZgY3sxX.js} +3 -3
  706. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-CnYYwRDw.js +11 -0
  707. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CDoF7ZpU.js +1 -0
  708. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-DrnfvaLL.js +10 -0
  709. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Df3UCi8k.js +34 -0
  710. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
  711. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-DRKR9T0U.js +1 -0
  712. package/codeyam-cli/src/webserver/build/client/assets/_index-ClR-g3tY.js +11 -0
  713. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-DTH6ydEA.js +27 -0
  714. package/codeyam-cli/src/webserver/build/client/assets/addon-canvas-DpzMmAy5.js +1 -0
  715. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-YJmn1quW.js +12 -0
  716. package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-74hnHF59.js +1 -0
  717. package/codeyam-cli/src/webserver/build/client/assets/addon-webgl-DI8QOUvO.js +58 -0
  718. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-B8CYhCO9.js +22 -0
  719. package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
  720. package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
  721. package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
  722. package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
  723. package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
  724. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-diff-l0sNRNKZ.js +1 -0
  725. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
  726. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
  727. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
  728. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
  729. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
  730. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
  731. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  732. package/codeyam-cli/src/webserver/build/client/assets/api.editor-project-info-l0sNRNKZ.js +1 -0
  733. package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
  734. package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
  735. package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
  736. package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
  737. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-coverage-l0sNRNKZ.js +1 -0
  738. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
  739. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
  740. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
  741. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
  742. package/codeyam-cli/src/webserver/build/client/assets/api.editor-session-l0sNRNKZ.js +1 -0
  743. package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
  744. package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
  745. package/codeyam-cli/src/webserver/build/client/assets/api.health-l0sNRNKZ.js +1 -0
  746. package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-l0sNRNKZ.js +1 -0
  747. package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
  748. package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
  749. package/codeyam-cli/src/webserver/build/client/assets/api.rule-path-l0sNRNKZ.js +1 -0
  750. package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
  751. package/codeyam-cli/src/webserver/build/client/assets/book-open-CLaoh4ac.js +6 -0
  752. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-Cx24_aWc.js → chevron-down-BZ2DZxbW.js} +2 -2
  753. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-BBXArFPl.js +43 -0
  754. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BOARzkeR.js → circle-check-CT4unAk-.js} +2 -2
  755. package/codeyam-cli/src/webserver/build/client/assets/copy-zK0B6Nu-.js +11 -0
  756. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-DJB0YQJL.js +41 -0
  757. package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-C1gnJVOL.svg → cy-logo-cli-CCKUIm0S.svg} +2 -2
  758. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +1 -0
  759. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CkXFP_i-.js +1 -0
  760. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-DPw7NZHc.js +1 -0
  761. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-B2KVBVj4.js +58 -0
  762. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-DBa7T2FK.js +41 -0
  763. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-D0-YwkBh.js → entity._sha._-BqAN7hyG.js} +13 -13
  764. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-BOi8kpwd.js +6 -0
  765. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-Dg1NhIms.js +6 -0
  766. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CJX6kkkV.js +6 -0
  767. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-C1H_a_Y3.js → entity._sha_.edit._scenarioId-BhVjZhKg.js} +2 -2
  768. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CS2cb_eZ.js → entry.client-_gzKltPN.js} +6 -6
  769. package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
  770. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
  771. package/codeyam-cli/src/webserver/build/client/assets/files-CV_17tZS.js +1 -0
  772. package/codeyam-cli/src/webserver/build/client/assets/git-D-YXmMbR.js +1 -0
  773. package/codeyam-cli/src/webserver/build/client/assets/globals-CGrDAxj0.css +1 -0
  774. package/codeyam-cli/src/webserver/build/client/assets/index-Blo6EK8G.js +15 -0
  775. package/codeyam-cli/src/webserver/build/client/assets/{index-B1h680n5.js → index-BsX0F-9C.js} +1 -1
  776. package/codeyam-cli/src/webserver/build/client/assets/{index-lzqtyFU8.js → index-CCrgCshv.js} +1 -1
  777. package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
  778. package/codeyam-cli/src/webserver/build/client/assets/labs-Byazq8Pv.js +1 -0
  779. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-B7B9V-bu.js → loader-circle-DVQ0oHR7.js} +2 -2
  780. package/codeyam-cli/src/webserver/build/client/assets/manifest-a6273a24.js +1 -0
  781. package/codeyam-cli/src/webserver/build/client/assets/memory-b-VmA2Vj.js +101 -0
  782. package/codeyam-cli/src/webserver/build/client/assets/pause-DGcndCAa.js +11 -0
  783. package/codeyam-cli/src/webserver/build/client/assets/root-D5Zi3U2Z.js +67 -0
  784. package/codeyam-cli/src/webserver/build/client/assets/{search-CxXUmBSd.js → search-C0Uw0bcK.js} +2 -2
  785. package/codeyam-cli/src/webserver/build/client/assets/settings-OoNgHIfW.js +1 -0
  786. package/codeyam-cli/src/webserver/build/client/assets/simulations-Bcemfu8a.js +1 -0
  787. package/codeyam-cli/src/webserver/build/client/assets/terminal-BgMmG7R9.js +11 -0
  788. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-B6LgvRJg.js → triangle-alert-Cs87hJYK.js} +2 -2
  789. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BR3Rs7JY.js +1 -0
  790. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-BxxP_XF9.js +2 -0
  791. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-BermyNU5.js +1 -0
  792. package/codeyam-cli/src/webserver/build/client/assets/useToast-a_QN_W9_.js +1 -0
  793. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  794. package/codeyam-cli/src/webserver/build/client/sound-test.html +98 -0
  795. package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-H_bGKza6.js +13 -0
  796. package/codeyam-cli/src/webserver/build/server/assets/index-BjsaHnnW.js +1 -0
  797. package/codeyam-cli/src/webserver/build/server/assets/init-CmahXA_a.js +10 -0
  798. package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
  799. package/codeyam-cli/src/webserver/build/server/assets/server-build-BYvtz6_N.js +501 -0
  800. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  801. package/codeyam-cli/src/webserver/build-info.json +5 -5
  802. package/codeyam-cli/src/webserver/devServer.js +39 -5
  803. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  804. package/codeyam-cli/src/webserver/editorProxy.js +901 -0
  805. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
  806. package/codeyam-cli/src/webserver/idleDetector.js +73 -0
  807. package/codeyam-cli/src/webserver/idleDetector.js.map +1 -0
  808. package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
  809. package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
  810. package/codeyam-cli/src/webserver/public/sound-test.html +98 -0
  811. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +414 -0
  812. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +230 -0
  813. package/codeyam-cli/src/webserver/server.js +344 -26
  814. package/codeyam-cli/src/webserver/server.js.map +1 -1
  815. package/codeyam-cli/src/webserver/terminalServer.js +831 -0
  816. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
  817. package/codeyam-cli/templates/chrome-extension-react/EXTENSION_SETUP.md +75 -0
  818. package/codeyam-cli/templates/chrome-extension-react/README.md +46 -0
  819. package/codeyam-cli/templates/chrome-extension-react/gitignore +15 -0
  820. package/codeyam-cli/templates/chrome-extension-react/index.html +12 -0
  821. package/codeyam-cli/templates/chrome-extension-react/package.json +27 -0
  822. package/codeyam-cli/templates/chrome-extension-react/popup.html +12 -0
  823. package/codeyam-cli/templates/chrome-extension-react/public/manifest.json +15 -0
  824. package/codeyam-cli/templates/chrome-extension-react/src/background/service-worker.ts +7 -0
  825. package/codeyam-cli/templates/chrome-extension-react/src/globals.css +6 -0
  826. package/codeyam-cli/templates/chrome-extension-react/src/lib/storage.ts +37 -0
  827. package/codeyam-cli/templates/chrome-extension-react/src/popup/App.tsx +12 -0
  828. package/codeyam-cli/templates/chrome-extension-react/src/popup/main.tsx +10 -0
  829. package/codeyam-cli/templates/chrome-extension-react/tsconfig.json +24 -0
  830. package/codeyam-cli/templates/chrome-extension-react/vite.config.ts +41 -0
  831. package/codeyam-cli/templates/codeyam-editor-claude.md +147 -0
  832. package/codeyam-cli/templates/codeyam-memory-hook.sh +199 -0
  833. package/codeyam-cli/templates/commands/codeyam-diagnose.md +481 -0
  834. package/codeyam-cli/templates/editor-step-hook.py +321 -0
  835. package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +89 -0
  836. package/codeyam-cli/templates/expo-react-native/README.md +41 -0
  837. package/codeyam-cli/templates/expo-react-native/app/(tabs)/_layout.tsx +33 -0
  838. package/codeyam-cli/templates/expo-react-native/app/(tabs)/index.tsx +12 -0
  839. package/codeyam-cli/templates/expo-react-native/app/(tabs)/settings.tsx +12 -0
  840. package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +12 -0
  841. package/codeyam-cli/templates/expo-react-native/app.json +18 -0
  842. package/codeyam-cli/templates/expo-react-native/babel.config.js +9 -0
  843. package/codeyam-cli/templates/expo-react-native/gitignore +12 -0
  844. package/codeyam-cli/templates/expo-react-native/global.css +3 -0
  845. package/codeyam-cli/templates/expo-react-native/lib/storage.ts +32 -0
  846. package/codeyam-cli/templates/expo-react-native/metro.config.js +6 -0
  847. package/codeyam-cli/templates/expo-react-native/nativewind-env.d.ts +1 -0
  848. package/codeyam-cli/templates/expo-react-native/package.json +38 -0
  849. package/codeyam-cli/templates/expo-react-native/tailwind.config.js +10 -0
  850. package/codeyam-cli/templates/expo-react-native/tsconfig.json +10 -0
  851. package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
  852. package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
  853. package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
  854. package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
  855. package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
  856. package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
  857. package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
  858. package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_PATTERNS.md +308 -0
  859. package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_UPGRADE.md +304 -0
  860. package/codeyam-cli/templates/nextjs-prisma-sqlite/DATABASE.md +126 -0
  861. package/codeyam-cli/templates/nextjs-prisma-sqlite/FEATURE_PATTERNS.md +37 -0
  862. package/codeyam-cli/templates/nextjs-prisma-sqlite/README.md +53 -0
  863. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
  864. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/codeyam-isolate/layout.tsx +12 -0
  865. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
  866. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
  867. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +24 -0
  868. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
  869. package/codeyam-cli/templates/nextjs-prisma-sqlite/env +4 -0
  870. package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
  871. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +64 -0
  872. package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
  873. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +39 -0
  874. package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
  875. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
  876. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +40 -0
  877. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
  878. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +127 -0
  879. package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
  880. package/codeyam-cli/templates/nextjs-prisma-sqlite/vitest.config.ts +13 -0
  881. package/codeyam-cli/templates/nextjs-prisma-supabase/README.md +52 -0
  882. package/codeyam-cli/templates/nextjs-prisma-supabase/SUPABASE_SETUP.md +104 -0
  883. package/codeyam-cli/templates/nextjs-prisma-supabase/app/api/todos/route.ts +17 -0
  884. package/codeyam-cli/templates/nextjs-prisma-supabase/app/globals.css +26 -0
  885. package/codeyam-cli/templates/nextjs-prisma-supabase/app/layout.tsx +34 -0
  886. package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/prisma.ts +20 -0
  887. package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/supabase.ts +12 -0
  888. package/codeyam-cli/templates/nextjs-prisma-supabase/app/page.tsx +10 -0
  889. package/codeyam-cli/templates/nextjs-prisma-supabase/env +9 -0
  890. package/codeyam-cli/templates/nextjs-prisma-supabase/eslint.config.mjs +11 -0
  891. package/codeyam-cli/templates/nextjs-prisma-supabase/gitignore +40 -0
  892. package/codeyam-cli/templates/nextjs-prisma-supabase/next.config.ts +11 -0
  893. package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +37 -0
  894. package/codeyam-cli/templates/nextjs-prisma-supabase/postcss.config.mjs +7 -0
  895. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/schema.prisma +27 -0
  896. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/seed.ts +39 -0
  897. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma.config.ts +12 -0
  898. package/codeyam-cli/templates/nextjs-prisma-supabase/tsconfig.json +34 -0
  899. package/codeyam-cli/templates/prompts/conversation-guidance.txt +44 -0
  900. package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
  901. package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
  902. package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
  903. package/codeyam-cli/templates/rule-notification-hook.py +83 -0
  904. package/codeyam-cli/templates/rule-reflection-hook.py +647 -0
  905. package/codeyam-cli/templates/rules-instructions.md +78 -0
  906. package/codeyam-cli/templates/seed-adapters/supabase.ts +282 -0
  907. package/codeyam-cli/templates/{codeyam-debug-skill.md → skills/codeyam-debug/SKILL.md} +48 -4
  908. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
  909. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +211 -0
  910. package/codeyam-cli/templates/skills/codeyam-memory/SKILL.md +611 -0
  911. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  912. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
  913. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
  914. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  915. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
  916. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
  917. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  918. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
  919. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
  920. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
  921. package/codeyam-cli/templates/skills/codeyam-new-rule/SKILL.md +11 -0
  922. package/codeyam-cli/templates/{codeyam-setup-skill.md → skills/codeyam-setup/SKILL.md} +13 -1
  923. package/codeyam-cli/templates/{codeyam-sim-skill.md → skills/codeyam-sim/SKILL.md} +1 -1
  924. package/codeyam-cli/templates/{codeyam-test-skill.md → skills/codeyam-test/SKILL.md} +1 -1
  925. package/codeyam-cli/templates/{codeyam-verify-skill.md → skills/codeyam-verify/SKILL.md} +1 -1
  926. package/package.json +32 -22
  927. package/packages/ai/index.js +8 -6
  928. package/packages/ai/index.js.map +1 -1
  929. package/packages/ai/src/lib/analyzeScope.js +179 -13
  930. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  931. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
  932. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
  933. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +160 -13
  934. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  935. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js +435 -0
  936. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js.map +1 -0
  937. package/packages/ai/src/lib/astScopes/methodSemantics.js +138 -23
  938. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  939. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
  940. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
  941. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js +8 -0
  942. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js.map +1 -1
  943. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +7 -0
  944. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
  945. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +138 -1
  946. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
  947. package/packages/ai/src/lib/astScopes/processExpression.js +931 -29
  948. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  949. package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
  950. package/packages/ai/src/lib/astScopes/sharedPatterns.js.map +1 -1
  951. package/packages/ai/src/lib/completionCall.js +188 -38
  952. package/packages/ai/src/lib/completionCall.js.map +1 -1
  953. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1600 -189
  954. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  955. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +5 -1
  956. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  957. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +179 -0
  958. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
  959. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +7 -1
  960. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  961. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
  962. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
  963. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
  964. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
  965. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +52 -3
  966. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  967. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +111 -14
  968. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  969. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
  970. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
  971. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
  972. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
  973. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +122 -12
  974. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  975. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
  976. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
  977. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
  978. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
  979. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +333 -81
  980. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  981. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
  982. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
  983. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
  984. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
  985. package/packages/ai/src/lib/dataStructureChunking.js +130 -0
  986. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
  987. package/packages/ai/src/lib/e2eDataTracking.js +241 -0
  988. package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
  989. package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
  990. package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
  991. package/packages/ai/src/lib/generateChangesEntityScenarioData.js +4 -3
  992. package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
  993. package/packages/ai/src/lib/generateChangesEntityScenarios.js +78 -120
  994. package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
  995. package/packages/ai/src/lib/generateEntityDataStructure.js +47 -2
  996. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  997. package/packages/ai/src/lib/generateEntityScenarioData.js +1153 -60
  998. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  999. package/packages/ai/src/lib/generateEntityScenarios.js +177 -163
  1000. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  1001. package/packages/ai/src/lib/generateExecutionFlows.js +484 -0
  1002. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -0
  1003. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js +380 -0
  1004. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js.map +1 -0
  1005. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +1807 -0
  1006. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
  1007. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
  1008. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
  1009. package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -2
  1010. package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
  1011. package/packages/ai/src/lib/isolateScopes.js +270 -7
  1012. package/packages/ai/src/lib/isolateScopes.js.map +1 -1
  1013. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
  1014. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
  1015. package/packages/ai/src/lib/mergeStatements.js +88 -46
  1016. package/packages/ai/src/lib/mergeStatements.js.map +1 -1
  1017. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
  1018. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
  1019. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +10 -4
  1020. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  1021. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
  1022. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
  1023. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -119
  1024. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
  1025. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
  1026. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
  1027. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +83 -6
  1028. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
  1029. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -70
  1030. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
  1031. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js +45 -0
  1032. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js.map +1 -0
  1033. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +9 -9
  1034. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
  1035. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
  1036. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
  1037. package/packages/ai/src/lib/resolvePathToControllable.js +677 -0
  1038. package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -0
  1039. package/packages/ai/src/lib/splitOutsideParentheses.js +3 -1
  1040. package/packages/ai/src/lib/splitOutsideParentheses.js.map +1 -1
  1041. package/packages/ai/src/lib/worker/SerializableDataStructure.js +29 -0
  1042. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  1043. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
  1044. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  1045. package/packages/analyze/index.js +1 -0
  1046. package/packages/analyze/index.js.map +1 -1
  1047. package/packages/analyze/src/lib/FileAnalyzer.js +60 -36
  1048. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  1049. package/packages/analyze/src/lib/ProjectAnalyzer.js +109 -30
  1050. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  1051. package/packages/analyze/src/lib/analysisContext.js +30 -5
  1052. package/packages/analyze/src/lib/analysisContext.js.map +1 -1
  1053. package/packages/analyze/src/lib/asts/index.js +4 -2
  1054. package/packages/analyze/src/lib/asts/index.js.map +1 -1
  1055. package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
  1056. package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
  1057. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
  1058. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
  1059. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
  1060. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
  1061. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
  1062. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
  1063. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
  1064. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
  1065. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
  1066. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
  1067. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
  1068. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
  1069. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +189 -41
  1070. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  1071. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +28 -4
  1072. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  1073. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +9 -0
  1074. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  1075. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
  1076. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  1077. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -10
  1078. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  1079. package/packages/analyze/src/lib/files/analyzeChange.js +10 -10
  1080. package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
  1081. package/packages/analyze/src/lib/files/analyzeEntity.js +4 -4
  1082. package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
  1083. package/packages/analyze/src/lib/files/analyzeInitial.js +9 -10
  1084. package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
  1085. package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
  1086. package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
  1087. package/packages/analyze/src/lib/files/enums/steps.js +1 -1
  1088. package/packages/analyze/src/lib/files/enums/steps.js.map +1 -1
  1089. package/packages/analyze/src/lib/files/getImportedExports.js +11 -7
  1090. package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
  1091. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +907 -0
  1092. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
  1093. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +164 -68
  1094. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
  1095. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +178 -31
  1096. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  1097. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +29 -129
  1098. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
  1099. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +252 -21
  1100. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  1101. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +104 -0
  1102. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
  1103. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +1 -0
  1104. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
  1105. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +2 -3
  1106. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
  1107. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +686 -55
  1108. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  1109. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
  1110. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
  1111. package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
  1112. package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
  1113. package/packages/analyze/src/lib/index.js +1 -0
  1114. package/packages/analyze/src/lib/index.js.map +1 -1
  1115. package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
  1116. package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
  1117. package/packages/database/index.js +1 -0
  1118. package/packages/database/index.js.map +1 -1
  1119. package/packages/database/src/lib/analysisBranchToDb.js +1 -1
  1120. package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
  1121. package/packages/database/src/lib/analysisToDb.js +1 -1
  1122. package/packages/database/src/lib/analysisToDb.js.map +1 -1
  1123. package/packages/database/src/lib/branchToDb.js +1 -1
  1124. package/packages/database/src/lib/branchToDb.js.map +1 -1
  1125. package/packages/database/src/lib/commitBranchToDb.js +1 -1
  1126. package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
  1127. package/packages/database/src/lib/commitToDb.js +1 -1
  1128. package/packages/database/src/lib/commitToDb.js.map +1 -1
  1129. package/packages/database/src/lib/fileToDb.js +1 -1
  1130. package/packages/database/src/lib/fileToDb.js.map +1 -1
  1131. package/packages/database/src/lib/kysely/db.js +16 -1
  1132. package/packages/database/src/lib/kysely/db.js.map +1 -1
  1133. package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
  1134. package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  1135. package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  1136. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +149 -0
  1137. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  1138. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  1139. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  1140. package/packages/database/src/lib/loadAnalyses.js +45 -2
  1141. package/packages/database/src/lib/loadAnalyses.js.map +1 -1
  1142. package/packages/database/src/lib/loadAnalysis.js +8 -0
  1143. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  1144. package/packages/database/src/lib/loadBranch.js +11 -1
  1145. package/packages/database/src/lib/loadBranch.js.map +1 -1
  1146. package/packages/database/src/lib/loadCommit.js +7 -0
  1147. package/packages/database/src/lib/loadCommit.js.map +1 -1
  1148. package/packages/database/src/lib/loadCommits.js +45 -14
  1149. package/packages/database/src/lib/loadCommits.js.map +1 -1
  1150. package/packages/database/src/lib/loadEntities.js +23 -10
  1151. package/packages/database/src/lib/loadEntities.js.map +1 -1
  1152. package/packages/database/src/lib/loadEntityBranches.js +9 -0
  1153. package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
  1154. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +5 -5
  1155. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  1156. package/packages/database/src/lib/projectToDb.js +1 -1
  1157. package/packages/database/src/lib/projectToDb.js.map +1 -1
  1158. package/packages/database/src/lib/saveFiles.js +1 -1
  1159. package/packages/database/src/lib/saveFiles.js.map +1 -1
  1160. package/packages/database/src/lib/scenarioToDb.js +1 -1
  1161. package/packages/database/src/lib/scenarioToDb.js.map +1 -1
  1162. package/packages/database/src/lib/updateCommitMetadata.js +76 -89
  1163. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  1164. package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  1165. package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  1166. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  1167. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  1168. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  1169. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  1170. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  1171. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  1172. package/packages/types/index.js +0 -1
  1173. package/packages/types/index.js.map +1 -1
  1174. package/packages/types/src/enums/ProjectFramework.js +2 -0
  1175. package/packages/types/src/enums/ProjectFramework.js.map +1 -1
  1176. package/packages/types/src/types/Scenario.js +1 -21
  1177. package/packages/types/src/types/Scenario.js.map +1 -1
  1178. package/packages/utils/src/lib/fs/rsyncCopy.js +98 -3
  1179. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  1180. package/packages/utils/src/lib/safeFileName.js +29 -3
  1181. package/packages/utils/src/lib/safeFileName.js.map +1 -1
  1182. package/scripts/npm-post-install.cjs +34 -0
  1183. package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -109
  1184. package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -584
  1185. package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -341
  1186. package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -495
  1187. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
  1188. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -120
  1189. package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -118
  1190. package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
  1191. package/codeyam-cli/src/commands/list.js +0 -31
  1192. package/codeyam-cli/src/commands/list.js.map +0 -1
  1193. package/codeyam-cli/src/commands/webapp-info.js +0 -146
  1194. package/codeyam-cli/src/commands/webapp-info.js.map +0 -1
  1195. package/codeyam-cli/src/utils/universal-mocks.js +0 -152
  1196. package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
  1197. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-Cmysw5OP.js +0 -1
  1198. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-DLqD3qNt.js +0 -1
  1199. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CAneekK2.js +0 -41
  1200. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-Cu16OUmx.js +0 -25
  1201. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CVtiBnY5.js +0 -3
  1202. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DcAUIpD_.js +0 -11
  1203. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DuDvi0jm.js +0 -1
  1204. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-BMKg0SAF.js +0 -15
  1205. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-DyFZkK0l.js +0 -1
  1206. package/codeyam-cli/src/webserver/build/client/assets/_index-DSmTpjmK.js +0 -11
  1207. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BF_aK4y6.js +0 -32
  1208. package/codeyam-cli/src/webserver/build/client/assets/chunk-EPOLDU6W-CXRTFQ3F.js +0 -51
  1209. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-BdhJEx6B.js +0 -21
  1210. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-CKnwPCDr.js +0 -1
  1211. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-RJCf3Tvw.js +0 -1
  1212. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-EylcgScH.js +0 -1
  1213. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DMe7kvgo.js +0 -1
  1214. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-DMJ7zii9.js +0 -1
  1215. package/codeyam-cli/src/webserver/build/client/assets/files-BW7Cyeyi.js +0 -1
  1216. package/codeyam-cli/src/webserver/build/client/assets/git-CZu4fif0.js +0 -15
  1217. package/codeyam-cli/src/webserver/build/client/assets/globals-wHVy_II5.css +0 -1
  1218. package/codeyam-cli/src/webserver/build/client/assets/keyAttributeCoverage-CTlFMihX.js +0 -1
  1219. package/codeyam-cli/src/webserver/build/client/assets/manifest-2d191949.js +0 -1
  1220. package/codeyam-cli/src/webserver/build/client/assets/root-FHgpM6gc.js +0 -56
  1221. package/codeyam-cli/src/webserver/build/client/assets/settings-6D8k8Jp5.js +0 -1
  1222. package/codeyam-cli/src/webserver/build/client/assets/simulations-CDJZnWhN.js +0 -1
  1223. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-Dv18q8LD.js +0 -1
  1224. package/codeyam-cli/src/webserver/build/client/assets/useInteractiveMode-0ToGk4K3.js +0 -1
  1225. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-aSv48UbS.js +0 -2
  1226. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-1BX144Eg.js +0 -1
  1227. package/codeyam-cli/src/webserver/build/client/assets/useToast-mBRpZPiu.js +0 -1
  1228. package/codeyam-cli/src/webserver/build/server/assets/index-pU0o5t1o.js +0 -1
  1229. package/codeyam-cli/src/webserver/build/server/assets/server-build-YzfkRwdn.js +0 -178
  1230. package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
  1231. package/codeyam-cli/templates/debug-codeyam.md +0 -625
  1232. package/packages/ai/src/lib/findMatchingAttribute.js +0 -81
  1233. package/packages/ai/src/lib/findMatchingAttribute.js.map +0 -1
  1234. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +0 -425
  1235. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
  1236. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -267
  1237. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
  1238. package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -408
  1239. package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +0 -1
  1240. package/packages/ai/src/lib/isFrontend.js +0 -5
  1241. package/packages/ai/src/lib/isFrontend.js.map +0 -1
  1242. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js +0 -40
  1243. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js.map +0 -1
  1244. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +0 -77
  1245. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
  1246. package/scripts/finalize-analyzer.cjs +0 -81
  1247. /package/codeyam-cli/src/webserver/build/client/assets/{api.link-scenario-value-l0sNRNKZ.js → api.agent-transcripts-l0sNRNKZ.js} +0 -0
  1248. /package/codeyam-cli/src/webserver/build/client/assets/{api.update-key-attributes-l0sNRNKZ.js → api.dev-mode-events-l0sNRNKZ.js} +0 -0
  1249. /package/codeyam-cli/src/webserver/build/client/assets/{api.update-valid-values-l0sNRNKZ.js → api.editor-audit-l0sNRNKZ.js} +0 -0
@@ -0,0 +1,58 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Blo6EK8G.js","assets/jsx-runtime-D_zvdyIk.js","assets/chunk-JZWAC4HX-BBXArFPl.js"])))=>i.map(i=>d[i]);
2
+ var ds=Object.defineProperty;var ms=(t,s,a)=>s in t?ds(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a;var jt=(t,s,a)=>ms(t,typeof s!="symbol"?s+"":s,a);import{r as i,w as xs,u as ps,b as hs,a as us,c as fs,O as gs}from"./chunk-JZWAC4HX-BBXArFPl.js";import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{u as js,C as bs}from"./useCustomSizes-BR3Rs7JY.js";import{g as ys,s as vs,r as qe,b as Ye,c as Ns,l as ws,d as Ss,e as ks,f as Cs,a as Ps,T as Es,D as Ms}from"./editorPreview-DBa7T2FK.js";import{C as pe}from"./CopyButton-CzTDWkF2.js";import{_ as Xe}from"./preload-helper-ckwbz45p.js";import{c as Is}from"./cy-logo-cli-DcX-ZS3p.js";import{u as Ts,S as bt}from"./Spinner-Df3UCi8k.js";import"./copy-zK0B6Nu-.js";import"./createLucideIcon-DJB0YQJL.js";import"./useLastLogLine-BxxP_XF9.js";function ke(t){var l;if(!t.startsWith("app/")&&!t.startsWith("("))return"/";const a=t.replace(/^app\//,"").split("/"),n=a.pop(),c=((l=n.match(/\.(tsx?|jsx?|js)$/))==null?void 0:l[0])||"",r=n.slice(0,-c.length);let o;return r==="page"||r==="index"?o=a:o=[...a,r],o=o.filter(m=>!m.startsWith("(")),o.length===0?"/":"/"+o.join("/")}function Ce(t){return t==="/"?"Home":t.replace(/^\//,"").split("/").map(a=>a.startsWith("[")?a:a.charAt(0).toUpperCase()+a.slice(1)).join(" / ")}function $e(t){if(!t||t==="/")return"Home";const s=t.split("?")[0].replace(/^\//,"");if(!s)return"Home";const a=s.split("/")[0].replace(/\.[^.]+$/,"");return a.charAt(0).toUpperCase()+a.slice(1)}function $t(t){return t?t.includes("/isolated-components"):!1}function Rs(t,s){return!s||Object.keys(s).length===0?t:t.filter(a=>s[a.name])}const Re=[{name:"Desktop",width:1440,height:900},{name:"Laptop",width:1024,height:768},{name:"Tablet",width:768,height:1024},{name:"Mobile",width:375,height:667}];function $s(t){if(!t)return Re;const s=Object.entries(t).map(([n,c])=>({name:n,width:c.width,height:c.height})),a=new Set(s.map(n=>n.name));return[...s,...Re.filter(n=>!a.has(n.name))]}function As({featureName:t,editorStep:s,editorStepLabel:a,onContinue:n}){const c=i.useCallback(r=>{r.key==="Enter"&&(r.preventDefault(),n())},[n]);return i.useEffect(()=>(window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)),[c]),e.jsx("div",{className:"flex items-center justify-center h-full bg-[#1e1e1e] text-[#d4d4d4]",children:e.jsxs("div",{className:"max-w-md w-full mx-4 p-6 bg-[#252526] border border-[#3d3d3d] rounded-lg",children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-white",children:"Resume Previous Session?"}),e.jsx("p",{className:"text-sm text-[#999] mb-4",children:"An editor session is still in progress:"}),e.jsxs("div",{className:"bg-[#1e1e1e] rounded p-3 mb-5 text-sm",children:[t&&e.jsxs("div",{className:"mb-1",children:[e.jsx("span",{className:"text-[#999]",children:"Feature:"})," ",e.jsx("span",{className:"text-white",children:t})]}),s!=null&&a&&e.jsxs("div",{children:[e.jsx("span",{className:"text-[#999]",children:"Step:"})," ",e.jsxs("span",{className:"text-white",children:[s," (",a,")"]})]})]}),e.jsx("button",{onClick:n,className:"w-full px-4 py-2 text-sm rounded transition-colors cursor-pointer bg-[#005c75] text-white font-medium hover:bg-[#004d63] ring-2 ring-white/50",children:"Continue Session"})]})})}function Qe(t){const[s,a]=i.useState(null),[n,c]=i.useState(!1),r=i.useCallback(()=>{t&&(c(!0),fetch(`/api/editor-test-results?testFile=${encodeURIComponent(t)}`).then(o=>o.json()).then(o=>{a(o),c(!1)}).catch(()=>{a({testFilePath:t,status:"error",testCases:[],errorMessage:"Failed to fetch test results"}),c(!1)}))},[t]);return i.useEffect(()=>{t&&r()},[t,r]),{results:s,isRunning:n,runTests:r}}function Ae({scenarioId:t,updatedAt:s,alt:a,className:n="",imgClassName:c=""}){const[r,o]=i.useState(!1),l=`/api/editor-scenario-image/${t}.png${s?`?v=${encodeURIComponent(s)}`:""}`;return i.useEffect(()=>{o(!1)},[t]),r?e.jsx("div",{className:`flex items-center justify-center ${n}`,children:e.jsx("span",{className:"text-[8px] text-gray-500",children:"No img"})}):e.jsx("div",{className:n,children:e.jsx("img",{src:l,alt:a,className:c,loading:"lazy",onError:()=>o(!0)})})}function we({scenarioId:t,updatedAt:s,hasScreenshot:a,imgSrc:n,name:c,isActive:r,onSelect:o}){const l=t&&a,m=!t&&n;return e.jsxs("button",{onClick:o,className:"flex flex-col items-center gap-1 cursor-pointer group",title:c,children:[e.jsx("div",{className:`w-32 h-32 rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${r?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:l?e.jsx(Ae,{scenarioId:t,updatedAt:s,alt:c,className:"w-full h-full",imgClassName:"w-full h-full object-contain"}):m?e.jsx("img",{src:n,alt:c,className:"w-full h-full object-contain",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-[#1a1a1a] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-gray-600",children:"No img"})})}),e.jsx("span",{className:`text-[10px] leading-tight text-center truncate w-32 ${r?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:c})]})}function Ke({testFile:t,entityName:s}){const{results:a,isRunning:n,runTests:c}=Qe(t);if(n&&!a)return e.jsxs("div",{className:"px-2 pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-400",children:"Running tests..."})]});if(!a)return null;if(a.status==="error")return e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:a.errorMessage})});const r=s?a.testCases.filter(m=>m.fullName.startsWith(s)):a.testCases,o=r.length>0?r:a.testCases;if(o.length===0)return null;const l=s?`${s} > `:"";return e.jsxs("div",{className:"px-2 pt-1 space-y-0.5",children:[o.map(m=>{var y;const v=l&&m.fullName.startsWith(l)?m.fullName.slice(l.length):m.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[m.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):m.status==="failed"?e.jsx("span",{className:"text-red-400 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-500 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${m.status==="passed"?"text-green-400":m.status==="failed"?"text-red-400":"text-gray-500"}`,children:v})]}),m.status==="failed"&&((y=m.failureMessages)==null?void 0:y.map((S,g)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-300/70 truncate max-w-full",title:S,children:S.split(`
3
+ `)[0]},g)))]},m.fullName)}),e.jsx("button",{onClick:c,disabled:n,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#00c4ee] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:n?"Running...":"Re-run"})]})}function oe({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 px-2 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-500 hover:text-gray-300 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(pe,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function _s({scenarios:t,projectRoot:s,activeScenarioId:a,onScenarioSelect:n,zoomComponent:c,focusedEntity:r,onZoomChange:o,analyzedEntities:l=[],glossaryFunctions:m=[],activeAnalyzedScenarioId:v,onAnalyzedScenarioSelect:y,entityImports:S,pageFilePaths:g={}}){const{pageGroups:I,componentGroups:f}=i.useMemo(()=>{var h;const p=new Map,x=new Map;for(const w of t)if(w.componentName){const k=x.get(w.componentName)||[];k.push(w),x.set(w.componentName,k)}else if($t(w.url)){const k=(h=w.url)==null?void 0:h.match(/[?&]c=([^&]+)/),T=k?decodeURIComponent(k[1]):"Isolated",A=x.get(T)||[];A.push(w),x.set(T,A)}else{const k=w.pageFilePath?Ce(ke(w.pageFilePath)):$e(w.url),T=p.get(k)||[];T.push(w),p.set(k,T)}const b=new Map([...x.entries()].sort(([w],[k])=>w.localeCompare(k)));return{pageGroups:p,componentGroups:b}},[t]),B=i.useMemo(()=>{const p=new Set((l||[]).filter(b=>b.entityType==="visual").map(b=>b.name)),x=new Map;for(const[b,h]of f)p.has(b)||x.set(b,h);return x},[f,l]),{visualEntities:O,libraryEntities:L}=i.useMemo(()=>{const p=l.filter(b=>b.entityType==="visual").sort((b,h)=>b.name.localeCompare(h.name)),x=l.filter(b=>b.entityType==="library"||b.entityType==="functionCall").sort((b,h)=>b.name.localeCompare(h.name));return{visualEntities:p,libraryEntities:x}},[l]),F=i.useMemo(()=>{const p=new Set(L.map(x=>x.name));return m.filter(x=>!p.has(x.name)).sort((x,b)=>x.name.localeCompare(b.name))},[m,L]),_=l.some(p=>p.isAnalyzing),N=i.useRef(null),M=i.useRef(0),U=i.useCallback(()=>{N.current&&(M.current=N.current.scrollTop)},[]);if(i.useEffect(()=>{N.current&&M.current>0&&(N.current.scrollTop=M.current)}),t.length===0&&l.length===0&&F.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 px-8",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"No scenarios yet"}),e.jsx("p",{className:"text-xs",children:"Scenarios will appear here as Claude creates them alongside your code. Each scenario represents a different state of your app's data."})]})});if(c&&r){const p=r.name,x=r.filePath,b=r.sha,h=t.filter(C=>C.componentName===p||C.componentPath===x||!C.componentName&&(C.pageFilePath===x||b&&C.entitySha===b)),w=new Set((S==null?void 0:S[p])||[]),k=w.size>0,T=k?O.filter(C=>w.has(C.name)):[],A=k?L.filter(C=>w.has(C.name)):[];return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-1",children:[e.jsxs("button",{onClick:()=>o(void 0),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-gray-400 hover:text-white transition-colors cursor-pointer",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M7.5 9L4.5 6L7.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"All scenarios"]}),e.jsx("div",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-xs font-semibold text-white uppercase tracking-wider",children:r.displayName})}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2",children:h.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:"No scenarios for this component"}):h.map(C=>e.jsx(we,{scenarioId:C.id,updatedAt:C.updatedAt,hasScreenshot:!!C.screenshotPath,name:C.name,isActive:C.id===a,onSelect:()=>n(C)},C.id))}),T.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),T.map(C=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center gap-2 px-2 py-1",children:e.jsx("button",{onClick:()=>o(C.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:C.name})}),e.jsx(oe,{filePath:C.filePath,projectRoot:s}),(C.scenarios.length>0||C.pendingScenarios.length>0)&&e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:C.scenarios.map(K=>e.jsx(we,{imgSrc:K.screenshotPath?`/api/screenshot/${K.screenshotPath}`:null,name:K.name,isActive:K.id===v,onSelect:()=>y==null?void 0:y({analysisId:C.analysisId,scenarioId:K.id,scenarioName:K.name,entitySha:C.sha,entityName:C.name})},K.id))})]},C.sha))]}),A.length>0&&e.jsxs("div",{className:"pt-2 mt-1",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),A.map(C=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:C.name})}),e.jsx(oe,{filePath:C.filePath,projectRoot:s}),C.testFile&&e.jsx(Ke,{testFile:C.testFile,entityName:C.name})]},C.sha))]})]})})}return e.jsx("div",{ref:N,onScroll:U,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-3",children:[I.size>0&&e.jsxs("div",{children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),[...I.entries()].sort(([p],[x])=>p==="Home"?-1:x==="Home"?1:p.localeCompare(x)).map(([p,x])=>{var b,h;return e.jsxs("div",{className:"px-2 pt-1",children:[e.jsx("div",{className:"py-0.5",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-400",children:p})}),(((b=x[0])==null?void 0:b.pageFilePath)||g[p])&&e.jsx(oe,{filePath:((h=x[0])==null?void 0:h.pageFilePath)||g[p],projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:x.map(w=>e.jsx(we,{scenarioId:w.id,updatedAt:w.updatedAt,hasScreenshot:!!w.screenshotPath,name:w.name,isActive:w.id===a&&!v,onSelect:()=>n(w)},w.id))})]},p)})]}),B.size>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),[...B.entries()].map(([p,x])=>{var b;return e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center justify-between px-2 py-1",children:e.jsx("button",{onClick:()=>o(p),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:p})}),((b=x[0])==null?void 0:b.componentPath)&&e.jsx(oe,{filePath:x[0].componentPath,projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:x.map(h=>e.jsx(we,{scenarioId:h.id,updatedAt:h.updatedAt,hasScreenshot:!!h.screenshotPath,name:h.name,isActive:h.id===a&&!v,onSelect:()=>n(h)},h.id))})]},p)})]}),O.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsxs("div",{className:"px-2 py-1",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),_&&t.length===0&&l.every(p=>p.scenarioCount===0)&&e.jsx("span",{className:"ml-2 text-[10px] text-gray-500",children:"— Entities are being analyzed..."})]}),O.map(p=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[e.jsx("button",{onClick:()=>o(p.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:p.name}),p.isAnalyzing&&p.scenarioCount===0&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(oe,{filePath:p.filePath,projectRoot:s}),(p.scenarios.length>0||p.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:[p.scenarios.map(x=>e.jsx(we,{imgSrc:x.screenshotPath?`/api/screenshot/${x.screenshotPath}`:null,name:x.name,isActive:x.id===v,onSelect:()=>y==null?void 0:y({analysisId:p.analysisId,scenarioId:x.id,scenarioName:x.name,entitySha:p.sha,entityName:p.name})},x.id)),p.pendingScenarios.map(x=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:x,children:x},x))]})]},p.sha))]}),(L.length>0||F.length>0)&&e.jsxs("div",{className:`pt-2 mt-1 ${O.length>0?"":"border-t border-[#3d3d3d]"}`,children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),L.map(p=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"px-2 py-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:p.name}),p.isAnalyzing&&p.scenarioCount===0&&e.jsxs("span",{className:"ml-2 inline-flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(oe,{filePath:p.filePath,projectRoot:s}),p.testFile?e.jsx(Ke,{testFile:p.testFile,entityName:p.name}):e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},p.sha)),F.map(p=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:p.name})}),e.jsx(oe,{filePath:p.filePath,projectRoot:s}),e.jsx(Ke,{testFile:p.testFile,entityName:p.name})]},p.name))]})]})})}function Ls(t,s,a=new Date){const n={"1d":1,"3d":3,"7d":7,"30d":30}[s],c=new Date(a);c.setDate(c.getDate()-n);const r=c.toISOString().split("T")[0],o=t.filter(S=>S.date>=r),l=new Set(o.map(S=>S.commitSha).filter(Boolean)),m=new Map;for(const S of o)if(S.scenarioScreenshots)for(const g of S.scenarioScreenshots){m.has(g.name)||m.set(g.name,[]);const I=m.get(g.name);I.some(f=>f.path===g.path)||I.push({path:g.path,time:S.time})}for(const S of m.values())S.sort((g,I)=>g.time.localeCompare(I.time));const v=[],y=new Map;for(const[S,g]of m){const I=S.indexOf(" - ");if(I!==-1){const f=S.slice(0,I);y.has(f)||y.set(f,[]),y.get(f).push({name:S,screenshots:g})}else v.push({name:S,screenshots:g})}return{commitCount:l.size,entryCount:o.length,appScenarios:v,componentGroups:y,totalScenarios:m.size}}function Fs(t){const s=new Map;for(const a of[...t].reverse()){const n=s.get(a.date)||[];n.push(a),s.set(a.date,n)}return s}function Ds(t){const s=new Map;for(const a of t){let n;if("componentName"in a&&a.componentName)n=a.componentName;else if("componentName"in a&&a.componentName===null)n="App";else{const r=a.name.indexOf(" - ");n=r!==-1?a.name.slice(0,r):"App"}const c=s.get(n)||[];c.push(a),s.set(n,c)}return[...s.entries()].sort(([a],[n])=>a==="App"?-1:n==="App"?1:a.localeCompare(n))}const yt=120;function At({text:t,theme:s}){const[a,n]=i.useState(!1),c=t.length>yt,r=c&&!a?t.slice(0,yt)+"…":t,o=s==="light";return e.jsxs("div",{className:`px-4 py-2 ${o?"border-b border-gray-200 bg-gray-50":"border-b border-[#3d3d3d] bg-[#252525]"}`,children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-wider text-gray-500",children:"User Prompt"}),e.jsxs("p",{className:`text-[11px] mt-0.5 mb-0 leading-relaxed ${o?"text-gray-600":"text-gray-400"}`,children:[r,c&&e.jsx("button",{onClick:()=>n(!a),className:`ml-1 text-[11px] font-medium bg-transparent border-none p-0 cursor-pointer ${o?"text-blue-500 hover:text-blue-700":"text-[#00a0c4] hover:text-[#00c0e8]"}`,children:a?"Show less":"Read more…"})]})]})}function vt({status:t}){const s={new:{label:"New",bg:"bg-green-900/40",text:"text-green-400",border:"border-green-700/50"},edited:{label:"Edited",bg:"bg-blue-900/40",text:"text-blue-400",border:"border-blue-700/50"},impacted:{label:"Impacted",bg:"bg-amber-900/40",text:"text-amber-400",border:"border-amber-700/50"}}[t.status];return e.jsx("span",{className:`${s.bg} ${s.text} ${s.border} border text-[8px] font-bold px-1 py-0 rounded-full uppercase tracking-wider`,children:s.label})}function Bs({testFile:t,entityName:s}){const{results:a,isRunning:n,runTests:c}=Qe(t);if(n&&!a)return e.jsxs("div",{className:"pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#00a0c4] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-500",children:"Running tests..."})]});if(!a)return null;if(a.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:a.errorMessage})});const r=s?a.testCases.filter(m=>m.fullName.startsWith(s)):a.testCases,o=r.length>0?r:a.testCases;if(o.length===0)return null;const l=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[o.map(m=>{var y;const v=l&&m.fullName.startsWith(l)?m.fullName.slice(l.length):m.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[m.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):m.status==="failed"?e.jsx("span",{className:"text-red-400 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-500 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${m.status==="passed"?"text-green-400":m.status==="failed"?"text-red-400":"text-gray-500"}`,children:v})]}),m.status==="failed"&&((y=m.failureMessages)==null?void 0:y.map((S,g)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400/70 truncate max-w-full",title:S,children:S.split(`
4
+ `)[0]},g)))]},m.fullName)}),e.jsx("button",{onClick:c,disabled:n,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:n?"Running...":"Re-run"})]})}const Os={added:"text-green-400",untracked:"text-green-400",modified:"text-blue-400",renamed:"text-purple-400"};function zs({files:t}){return e.jsxs("div",{className:"border-t border-[#3d3d3d] pt-2 mt-1",children:[e.jsxs("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:["Modified Files (",t.length,")"]}),e.jsx("div",{className:"mt-1 space-y-0.5 max-h-[150px] overflow-auto",children:t.map(s=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold uppercase w-[14px] text-center ${Os[s.status]||"text-gray-500"}`,children:s.status==="added"||s.status==="untracked"?"A":s.status==="modified"?"M":s.status==="renamed"?"R":"?"}),e.jsx("span",{className:"text-[10px] text-gray-400 truncate font-mono",children:s.path})]},s.path))})]})}const Ws={feature:{label:"Feature",color:"bg-[#005c75]"},fix:{label:"Fix",color:"bg-amber-700"},refactor:{label:"Refactor",color:"bg-purple-700"},scaffold:{label:"Scaffold",color:"bg-green-700"},data:{label:"Data",color:"bg-blue-700"},milestone:{label:"Milestone",color:"bg-yellow-600"}};function Us(t){try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function Hs(t){try{return new Date(t+"T00:00:00").toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"})}catch{return t}}const Js=[{value:"1d",label:"1 Day"},{value:"3d",label:"3 Days"},{value:"7d",label:"1 Week"},{value:"30d",label:"1 Month"}];function Vs({entries:t,onScreenshotClick:s}){const[a,n]=i.useState(!1),[c,r]=i.useState("7d"),o=i.useMemo(()=>Ls(t,c),[t,c]);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("button",{onClick:()=>n(!a),className:"w-full flex items-center justify-between px-3 py-2.5 cursor-pointer bg-transparent border-none text-left hover:bg-[#333] transition-colors",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wider",children:"Timeframe Summary"}),e.jsx("span",{className:`text-gray-500 text-[10px] transition-transform ${a?"rotate-180":""}`,children:"▼"})]}),a&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"flex gap-1 pt-2.5",children:Js.map(l=>e.jsx("button",{onClick:()=>r(l.value),className:`px-2.5 py-1 text-[10px] font-medium rounded transition-colors cursor-pointer border ${c===l.value?"bg-[#005c75] text-white border-[#005c75]":"bg-transparent text-gray-400 border-[#4d4d4d] hover:text-white hover:border-[#005c75]"}`,children:l.label},l.value))}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-400",children:[e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:o.commitCount})," ",o.commitCount===1?"commit":"commits"]}),e.jsx("span",{className:"text-[#3d3d3d]",children:"|"}),e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:o.totalScenarios})," ",o.totalScenarios===1?"scenario changed":"scenarios changed"]}),e.jsx("span",{className:"text-[#3d3d3d]",children:"|"}),e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:o.entryCount})," ",o.entryCount===1?"entry":"entries"]})]}),o.totalScenarios===0?e.jsx("p",{className:"text-[11px] text-gray-500 italic m-0",children:"No scenario changes in this period."}):e.jsxs("div",{className:"space-y-3",children:[o.appScenarios.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),o.appScenarios.map(l=>e.jsx(Nt,{scenario:l,onScreenshotClick:s},l.name))]}),o.componentGroups.size>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),[...o.componentGroups.entries()].sort(([l],[m])=>l.localeCompare(m)).map(([l,m])=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:l}),m.map(v=>e.jsx(Nt,{scenario:v,onScreenshotClick:s},v.name))]},l))]})]})]})]})}function Nt({scenario:t,onScreenshotClick:s}){const a=t.name.indexOf(" - "),n=a!==-1?t.name.slice(a+3):t.name;return e.jsxs("div",{className:"pl-2",children:[e.jsx("span",{className:"text-[10px] text-gray-500 block mb-1",children:n}),e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto",children:t.screenshots.map((c,r)=>e.jsxs("div",{className:"flex items-center shrink-0",children:[r>0&&e.jsx("span",{className:"text-[8px] text-gray-600 mx-0.5",children:"→"}),e.jsx("button",{type:"button",className:"w-16 h-16 rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] shrink-0 flex items-center justify-center cursor-pointer transition-colors",title:`${t.name} (${new Date(c.time).toLocaleDateString()})`,onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${c.path.replace("screenshots/","")}`,commitSha:null,commitMessage:null,scenarioName:t.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${c.path.replace("screenshots/","")}`,alt:t.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})})]},c.path))})]})}function Gs({isActive:t,onScreenshotClick:s,glossaryFunctions:a=[]}){const[n,c]=i.useState([]),[r,o]=i.useState(!0),[l,m]=i.useState(new Set),v=i.useCallback(g=>{m(I=>{const f=new Set(I);return f.has(g)?f.delete(g):f.add(g),f})},[]),y=i.useCallback(async()=>{try{const g=await fetch("/api/editor-journal");if(g.ok){const I=await g.json();c(I.entries||[])}}catch{}finally{o(!1)}},[]);if(i.useEffect(()=>{y()},[y]),i.useEffect(()=>{t&&y()},[t,y]),i.useEffect(()=>{if(!t)return;const g=setInterval(()=>void y(),5e3);return()=>clearInterval(g)},[t,y]),r)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Loading journal..."})});if(n.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 px-8",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"No journal entries yet"}),e.jsx("p",{className:"text-xs",children:"Journal entries will appear as you build. Claude records features, screenshots, and commits as the project evolves."})]})});const S=Fs(n);return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsx(Vs,{entries:n,onScreenshotClick:s}),[...S.entries()].map(([g,I])=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1.5 sticky top-0 bg-[#1e1e1e] z-10",children:e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:Hs(g)})}),e.jsx("div",{className:"space-y-2",children:I.map((f,B)=>{const O=Ws[f.type]||{label:f.type,color:"bg-gray-600"},L=`${f.time}-${B}`,F=l.has(L);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:`p-3 space-y-2 ${F?"":"max-h-[300px] overflow-y-auto"}`,children:[e.jsx("div",{className:"flex items-start gap-2 cursor-pointer",onClick:()=>v(L),children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-white truncate",children:f.title}),e.jsx("span",{className:`${O.color} text-white text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider shrink-0`,children:O.label})]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:Us(f.time)}),f.featureName&&e.jsx("span",{className:"text-[10px] text-gray-500 italic truncate",title:f.featureName,children:f.featureName})]})}),f.userPrompt&&e.jsx(At,{text:f.userPrompt,theme:"dark"}),e.jsx("p",{className:"text-xs text-gray-400 leading-relaxed",children:f.description}),f.screenshot&&e.jsx("button",{type:"button",className:"rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] flex items-center justify-center p-1 cursor-pointer transition-colors w-full",onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${f.screenshot.replace("screenshots/","")}`,commitSha:f.commitSha,commitMessage:f.commitMessage,scenarioName:f.title}),children:e.jsx("img",{src:`/api/editor-journal-image/${f.screenshot.replace("screenshots/","")}`,alt:f.title,className:"max-w-full max-h-full object-contain",loading:"lazy"})}),f.scenarioScreenshots&&f.scenarioScreenshots.length>0&&(()=>{const _=Ds(f.scenarioScreenshots),N=f.entityChangeStatus,M=_.filter(([h])=>h==="App").flatMap(([,h])=>h),U=_.filter(([h])=>h!=="App"),p=new Map;for(const h of M){const w=h,k=w.pageFilePath?Ce(ke(w.pageFilePath)):$e(w.url??null),T=p.get(k)||[];T.push(h),p.set(k,T)}const x=[...p.entries()],b=h=>e.jsx("button",{type:"button",className:"w-[4.5rem] h-[4.5rem] rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] shrink-0 flex items-center justify-center cursor-pointer transition-colors",onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${h.path.replace("screenshots/","")}`,commitSha:f.commitSha,commitMessage:f.commitMessage,scenarioName:h.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${h.path.replace("screenshots/","")}`,alt:h.name,title:h.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})},h.path);return e.jsxs("div",{className:"space-y-2",children:[x.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),x.map(([h,w])=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:h}),(N==null?void 0:N[h])&&e.jsx(vt,{status:N[h]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:w.map(b)})]},h))]}),U.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),U.map(([h,w])=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:h}),(N==null?void 0:N[h])&&e.jsx(vt,{status:N[h]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:w.map(b)})]},h))]})]})})(),a.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"}),e.jsx("div",{className:"space-y-2",children:a.map(_=>e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-200",children:_.name}),e.jsx("span",{className:"text-[9px] text-gray-500 truncate block",children:_.filePath}),_.testFile?e.jsx(Bs,{testFile:_.testFile,entityName:_.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},_.name))})]}),f.commitSha&&e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[e.jsx("span",{className:"font-mono text-[#00a0c4] bg-[#00a0c4]/10 px-1.5 py-0.5 rounded",children:f.commitSha.slice(0,7)}),e.jsx("span",{className:"text-gray-500 truncate",children:f.commitMessage})]}),F&&f.modifiedFiles&&f.modifiedFiles.length>0&&e.jsx(zs,{files:f.modifiedFiles})]}),e.jsxs("button",{onClick:()=>v(L),className:"w-full py-1.5 text-[10px] text-gray-500 hover:text-gray-300 border-t border-[#3d3d3d] transition-colors cursor-pointer",children:["——— ",F?"Collapse":"Expand"," ———"]})]},L)})})]},g))]})})}function qs({prompt:t,height:s=300,onClose:a}){const n=i.useRef(null),c=i.useRef(null),r=i.useRef(null),o=i.useRef(!1),l=i.useRef(t);return i.useEffect(()=>{const m=n.current;if(!m)return;let v=!1,y=null;async function S(){const[g,I]=await Promise.all([Xe(()=>import("./xterm-BqvuqXEL.js"),[]),Xe(()=>import("./addon-fit-YJmn1quW.js"),[])]);if(v)return;{let p=document.getElementById("xterm-css");p||(p=document.createElement("style"),p.id="xterm-css",document.head.appendChild(p)),p.textContent=`
5
+ .xterm { cursor: text; position: relative; user-select: none; -ms-user-select: none; -webkit-user-select: none; }
6
+ .xterm.focus, .xterm:focus { outline: none; }
7
+ .xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
8
+ .xterm .xterm-helper-textarea { padding: 0; border: 0; margin: 0; position: absolute; opacity: 0; left: -9999em; top: 0; width: 0; height: 0; z-index: -5; white-space: nowrap; overflow: hidden; resize: none; caret-color: transparent !important; clip-path: inset(100%) !important; }
9
+ .xterm .composition-view { background: #000; color: #FFF; display: none; position: absolute; white-space: nowrap; z-index: 1; }
10
+ .xterm .composition-view.active { display: block; }
11
+ .xterm .xterm-viewport { background-color: #000; overflow-y: scroll; cursor: default; position: absolute; right: 0; left: 0; top: 0; bottom: 0; }
12
+ .xterm .xterm-screen { position: relative; }
13
+ .xterm .xterm-screen canvas { position: absolute; left: 0; top: 0; }
14
+ .xterm .xterm-scroll-area { visibility: hidden; }
15
+ .xterm-char-measure-element { display: inline-block; visibility: hidden; position: absolute; top: 0; left: -9999em; line-height: normal; }
16
+ .xterm.enable-mouse-events { cursor: default; }
17
+ .xterm.xterm-cursor-pointer, .xterm .xterm-cursor-pointer { cursor: pointer; }
18
+ .xterm.column-select.focus { cursor: crosshair; }
19
+ .xterm .xterm-accessibility:not(.debug), .xterm .xterm-message { position: absolute; left: 0; top: 0; bottom: 0; right: 0; z-index: 10; color: transparent; pointer-events: none; }
20
+ .xterm .xterm-accessibility-tree:not(.debug) *::selection { color: transparent; }
21
+ .xterm .xterm-accessibility-tree { user-select: text; white-space: pre; }
22
+ .xterm .live-region { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
23
+ .xterm-dim { opacity: 1 !important; }
24
+ .xterm-underline-1 { text-decoration: underline; }
25
+ .xterm-underline-2 { text-decoration: double underline; }
26
+ .xterm-underline-3 { text-decoration: wavy underline; }
27
+ .xterm-underline-4 { text-decoration: dotted underline; }
28
+ .xterm-underline-5 { text-decoration: dashed underline; }
29
+ .xterm-overline { text-decoration: overline; }
30
+ .xterm-strikethrough { text-decoration: line-through; }
31
+ .xterm-screen .xterm-decoration-container .xterm-decoration { z-index: 6; position: absolute; }
32
+ .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { z-index: 7; }
33
+ .xterm-decoration-overview-ruler { z-index: 8; position: absolute; top: 0; right: 0; pointer-events: none; }
34
+ .xterm-decoration-top { z-index: 2; position: relative; }
35
+ `}const f=new g.Terminal({theme:{background:"#1a1a1a",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"},fontSize:12,fontFamily:"'IBM Plex Mono', 'Menlo', 'Monaco', monospace",cursorBlink:!0,scrollback:5e3,allowProposedApi:!0}),B=new I.FitAddon;f.loadAddon(B),f.open(m),requestAnimationFrame(()=>{try{B.fit()}catch{}}),r.current=f;let O=null;try{const p=await fetch("/api/editor-scenario-prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:l.current})});p.ok&&(O=(await p.json()).promptFile)}catch{}if(v)return;const L=window.location.protocol==="https:"?"wss:":"ws:",F=window.location.host,_=new URLSearchParams;_.set("entityName","inline-claude");const N=`${L}//${F}/ws/terminal?${_.toString()}`,M=new WebSocket(N);c.current=M,M.onopen=()=>{M.send(JSON.stringify({type:"resize",cols:f.cols,rows:f.rows}))};let U=!1;M.onmessage=p=>{try{const x=JSON.parse(p.data);if(x.type==="session-id"&&!U){U=!0,setTimeout(()=>{const b=O?`claude "Read the file at '${O.replace(/'/g,"'\\''")}' for your instructions."`:"claude";M.send(JSON.stringify({type:"input",data:b+"\r"}))},300);return}if(x.type==="output"&&x.data){f.write(x.data);return}}catch{f.write(p.data)}},M.onclose=()=>{o.current||f.write(`\r
36
+ \x1B[90m--- Session ended ---\x1B[0m\r
37
+ `)},M.onerror=()=>{f.write(`\r
38
+ \x1B[31mConnection error\x1B[0m\r
39
+ `)},f.onData(p=>{M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"input",data:p}))}),y=new ResizeObserver(()=>{try{B.fit(),M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"resize",cols:f.cols,rows:f.rows}))}catch{}}),y.observe(m)}return S(),()=>{var g,I;v=!0,o.current=!0,y==null||y.disconnect(),((g=c.current)==null?void 0:g.readyState)===WebSocket.OPEN&&c.current.close(),(I=r.current)==null||I.dispose()}},[]),e.jsxs("div",{className:"border-t border-[#2d2d2d]",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[#1e1e1e]",children:[e.jsx("span",{className:"text-[10px] font-medium text-[#00a0c4]",children:"Claude"}),a&&e.jsx("button",{onClick:a,className:"text-gray-500 hover:text-gray-300 text-[10px] bg-transparent border-none cursor-pointer",children:"Close"})]}),e.jsx("div",{ref:n,style:{height:s,background:"#1a1a1a",padding:"4px 0",position:"relative",overflow:"hidden"}})]})}const wt=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-gray-500 shrink-0",children:e.jsx("path",{d:"M4.5 3L7.5 6L4.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});function Ys(t,s){if(t.length<=s)return t;const a=s-2;return[t[0],"ellipsis",...t.slice(t.length-a)]}function St({items:t,onNavigate:s}){if(t.length===0)return null;const a=Ys(t,4);return e.jsx("nav",{className:"flex items-center gap-1 text-xs min-w-0",children:a.map((n,c)=>{if(n==="ellipsis")return e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(wt,{}),e.jsx("span",{className:"text-gray-500",children:"..."})]},"ellipsis");const r=c===a.length-1;return e.jsxs("span",{className:"flex items-center gap-1 min-w-0",children:[c>0&&e.jsx(wt,{}),r?e.jsx("span",{className:"text-white font-medium truncate",children:n.name}):e.jsx("button",{onClick:()=>s(n.componentName,n.entitySha),className:"text-gray-400 hover:text-white transition-colors cursor-pointer bg-transparent border-none p-0 truncate",children:n.name})]},n.componentName||"app")})})}function Ks(t,s,a,n){var m;const c=n.length>0?n.map(v=>`- "${v.name}" (ID: ${v.id})${v.url?` — URL: ${v.url}`:""}`).join(`
40
+ `):"(no scenarios yet)",r=s.endsWith("/page.tsx")||s.endsWith("/page.js"),o=((m=n.find(v=>v.url))==null?void 0:m.url)||"/",l=[`You are helping edit scenarios for the "${t}" entity in a CodeYam project.`,"","## Entity",`- **Name:** ${t}`,`- **File:** ${s}`,`- **Type:** ${r?"Page (application scenario with seed data)":"Component (component scenario with mock props)"}`,"","## Existing Scenarios",c,""];return r?l.push("## How Seed Data Works","","Application scenarios use `seed` data to populate the database before the page is captured.","The seed is a JSON object where each key is a Prisma model name in camelCase singular (matching the Prisma client accessor name) and the value is an array of records.","","### Seed Key Naming Convention","The key must be the camelCase singular form of the Prisma model name:",'- `model User` → key `"user"`','- `model BlogPost` → key `"blogPost"`','- `model Feedback` → key `"feedback"`',"",'**WARNING:** Do NOT use plural forms like "users", "blogPosts", or "feedbacks" — the seed adapter will silently fail to match them.',"","To understand the data models, read the Prisma schema at `prisma/schema.prisma`.","To see examples of existing seed data, look at `.codeyam/editor-scenarios/*.seed.json` files.","",`Also read the source file at \`${s}\` to understand what data the page queries and renders.`,"","## Registering a Scenario","","For small seed data, pass it inline:","```",`codeyam editor register '{"name":"Scenario Name","type":"application","url":"${o}","dimensions":["Laptop"],"seed":{"user":[...],"feedback":[...]}}'`,"```","","For large seed data, write it to a temp file and use @file syntax:","```","# Write JSON to a temp file","cat > .codeyam/tmp/scenario.json << 'SCENARIO_EOF'",`{"name":"Scenario Name","type":"application","url":"${o}","dimensions":["Laptop"],"seed":{"user":[...],"feedback":[...]}}`,"SCENARIO_EOF","codeyam editor register @.codeyam/tmp/scenario.json","```"):l.push("## Registering a Scenario","",`Read the source file at \`${s}\` to understand what props the component expects.`,"","```",`codeyam editor register '{"name":"Scenario Name","type":"component","componentName":"${t}","componentPath":"${s}","dimensions":["Laptop"],"mockData":{"propName":"value"}}'`,"```"),l.push("","## Deleting a Scenario","","To delete a scenario, use its ID from the list above:","```","codeyam editor delete <scenarioId>","```","","## Validating Seed Data","","Before registering, you can validate seed data structure and check that keys match Prisma models:","```",`codeyam editor validate-seed '{"user":[...]}'`,"```"),l.push("","## Important","- DO NOT take any action until the user tells you what they want","- Start by briefly listing the existing scenarios",'- Then ask: "Would you like to modify an existing scenario or add a new one?"',"- Wait for the user's answer before proceeding",'- Keep scenario names descriptive: "Empty State", "With Comments", "Admin View", etc.',`- Each scenario should capture a distinct, meaningful state of the ${r?"page":"component"}`),l.join(`
41
+ `)}function _t(t){var c,r;const s=new Map,a=new Map;for(const o of t)if(o.componentName){const l=a.get(o.componentName)||[];l.push(o),a.set(o.componentName,l)}else if($t(o.url)){const l=(c=o.url)==null?void 0:c.match(/[?&]c=([^&]+)/),m=l?decodeURIComponent(l[1]):"Isolated",v=a.get(m)||[];v.push(o),a.set(m,v)}else{const l=o.displayName||((r=o.pageFilePath)!=null&&r.startsWith("app/")?Ce(ke(o.pageFilePath)):$e(o.url)),m=s.get(l)||[];m.push(o),s.set(l,m)}const n=new Map([...a.entries()].sort(([o],[l])=>o.localeCompare(l)));return{pageGroups:s,componentGroups:n}}function Xs(t,s){var n,c;const a=new Map;for(const[r,o]of t){const l=(n=o.find(m=>m.entitySha))==null?void 0:n.entitySha;l&&a.set(r,l)}for(const[r,o]of s){const l=(c=o.find(m=>m.entitySha))==null?void 0:c.entitySha;l&&a.set(r,l)}return a}function Qs(t,s,a,n){if(s.has(t))return!0;const c=a.find(r=>r.sha===t);return c?n.has(c.name):!1}function Zs(t,s,a,n){const c=[];for(const[r,o]of t){const l=a.get(r);l?n(l)||c.push({name:r,scenarios:o,reason:"incomplete"}):c.push({name:r,scenarios:o,reason:"missing"})}for(const[r,o]of s){const l=a.get(r);l?n(l)||c.push({name:r,scenarios:o,reason:"incomplete"}):c.push({name:r,scenarios:o,reason:"missing"})}return c}function ea(t,s,a){if(!t)return null;const n=s.find(r=>r.sha===t);if(!n)return null;const c=a.find(r=>r.entitySha===t);return{sha:t,name:n.name,filePath:n.filePath,entityType:n.entityType,displayName:(c==null?void 0:c.displayName)||n.name}}function Lt(t,s){const a=s.some(c=>!c.componentName),n=s.map(c=>`'${c.id}'`).join(", ");return a?[`### Page: "${t}" (${s.length} scenario(s))`,"","Step A: Find the source file that renders this page by running:",' find src app -name "App.tsx" -o -name "App.jsx" -o -name "page.tsx" -o -name "page.jsx" -o -name "index.tsx" 2>/dev/null',"","Pick the file that is the main app entry point or the page component for this route. Confirm it exists with `cat <filepath> | head -5`.","","Step B: Set page_file_path on all scenarios for this page (replace PAGE_FILE_PATH with the path from Step A):",` sqlite3 .codeyam/db.sqlite3 "UPDATE editor_scenarios SET page_file_path = 'PAGE_FILE_PATH' WHERE id IN (${n});"`,"","Step C: Get the entity SHA (after running analyze-imports in the shared step above):",` sqlite3 .codeyam/db.sqlite3 "SELECT sha FROM entities WHERE file_path = 'PAGE_FILE_PATH' ORDER BY created_at DESC LIMIT 1;"`,"","If no rows appear, the path was wrong — go back to Step A.","","Step D: Set entity_sha and display_name on all scenarios (replace ENTITY_SHA with the SHA from Step C):",` sqlite3 .codeyam/db.sqlite3 "UPDATE editor_scenarios SET entity_sha = 'ENTITY_SHA', display_name = '${t}' WHERE id IN (${n});"`].join(`
42
+ `):[`### Component: "${t}" (${s.length} scenario(s))`,"","Step A: Get the entity SHA (after running analyze-imports in the shared step above):",` sqlite3 .codeyam/db.sqlite3 "SELECT sha FROM entities WHERE name = '${t}' ORDER BY created_at DESC LIMIT 1;"`,"","If no rows appear, check that .codeyam/glossary.json contains an entry for this component.","","Step B: Set entity_sha and display_name on all scenarios (replace ENTITY_SHA with the SHA from Step A):",` sqlite3 .codeyam/db.sqlite3 "UPDATE editor_scenarios SET entity_sha = 'ENTITY_SHA', display_name = '${t}' WHERE id IN (${n});"`].join(`
43
+ `)}function kt({name:t,scenarios:s,reason:a="missing"}){var r,o;const n=((r=s[0])==null?void 0:r.componentPath)||((o=s[0])==null?void 0:o.pageFilePath)||null,c=a==="incomplete"?[`The "${t}" entity exists but has not been fully analyzed — its components and functions cannot be displayed.`,"","Follow these steps:","",`Step 1: Check if "${t}" is in the glossary:`,` cat .codeyam/glossary.json | grep "${t}"`,"","If not found, add an entry to .codeyam/glossary.json:",` { "name": "${t}", "filePath": "${n||"FILL_IN_PATH"}", "description": "...", "returnType": "JSX.Element" }`,"","Step 2: Run: codeyam editor analyze-imports","","Step 3: Reload the editor page and verify components/functions appear."].join(`
44
+ `):[`The "${t}" ${s.some(l=>!l.componentName)?"page":"component"} is missing entity data in the CodeYam database. Its scenarios are hidden until this is fixed.`,"","IMPORTANT: Do NOT re-register scenarios — that would overwrite their screenshots. Only update the database directly.","","Follow these steps EXACTLY:","","Step 1: Run: codeyam editor analyze-imports","","Step 2: Fix this entity:","",Lt(t,s),"","Step 3: Reload the editor page in the browser and verify the scenarios appear."].join(`
45
+ `);return e.jsx(pe,{content:c,label:"Copy Fix Prompt",copiedLabel:"Copied!",className:"text-[9px] text-amber-400 hover:text-amber-300 bg-transparent border border-amber-400/30 rounded px-1.5 py-0.5 cursor-pointer transition-colors ml-2"})}function ta({brokenEntities:t}){if(t.length===0)return null;const s=t.reduce((r,o)=>r+o.scenarios.length,0),a=t.filter(r=>r.reason==="incomplete"),n=t.filter(r=>r.reason==="missing"),c=[`${t.length} entities are missing data in the CodeYam database. ${s} total scenario(s) are hidden until this is fixed.`,"","IMPORTANT: Do NOT re-register scenarios — that would overwrite their screenshots. Only update the database directly.","","Follow these steps EXACTLY:","",...a.length>0?["## Step 1: Add missing entries to the glossary","","Read `.codeyam/glossary.json` and check if these entities have entries. For each one that is missing, add an entry:","",...a.map(r=>{var l,m;const o=((l=r.scenarios[0])==null?void 0:l.componentPath)||((m=r.scenarios[0])==null?void 0:m.pageFilePath)||"FILL_IN_PATH";return`- "${r.name}" (filePath: "${o}")`}),"",'Each glossary entry needs: name, filePath, description, returnType (use "JSX.Element" for components/pages).',""]:["## Step 1: No glossary changes needed",""],"## Step 2: Run import analysis"," codeyam editor analyze-imports","",...n.length>0?["## Step 3: Fix missing entity associations","",...n.map(r=>Lt(r.name,r.scenarios)),""]:[],`## Step ${n.length>0?"4":"3"}: Reload the editor page in the browser and verify all scenarios appear.`].join(`
46
+ `);return e.jsxs("div",{className:"mb-3 p-2 rounded border border-amber-400/30 bg-amber-400/5",children:[e.jsxs("p",{className:"text-[10px] text-amber-400/80 m-0 leading-relaxed",children:[t.length," ",t.length===1?"entity is":"entities are"," missing data (",s," hidden scenario",s!==1?"s":"","). Copy this prompt into Claude to fix them all at once."]}),e.jsx("div",{className:"mt-1.5",children:e.jsx(pe,{content:c,label:"Copy Fix All Prompt",copiedLabel:"Copied!",className:"text-[9px] text-amber-400 hover:text-amber-300 bg-transparent border border-amber-400/30 rounded px-1.5 py-0.5 cursor-pointer transition-colors"})})]})}function sa({scenarios:t,entityName:s,entityFilePath:a,entityType:n,onSwitchToBuild:c,onScenarioSelect:r}){const[o,l]=i.useState(!1),[m,v]=i.useState(null),[y,S]=i.useState(""),[g,I]=i.useState(!1),[f,B]=i.useState(null),[O,L]=i.useState(!1),F=i.useCallback(async N=>{if(!(!y.trim()||g)){I(!0);try{(await fetch("/api/editor-rename-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioId:N,name:y.trim()})})).ok&&v(null)}catch{}finally{I(!1)}}},[y,g]),_=i.useCallback(async N=>{if(confirm(`Delete scenario "${N.name}"?`)){B(N.id);try{const M=N.screenshotPaths?Object.values(N.screenshotPaths):N.screenshotPath?[N.screenshotPath]:[];await fetch("/api/delete-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioId:N.id,screenshotPaths:M})})}catch{}finally{B(null)}}},[]);return o?e.jsxs("div",{className:"border border-[#3d3d3d] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-[#1e1e1e]",children:[e.jsx("span",{className:"text-xs font-medium text-gray-400",children:"Edit Scenarios"}),e.jsx("button",{onClick:()=>{l(!1),v(null)},className:"text-gray-500 hover:text-gray-300 text-xs bg-transparent border-none cursor-pointer",children:"Close"})]}),e.jsx("div",{className:"divide-y divide-[#2d2d2d]",children:t.map(N=>e.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 hover:bg-[#252525] cursor-pointer transition-colors",style:{opacity:f===N.id?.4:1},onClick:()=>{m!==N.id&&r(N)},children:[N.screenshotPath?e.jsx(Ae,{scenarioId:N.id,updatedAt:N.updatedAt,alt:"",className:"rounded w-[40px] h-[40px] shrink-0 overflow-hidden",imgClassName:"w-full h-full object-cover"}):e.jsx("div",{className:"rounded bg-[#1e1e1e]",style:{width:40,height:40,flexShrink:0}}),m===N.id?e.jsxs("form",{className:"flex-1 flex items-center gap-1.5 min-w-0",onSubmit:M=>{M.preventDefault(),F(N.id)},children:[e.jsx("input",{type:"text",value:y,onChange:M=>S(M.target.value),className:"flex-1 px-2 py-1 text-xs bg-[#1e1e1e] text-white border border-[#3d3d3d] rounded outline-none focus:border-[#005c75] min-w-0",autoFocus:!0,disabled:g}),e.jsx("button",{type:"submit",disabled:g||!y.trim(),className:"px-2 py-1 text-[10px] bg-[#005c75] text-white rounded hover:bg-[#004d63] disabled:opacity-40 cursor-pointer border-none",children:g?"...":"Save"}),e.jsx("button",{type:"button",onClick:()=>v(null),className:"px-2 py-1 text-[10px] text-gray-400 hover:text-white cursor-pointer bg-transparent border-none",children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex-1 text-xs text-gray-300 truncate min-w-0",children:N.name}),e.jsx("button",{onClick:M=>{M.stopPropagation(),v(N.id),S(N.name)},className:"text-[10px] text-gray-500 hover:text-gray-300 cursor-pointer bg-transparent border-none px-1",title:"Rename",children:"Rename"}),e.jsx("button",{onClick:M=>{M.stopPropagation(),_(N)},disabled:f===N.id,className:"text-[10px] text-red-400/60 hover:text-red-400 cursor-pointer bg-transparent border-none px-1",title:"Delete",children:"Delete"})]})]},N.id))}),O?e.jsx(qs,{prompt:Ks(s,a,n,t),height:500,onClose:()=>L(!1)}):e.jsx("div",{className:"px-3 py-2.5 bg-[#1e1e1e] border-t border-[#2d2d2d] flex justify-center",children:e.jsx("button",{onClick:()=>L(!0),className:"px-5 py-2 text-xs font-medium text-white cursor-pointer bg-[#005c75] hover:bg-[#004d63] border-none rounded-md transition-colors",children:"Modify with Claude"})})]}):e.jsx("div",{className:"flex justify-center",children:e.jsx("button",{onClick:()=>l(!0),className:"px-5 py-2 text-xs font-medium text-gray-300 hover:text-white transition-colors cursor-pointer bg-[#2a2a2a] hover:bg-[#333] border border-[#4a4a4a] hover:border-[#666] rounded-md",children:"Edit Scenarios"})})}function xe({scenarioId:t,updatedAt:s,hasScreenshot:a,imgSrc:n,name:c,isActive:r,onSelect:o}){const l=t&&a,m=!t&&n;return e.jsxs("button",{onClick:o,className:"flex flex-col items-center gap-1 cursor-pointer group w-full",title:c,children:[e.jsx("div",{className:`w-full aspect-square rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${r?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:l?e.jsx(Ae,{scenarioId:t,updatedAt:s,alt:c,className:"w-full h-full",imgClassName:"w-full h-full object-contain"}):m?e.jsx("img",{src:n,alt:c,className:"w-full h-full object-contain",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-[#1a1a1a] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-gray-600",children:"No img"})})}),e.jsx("span",{className:`text-[10px] leading-tight text-center truncate w-full ${r?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:c})]})}function Se({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-500 hover:text-gray-300 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(pe,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function aa({hasProject:t,scenarios:s,analyzedEntities:a,allEntities:n=[],glossaryFunctions:c=[],glossaryEntries:r=[],projectRoot:o,activeScenarioId:l,onScenarioSelect:m,onAnalyzedScenarioSelect:v,onSwitchToBuild:y,zoomComponent:S,focusedEntity:g,onZoomChange:I,entityImports:f,pageFilePaths:B={},projectTitle:O,projectDescription:L,migrationMode:F="none",migrationState:_,onStartMigration:N,breadcrumbItems:M=[]}){var Z;const{pageGroups:U,componentGroups:p}=i.useMemo(()=>_t(s),[s]),x=i.useMemo(()=>Xs(U,p),[U,p]),b=i.useMemo(()=>new Set(a.map(P=>P.sha)),[a]),h=i.useMemo(()=>new Set(Object.keys(f||{})),[f]),w=i.useCallback(P=>Qs(P,b,n,h),[b,n,h]),k=i.useMemo(()=>Zs(U,p,x,w),[U,p,x,w]),T=i.useMemo(()=>a.filter(P=>P.entityType==="visual").sort((P,R)=>P.name.localeCompare(R.name)),[a]),A=i.useMemo(()=>{const P=new Map;for(const R of c)P.set(R.name,R);return P},[c]),C=i.useRef(null),K=i.useRef(0),he=i.useCallback(()=>{C.current&&(K.current=C.current.scrollTop)},[]);i.useEffect(()=>{C.current&&K.current>0&&(C.current.scrollTop=K.current)});const ue=(g==null?void 0:g.sha)??"overview";if(!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Ready to build something?"}),e.jsx("button",{onClick:y,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Start Building"})]})});if(F==="candidate")return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-5 px-8 text-center max-w-[420px]",children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Migrate Your Project"}),e.jsx("p",{className:"text-sm text-gray-400 m-0 font-['IBM_Plex_Sans'] leading-relaxed",children:"It looks like you have an existing project. Claude can survey your codebase and systematically migrate it — deconstructing pages into clean components, extracting functions with tests, and creating scenarios. One page per session."}),e.jsx("button",{onClick:N,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Get Started"}),e.jsx("button",{onClick:y,className:"text-xs text-gray-500 hover:text-gray-300 bg-transparent border-none p-0 cursor-pointer underline",children:"Skip — build a new feature instead"})]})});if(F==="active"&&_){const P=_.pages||[],R=P.filter($=>$.status==="complete").length,J=P.length,V=J>0?Math.round(R/J*100):0;return e.jsxs("div",{className:"flex-1 flex flex-col overflow-auto p-4",children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0 mb-3",children:"Project Migration"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"flex items-center gap-2 mb-1",children:e.jsxs("span",{className:"text-xs text-gray-400 font-['IBM_Plex_Sans']",children:[R,"/",J," pages (",V,"%)"]})}),e.jsx("div",{className:"w-full h-1.5 bg-[#2d2d2d] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-[#005c75] rounded-full transition-all",style:{width:`${V}%`}})})]}),e.jsx("div",{className:"space-y-1.5",children:P.map(($,se)=>{const ne=$.status==="complete"?"✓":$.status==="in-progress"?"→":"○",G=$.status==="complete"?"text-green-400":$.status==="in-progress"?"text-cyan-400":"text-gray-600";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-xs ${G} w-3 text-center`,children:ne}),e.jsx("span",{className:`text-xs font-['IBM_Plex_Sans'] ${$.status==="in-progress"?"text-white font-medium":$.status==="complete"?"text-gray-400":"text-gray-600"}`,children:$.name}),e.jsx("span",{className:"text-[10px] text-gray-600",children:$.route}),$.status==="complete"&&e.jsxs("span",{className:"text-[10px] text-gray-600",children:[($.extractedComponents||[]).length,"c"," ",($.extractedFunctions||[]).length,"f"," ",$.scenarioCount||0,"s"]})]},se)})}),(_.sharedComponents||[]).length>0&&e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-xs font-medium text-gray-400 font-['IBM_Plex_Sans'] mb-1.5",children:"Shared Components"}),(_.sharedComponents||[]).map(($,se)=>e.jsxs("div",{className:"text-[10px] text-gray-500 mb-0.5",children:[$.name," ",e.jsxs("span",{className:"text-gray-600",children:["— used in: ",($.usedInPages||[]).join(", ")]})]},se))]}),e.jsx("div",{className:"mt-4",children:e.jsx("button",{onClick:y,className:"px-4 py-2 bg-[#005c75] text-white text-xs font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Continue in Chat"})})]})}if(!(s.length>0||T.length>0))return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 px-8 text-center",children:[O?e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:O}),L&&e.jsx("p",{className:"text-sm text-gray-400 m-0 font-['IBM_Plex_Sans'] leading-relaxed",children:L})]}):e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Your project is ready"}),e.jsx("p",{className:"text-sm text-gray-400 m-0 font-['IBM_Plex_Sans'] leading-relaxed",children:"Describe what you want to build in the Chat and your pages and components will appear here."}),e.jsx("button",{onClick:y,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Start Building"})]})});if(g){const P=g.filePath,R=g.name,J=a.some(u=>u.sha===g.sha||u.filePath===P),V=!!((Z=f==null?void 0:f[R])!=null&&Z.length);if(!J&&!V){s.some(D=>D.componentName===R&&D.entitySha===g.sha);const u=s.filter(D=>D.entitySha===g.sha),z=[`The "${g.displayName}" entity (${P}) exists in the database but has not been fully analyzed. Its components and functions cannot be shown until it has import metadata.`,"","Follow these steps:","",`Step 1: Add "${R}" to the glossary if it's not already there:`,` Check: cat .codeyam/glossary.json | grep "${R}"`,"",` If not found, add an entry with name "${R}" and filePath "${P}" to .codeyam/glossary.json`,"","Step 2: Run import analysis:"," codeyam editor analyze-imports","","Step 3: Reload the editor page and verify components/functions appear."].join(`
47
+ `);return e.jsx("div",{ref:C,onScroll:he,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsx(St,{items:M,onNavigate:I}),e.jsx("h2",{className:"text-sm font-semibold text-white m-0 font-['IBM_Plex_Sans'] uppercase tracking-wider",children:g.displayName}),P&&e.jsx(Se,{filePath:P,projectRoot:o}),e.jsxs("div",{className:"py-2",children:[e.jsx("p",{className:"text-[11px] text-amber-400/80 m-0 leading-relaxed",children:"This entity has not been fully analyzed. Its components and functions cannot be displayed. Please copy and paste this prompt into Claude to fix the data."}),e.jsx("div",{className:"mt-2",children:e.jsx(pe,{content:z,label:"Copy Fix Prompt",copiedLabel:"Copied!",className:"text-[10px] text-amber-400 hover:text-amber-300 bg-transparent border border-amber-400/30 rounded px-2 py-1 cursor-pointer transition-colors"})})]}),u.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-2",children:u.map(D=>e.jsx(xe,{scenarioId:D.id,updatedAt:D.updatedAt,hasScreenshot:!!D.screenshotPath,name:D.name,isActive:D.id===l,onSelect:()=>m(D)},D.id))})]})},ue)}const $=g.sha,se=s.filter(u=>!u.componentName&&(u.pageFilePath===P||$&&u.entitySha===$)),ne=s.filter(u=>u.componentName===R||u.componentPath===P),G=T.find(u=>u.filePath===P||u.name===R),le=A.get(R)||c.find(u=>u.filePath===P),ae=[...se,...ne],re=new Set((f==null?void 0:f[R])||[]),ge=V?[...p.entries()].filter(([u])=>re.has(u)):[],Pe=V?T.filter(u=>re.has(u.name)&&!ge.some(([z])=>z===u.name)):[],Ee=V?r.filter(u=>re.has(u.name)&&u.returnType!=="JSX.Element"&&u.returnType!=="React.ReactNode").map(u=>({name:u.name,filePath:u.filePath,description:u.description||"",testFile:u.testFile,feature:u.feature})):[],je=ge.length>0||Pe.length>0,Q=Ee.length>0,q=je||Q;return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsx(St,{items:M,onNavigate:I}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-white m-0 font-['IBM_Plex_Sans'] uppercase tracking-wider",children:g.displayName}),g.filePath&&e.jsx(Se,{filePath:g.filePath,projectRoot:o})]}),ae.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-2",children:ae.map(u=>e.jsx(xe,{scenarioId:u.id,updatedAt:u.updatedAt,hasScreenshot:!!u.screenshotPath,name:u.name,isActive:u.id===l,onSelect:()=>m(u)},u.id))}),G&&(G.scenarios.length>0||G.pendingScenarios.length>0)&&e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[G.scenarios.map(u=>e.jsx(xe,{imgSrc:u.screenshotPath?`/api/screenshot/${u.screenshotPath}`:null,name:u.name,isActive:!1,onSelect:()=>v({analysisId:G.analysisId,scenarioId:u.id,scenarioName:u.name,entitySha:G.sha,entityName:G.name})},u.id)),G.pendingScenarios.map(u=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:u,children:u},u))]}),le&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-gray-500",children:"Tests:"}),e.jsx(Se,{filePath:le.testFile,projectRoot:o})]}),ae.length===0&&!G&&!le&&e.jsx("div",{className:"text-xs text-gray-500",children:"No scenarios for this entity"}),ae.length>0&&e.jsx(sa,{scenarios:ae,entityName:g.displayName,entityFilePath:g.filePath,entityType:g.entityType,onSwitchToBuild:y,onScenarioSelect:m}),q&&e.jsxs("div",{className:"pt-3 mt-2 border-t border-[#3d3d3d] space-y-3",children:[je&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),ge.map(([u,z])=>e.jsx("div",{className:"mt-3",children:x.has(u)?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>I(u,x.get(u)),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:u})}),z.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-2 pt-1",children:z.map(D=>e.jsx(xe,{scenarioId:D.id,updatedAt:D.updatedAt,hasScreenshot:!!D.screenshotPath,name:D.name,isActive:D.id===l,onSelect:()=>m(D)},D.id))})]}):e.jsxs("div",{className:"py-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-500",children:u}),e.jsx("p",{className:"text-[10px] text-amber-400/80 m-0 mt-1.5 leading-relaxed",children:"There is data missing that is required to show the scenarios for this component. Please copy and paste this prompt into Claude to ask Claude to fix the data."}),e.jsx("div",{className:"mt-1.5",children:e.jsx(kt,{name:u,scenarios:z})})]})},u)),Pe.map(u=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>I(u.name,u.sha),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:u.name})}),(u.scenarios.length>0||u.pendingScenarios.length>0)&&e.jsxs("div",{className:"grid grid-cols-3 gap-2 pt-1",children:[u.scenarios.map(z=>e.jsx(xe,{imgSrc:z.screenshotPath?`/api/screenshot/${z.screenshotPath}`:null,name:z.name,isActive:!1,onSelect:()=>v({analysisId:u.analysisId,scenarioId:z.id,scenarioName:z.name,entitySha:u.sha,entityName:u.name})},z.id)),u.pendingScenarios.map(z=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:z,children:z},z))]})]},u.sha))]}),Q&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"}),Ee.map(u=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>I(u.name,x.get(u.name)),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:u.name})}),e.jsx(Se,{filePath:u.filePath,projectRoot:o}),u.testFile&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-600",children:"test:"}),e.jsx("span",{className:"text-[9px] text-gray-500 truncate",children:u.testFile})]})]},u.name))]})]})]})})}return e.jsx("div",{ref:C,onScroll:he,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-4",children:[O&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-white m-0 font-['IBM_Plex_Sans']",children:O}),L&&e.jsx("p",{className:"text-xs text-gray-400 m-0 mt-1 font-['IBM_Plex_Sans'] leading-relaxed",children:L})]}),k.length>1&&e.jsx(ta,{brokenEntities:k}),U.size>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),e.jsx("button",{onClick:y,className:"px-2.5 py-1 text-[10px] font-medium text-gray-400 bg-[#2a2a2a] border border-[#4d4d4d] rounded hover:bg-[#333] hover:text-white hover:border-[#005c75] transition-colors cursor-pointer",children:"+ New Page"})]}),e.jsxs("p",{className:"text-[11px] text-gray-500 m-0 mt-1.5 font-['IBM_Plex_Sans'] leading-relaxed",children:["Select a page scenario below and switch to"," ",e.jsx("button",{onClick:y,className:"text-[#00a0c4] hover:text-[#00c4eb] bg-transparent border-none p-0 cursor-pointer underline font-inherit text-inherit",children:"Build"})," ","to change or enhance an existing page or"," ",e.jsx("button",{onClick:y,className:"text-[#00a0c4] hover:text-[#00c4eb] bg-transparent border-none p-0 cursor-pointer underline font-inherit text-inherit",children:"create a new page"})]}),[...U.entries()].sort(([P],[R])=>P==="Home"?-1:R==="Home"?1:P.localeCompare(R)).map(([P,R])=>{var J,V;return e.jsx("div",{className:"mt-2",children:x.has(P)&&w(x.get(P))?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>I(P,x.get(P)),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:P})}),(((J=R[0])==null?void 0:J.pageFilePath)||B[P])&&e.jsx(Se,{filePath:((V=R[0])==null?void 0:V.pageFilePath)||B[P],projectRoot:o}),e.jsx("div",{className:"grid grid-cols-3 gap-2 pt-1",children:R.map($=>e.jsx(xe,{scenarioId:$.id,updatedAt:$.updatedAt,hasScreenshot:!!$.screenshotPath,name:$.name,isActive:$.id===l,onSelect:()=>m($)},$.id))})]}):e.jsxs("div",{className:"py-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-500",children:P}),e.jsx("p",{className:"text-[10px] text-amber-400/80 m-0 mt-1.5 leading-relaxed",children:"There is data missing that is required to show the scenarios for this page. Please copy and paste this prompt into Claude to ask Claude to fix the data."}),e.jsx("div",{className:"mt-1.5",children:e.jsx(kt,{name:P,scenarios:R,reason:x.has(P)?"incomplete":"missing"})})]})},P)})]})]})},ue)}const Ct={new:0,edited:1,impacted:2};function Pt({status:t,onClick:s}){const a={new:{label:"New",bg:"bg-green-100",text:"text-green-700",border:"border-green-200"},edited:{label:"Edited",bg:"bg-blue-100",text:"text-blue-700",border:"border-blue-200"},impacted:{label:"Impacted",bg:"bg-amber-100",text:"text-amber-700",border:"border-amber-200"}}[t.status],n=s&&(t.status==="edited"||t.status==="impacted");return e.jsx("button",{onClick:n?s:void 0,className:`${a.bg} ${a.text} ${a.border} border text-[9px] font-bold px-1.5 py-0.5 rounded-full uppercase tracking-wider shrink-0 ${n?"cursor-pointer hover:opacity-80 transition-opacity":"cursor-default"}`,children:a.label})}function Et({filePath:t}){const[s,a]=i.useState(null),[n,c]=i.useState(!0),[r,o]=i.useState(null);return i.useEffect(()=>{Xe(()=>import("./index-Blo6EK8G.js"),__vite__mapDeps([0,1,2])).then(l=>{o(()=>l.default)})},[]),i.useEffect(()=>{c(!0),fetch(`/api/editor-file-diff?path=${encodeURIComponent(t)}`).then(l=>l.json()).then(l=>{a({oldContent:l.oldContent,newContent:l.newContent})}).catch(()=>{a(null)}).finally(()=>c(!1))},[t]),n?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Loading diff..."}):!s||!r?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Could not load diff"}):e.jsx("div",{className:"mt-2 border border-gray-200 rounded-lg overflow-hidden max-h-[300px] overflow-auto text-xs",children:e.jsx(r,{oldValue:s.oldContent,newValue:s.newContent,splitView:!1,useDarkTheme:!1,showDiffOnly:!0,styles:{contentText:{fontSize:"11px",lineHeight:"1.4"},line:{padding:"1px 8px",fontSize:"11px"}}})})}function Mt({impactedBy:t,changedEntities:s}){return e.jsx("div",{className:"mt-2 bg-amber-50 border border-amber-200 rounded-lg p-2.5",children:t&&t.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wider",children:"Re-captured because these dependencies changed"}),e.jsx("ul",{className:"mt-1.5 space-y-1",children:t.map(a=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold px-1 py-0 rounded-full uppercase tracking-wider border ${a.changeType==="new"?"bg-green-100 text-green-700 border-green-200":"bg-blue-100 text-blue-700 border-blue-200"}`,children:a.changeType==="new"?"New":"Edited"}),e.jsx("span",{className:"text-[11px] font-medium text-amber-800",children:a.name}),e.jsx("span",{className:"text-[9px] text-amber-500 truncate",children:a.filePath})]},a.filePath))})]}):s&&s.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wider",children:"Unchanged — these entities were modified in this session"}),e.jsx("ul",{className:"mt-1.5 space-y-1",children:s.map(a=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold px-1 py-0 rounded-full uppercase tracking-wider border ${a.status==="new"?"bg-green-100 text-green-700 border-green-200":"bg-blue-100 text-blue-700 border-blue-200"}`,children:a.status==="new"?"New":"Edited"}),e.jsx("span",{className:"text-[11px] font-medium text-amber-800",children:a.name})]},a.name))})]}):e.jsx("span",{className:"text-[10px] text-amber-600",children:"This component was re-captured because a dependency changed"})})}function It({scenarioId:t,name:s,isActive:a,onSelect:n,updatedAt:c}){const r=i.useRef(null);return i.useEffect(()=>{a&&r.current&&r.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[a]),e.jsxs("button",{ref:r,onClick:n,className:"flex flex-col items-center gap-1.5 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-32 h-32 rounded-lg overflow-hidden border-2 transition-all ${a?"border-[#0ea5e9] ring-2 ring-[#0ea5e9]/40 shadow-lg shadow-[#0ea5e9]/20":"border-gray-200 hover:border-gray-400 shadow-sm"}`,children:e.jsx(Ae,{scenarioId:t,updatedAt:c,alt:s,className:"w-full h-full bg-white",imgClassName:"w-full h-full object-contain bg-white"})}),e.jsx("span",{className:`text-[11px] leading-tight text-center truncate w-32 font-medium ${a?"text-gray-900":"text-gray-600 group-hover:text-gray-900"}`,children:s})]})}function na({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-400 hover:text-gray-600 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(pe,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors"})]}):null}function ra({testFile:t,entityName:s}){const{results:a,isRunning:n,runTests:c}=Qe(t);if(n&&!a)return e.jsxs("div",{className:"pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#0ea5e9] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-400",children:"Running tests..."})]});if(!a)return null;if(a.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-500",children:a.errorMessage})});const r=s?a.testCases.filter(m=>m.fullName.startsWith(s)):a.testCases,o=r.length>0?r:a.testCases;if(o.length===0)return null;const l=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[o.map(m=>{var y;const v=l&&m.fullName.startsWith(l)?m.fullName.slice(l.length):m.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[m.status==="passed"?e.jsx("span",{className:"text-green-600 text-[10px]",children:"✓"}):m.status==="failed"?e.jsx("span",{className:"text-red-500 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-400 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${m.status==="passed"?"text-green-600":m.status==="failed"?"text-red-500":"text-gray-400"}`,children:v})]}),m.status==="failed"&&((y=m.failureMessages)==null?void 0:y.map((S,g)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400 truncate max-w-full",title:S,children:S.split(`
48
+ `)[0]},g)))]},m.fullName)}),e.jsx("button",{onClick:c,disabled:n,className:"mt-1 text-[10px] text-[#0ea5e9] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:n?"Running...":"Re-run"})]})}function Tt(t){const s=t.indexOf(" - ");return s!==-1?t.slice(s+3):t}function Rt(t,s){return!s||Object.keys(s).length===0?t:[...t].sort(([a],[n])=>{var l,m;const c=((l=s[a])==null?void 0:l.status)||"impacted",r=((m=s[n])==null?void 0:m.status)||"impacted",o=(Ct[c]??2)-(Ct[r]??2);return o!==0?o:a.localeCompare(n)})}function ia({scenarios:t,allScenarios:s=[],glossaryFunctions:a=[],projectRoot:n,activeScenarioId:c,onScenarioSelect:r,onClose:o,entityChangeStatus:l={},modifiedFiles:m=[],featureName:v,userPrompt:y}){const S=i.useMemo(()=>{if(s.length===0||Object.keys(l).length===0)return t;const x=new Set(t.map(h=>h.id)),b=s.filter(h=>{var k,T;if(x.has(h.id))return!1;const w=h.componentName||h.displayName||((k=h.pageFilePath)!=null&&k.startsWith("app/")?Ce(ke(h.pageFilePath)):$e(h.url));return((T=l[w])==null?void 0:T.status)==="impacted"});return b.length===0?t:[...t,...b]},[t,s,l]),g=i.useMemo(()=>Object.entries(l).filter(([,x])=>x.status==="new"||x.status==="edited").map(([x,b])=>({name:x,status:b.status})),[l]),[I,f]=i.useState(null),B=i.useCallback(x=>{f(b=>b===x?null:x)},[]),{pageGroups:O,componentGroups:L}=i.useMemo(()=>_t(S),[S]),F=i.useMemo(()=>Rt([...O.entries()],l),[O,l]),_=i.useMemo(()=>Rt([...L.entries()],l),[L,l]),N=F,M=_,U=i.useMemo(()=>Rs(a,l),[a,l]),p=i.useMemo(()=>{const x=[];for(const[,b]of N)x.push(...b);for(const[,b]of M)x.push(...b);return x},[N,M]);return i.useEffect(()=>{if(p.length===0)return;const x=b=>{var T;if(b.key!=="ArrowLeft"&&b.key!=="ArrowRight")return;const h=(T=b.target)==null?void 0:T.tagName;if(h==="INPUT"||h==="TEXTAREA"||h==="SELECT")return;b.preventDefault();const w=p.findIndex(A=>A.id===c);let k;b.key==="ArrowLeft"?k=w<=0?p.length-1:w-1:k=w>=p.length-1?0:w+1,r(p[k])};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[p,c,r]),S.length===0&&a.length===0?e.jsxs("div",{className:"h-full bg-white flex items-center justify-center relative",children:[e.jsx("button",{onClick:o,className:"absolute top-2 right-3 text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none",title:"Close results",children:"×"}),e.jsx("span",{className:"text-sm text-gray-400",children:"No scenarios registered yet"})]}):e.jsxs("div",{className:"h-full bg-white flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-gray-200 shrink-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Working Session Results"}),v&&e.jsx("div",{className:"text-[11px] text-gray-400 truncate",title:v,children:v})]}),e.jsx("button",{onClick:o,className:"text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none shrink-0",title:"Close results",children:"×"})]}),y&&e.jsx(At,{text:y,theme:"light"}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsxs("div",{className:"space-y-5",children:[N.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),e.jsx("div",{className:"space-y-3 pl-1",children:N.map(([x,b])=>{var T;const h=l[x],w=I===x,k=(T=b[0])==null?void 0:T.componentPath;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:x}),h&&e.jsx(Pt,{status:h,onClick:()=>B(x)})]}),w&&(h==null?void 0:h.status)==="edited"&&k&&e.jsx(Et,{filePath:k}),w&&(h==null?void 0:h.status)==="impacted"&&e.jsx(Mt,{impactedBy:h.impactedBy,changedEntities:g}),e.jsx("div",{className:"flex flex-wrap gap-3",children:b.map(A=>e.jsx(It,{scenarioId:A.id,name:Tt(A.name),isActive:A.id===c,onSelect:()=>r(A),updatedAt:A.updatedAt},A.id))})]},x)})})]}),M.length>0&&e.jsxs("div",{className:N.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),e.jsx("div",{className:"space-y-3 pl-1",children:M.map(([x,b])=>{var T;const h=l[x],w=I===x,k=(T=b[0])==null?void 0:T.componentPath;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:x}),h&&e.jsx(Pt,{status:h,onClick:()=>B(x)})]}),w&&(h==null?void 0:h.status)==="edited"&&k&&e.jsx(Et,{filePath:k}),w&&(h==null?void 0:h.status)==="impacted"&&e.jsx(Mt,{impactedBy:h.impactedBy,changedEntities:g}),e.jsx("div",{className:"flex flex-wrap gap-3",children:b.map(A=>e.jsx(It,{scenarioId:A.id,name:Tt(A.name),isActive:A.id===c,onSelect:()=>r(A),updatedAt:A.updatedAt},A.id))})]},x)})})]}),U.length>0&&e.jsxs("div",{className:N.length>0||M.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),e.jsx("div",{className:"space-y-2 pl-1",children:U.map(x=>e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-700",children:x.name})}),e.jsx(na,{filePath:x.filePath,projectRoot:n}),x.testFile?e.jsx(ra,{testFile:x.testFile,entityName:x.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-400",children:"No test file"})})]},x.name))})]}),m.length>0&&e.jsxs("div",{className:N.length>0||M.length>0||U.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsxs("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:["Modified Files (",m.length,")"]})}),e.jsx("div",{className:"space-y-0.5 pl-1 max-h-[200px] overflow-auto",children:m.map(x=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold uppercase w-[14px] text-center ${x.status==="added"||x.status==="untracked"?"text-green-600":x.status==="modified"?"text-blue-600":x.status==="renamed"?"text-purple-600":"text-gray-400"}`,children:x.status==="added"||x.status==="untracked"?"A":x.status==="modified"?"M":x.status==="renamed"?"R":"?"}),e.jsx("span",{className:"text-[10px] text-gray-500 truncate font-mono",children:x.path})]},x.path))})]})]})})]})}const oa=[{key:"app",label:"App"},{key:"build",label:"Build"},{key:"data",label:"Structure"},{key:"journal",label:"Journal"}];function la({activeTab:t,onTabChange:s,buildIdle:a,panelLayout:n,onToggleExpand:c}){return e.jsxs("div",{className:"bg-[#3d3d3d] h-10 flex items-center px-3 gap-3 shrink-0 z-20 border-b border-[#2d2d2d]",children:[e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("img",{src:Is,alt:"CodeYam",className:"h-5 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-xs whitespace-nowrap",children:"Codeyam Editor"})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("div",{className:"flex items-center gap-0.5 bg-[#4a3232] rounded-lg p-0.5",children:oa.map(r=>e.jsxs("button",{onClick:()=>s(r.key),className:`px-2.5 py-1 text-xs font-medium rounded-md transition-colors cursor-pointer ${t===r.key?"bg-[#7a4444] text-white":"text-gray-300 hover:text-white"}`,children:[r.label,r.key==="build"&&a&&t!=="build"&&e.jsx("span",{className:"ml-1 inline-block w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"})]},r.key))}),c&&e.jsx("button",{onClick:c,className:"p-1.5 rounded text-gray-400 hover:text-white transition-colors cursor-pointer",title:n==="editor-only"?"Show preview":"Hide preview",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:n==="editor-only"?e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M9 3v18"}),e.jsx("path",{d:"M16 15l-3-3 3-3"})]}):e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M9 3v18"}),e.jsx("path",{d:"M14 9l3 3-3 3"})]})})})]})]})}function ca({preview:t,onDismiss:s,onLoadCommit:a}){return e.jsxs("div",{className:"flex flex-col items-center gap-6 max-w-[700px] w-full",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-lg font-semibold text-[#333] m-0 font-['IBM_Plex_Sans']",children:"Journal Screenshot"}),e.jsx("p",{className:"text-sm text-[#888] mt-1 m-0 font-['IBM_Plex_Sans']",children:"This is a snapshot from a previous version — not a live preview"})]}),e.jsx("div",{className:"rounded-lg overflow-hidden border-2 border-[#ccc] shadow-md max-w-full w-fit",children:e.jsx("img",{src:t.screenshotUrl,alt:t.scenarioName,className:"max-w-full h-auto block"})}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#666]",children:[t.commitSha&&e.jsx("span",{className:"font-mono text-xs text-[#00a0c4] bg-[#00a0c4]/15 px-2 py-0.5 rounded",children:t.commitSha.slice(0,7)}),e.jsxs("span",{className:"truncate",children:[t.scenarioName,t.commitMessage&&` — ${t.commitMessage}`]})]}),e.jsx("div",{className:"flex items-center gap-3",children:t.commitSha&&a&&e.jsx(da,{commitSha:t.commitSha,onLoadCommit:a})})]})}function da({commitSha:t,onLoadCommit:s}){const[a,n]=i.useState(!1),[c,r]=i.useState(null);return e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{n(!0),r(null),s(t).then(o=>{o.success||r(o.error||"Failed to load commit")}).catch(o=>{r(o instanceof Error?o.message:"Network error")}).finally(()=>n(!1))},disabled:a,className:"bg-[#005c75] hover:bg-[#004d63] disabled:opacity-50 text-white text-sm font-medium px-4 py-1.5 rounded transition-colors cursor-pointer",children:a?"Reverting...":"Revert to this code and load this version"}),c&&e.jsx("div",{className:"bg-red-50 border border-red-200 rounded px-4 py-2 text-sm text-red-600 w-full text-center",children:c})]})}function ma({analysisId:t,scenarioId:s,scenarioName:a,entityName:n,projectSlug:c,onStateChange:r}){const{interactiveServerUrl:o,isStarting:l,isLoading:m}=Ts({analysisId:t,scenarioId:s,scenarioName:a,entityName:n,projectSlug:c,enabled:!0});return i.useEffect(()=>{r(o,l||m)},[o,l,m,r]),null}function xa({onSaveToCurrent:t,onSaveAsNew:s,onDismiss:a,isSaving:n}){return e.jsxs("div",{className:"flex items-center justify-between px-4 py-1.5 bg-emerald-900/60 border-b border-emerald-700/50 text-emerald-200 text-xs",children:[e.jsx("span",{className:"font-medium",children:"Data modified."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:t,disabled:n,className:"px-2.5 py-0.5 bg-emerald-600 hover:bg-emerald-500 disabled:opacity-50 text-white text-xs font-medium rounded transition-colors cursor-pointer disabled:cursor-not-allowed",children:n?"Saving...":"Save to Scenario"}),e.jsx("button",{onClick:s,disabled:n,className:"px-2.5 py-0.5 bg-emerald-800 hover:bg-emerald-700 disabled:opacity-50 text-emerald-200 text-xs font-medium rounded transition-colors cursor-pointer disabled:cursor-not-allowed",children:"Save as New"}),e.jsx("button",{onClick:a,disabled:n,className:"text-emerald-400 hover:text-emerald-200 disabled:opacity-50 transition-colors cursor-pointer disabled:cursor-not-allowed",title:"Dismiss",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}function pa(t,s){return s.status==="error"?{url:null,proxyUrl:null,isStarting:!1,error:s.errorMessage||"Dev server crashed",canStartServer:t.canStartServer,autoStartAttempted:t.autoStartAttempted,shouldAutoStart:!1}:s.url?{url:s.url,proxyUrl:s.proxyUrl||null,isStarting:!1,error:null,canStartServer:!0,autoStartAttempted:t.autoStartAttempted,shouldAutoStart:!1}:s.status==="starting"?{...t,isStarting:!0,error:null,canStartServer:!0,shouldAutoStart:!1}:s.status==="stopped"?t.url?{...t,url:null,isStarting:!1,shouldAutoStart:!1}:t.autoStartAttempted?{...t,isStarting:!1,shouldAutoStart:!1}:{...t,autoStartAttempted:!0,shouldAutoStart:!0}:{...t,shouldAutoStart:!1}}function ha(t){const[s,a]=i.useState({url:null,proxyUrl:null,isStarting:!1,error:null,canStartServer:!0,autoStartAttempted:!1}),n=i.useRef(s);n.current=s,i.useEffect(()=>{let o=!1,l=null;const m=async()=>{try{const v=await fetch("/api/editor-dev-server");if(o)return;const y=await v.json(),S=pa(n.current,y),{shouldAutoStart:g,...I}=S;if(a(I),g&&!(t!=null&&t.skipAutoStart))try{const f=await fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})});if(o)return;f.ok?a(B=>({...B,isStarting:!0})):a(B=>({...B,canStartServer:!1}))}catch{}}catch{}};return m(),l=setInterval(()=>void m(),2e3),()=>{o=!0,l&&clearInterval(l)}},[s.url]);const c=i.useCallback(()=>{a(o=>({...o,error:null,isStarting:!0})),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restart"})}).catch(()=>{})},[]),r=i.useCallback(()=>{a(o=>({...o,error:null,isStarting:!0})),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})}).catch(()=>{})},[]);return{devServerUrl:s.url,proxyUrl:s.proxyUrl,isStarting:s.isStarting,error:s.error,canStartServer:s.canStartServer,retryServer:c,startServer:r}}function ua(t){const s=i.useRef(null),a=i.useRef(null);i.useEffect(()=>{if(typeof document>"u")return;a.current||(a.current=document.createElement("canvas"),a.current.width=64,a.current.height=64);const n=document.querySelector('link[rel="icon"]');if(!n)return;if(s.current||(s.current=n.href),!t){n.href=s.current;return}const c=new Image;c.crossOrigin="anonymous",c.onload=()=>{const r=a.current,o=r.getContext("2d");o.clearRect(0,0,64,64);const l=56,m=(64-l)/2;o.drawImage(c,m,m,l,l);const v=12,y=64-v-1,S=v+1;o.beginPath(),o.arc(y,S,v+3,0,2*Math.PI),o.fillStyle="#ffffff",o.fill(),o.beginPath(),o.arc(y,S,v,0,2*Math.PI),o.fillStyle="#ef4444",o.fill(),n.href=r.toDataURL("image/png")},c.src=s.current},[t]),i.useEffect(()=>()=>{if(typeof document>"u")return;const n=document.querySelector('link[rel="icon"]');n&&s.current&&(n.href=s.current)},[])}function Ma({currentUrl:t,nextUrl:s,formMethod:a,defaultShouldRevalidate:n}){return a||t.pathname===s.pathname?n:t.pathname.startsWith("/editor")&&s.pathname.startsWith("/editor")?!1:n}const Ia=()=>[{title:"Editor - CodeYam"},{name:"description",content:"CodeYam Code + Data Editor"}];class fa extends i.Component{constructor(){super(...arguments);jt(this,"state",{error:null,errorInfo:null})}static getDerivedStateFromError(a){return{error:a,errorInfo:null}}componentDidCatch(a,n){console.error("[EditorErrorBoundary] Error:",a.message),console.error("[EditorErrorBoundary] Component stack:",n.componentStack),console.error("[EditorErrorBoundary] Loader snapshot:",JSON.stringify(this.props.loaderSnapshot,null,2)),this.setState({errorInfo:n})}render(){var a;return this.state.error?e.jsx("div",{className:"fixed inset-0 bg-[#1e1e1e] flex items-center justify-center p-8",children:e.jsxs("div",{className:"max-w-[600px] w-full space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-red-400 font-['IBM_Plex_Sans'] m-0",children:"Something went wrong"}),e.jsx("pre",{className:"text-xs text-gray-300 bg-[#2d2d2d] p-3 rounded overflow-auto max-h-[120px]",children:this.state.error.message}),((a=this.state.errorInfo)==null?void 0:a.componentStack)&&e.jsxs("details",{className:"text-xs text-gray-500",children:[e.jsx("summary",{className:"cursor-pointer hover:text-gray-300 transition-colors",children:"Component stack"}),e.jsx("pre",{className:"mt-2 bg-[#2d2d2d] p-3 rounded overflow-auto max-h-[200px] text-yellow-300",children:this.state.errorInfo.componentStack})]}),e.jsx("p",{className:"text-xs text-gray-500 m-0",children:"Full diagnostics are in the browser console."}),e.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-[#005c75] text-white text-sm rounded hover:bg-[#004d63] transition-colors cursor-pointer",children:"Reload"})]})}):this.props.children}}const Ta=xs(function(){const{projectSlug:s,projectRoot:a,hasProject:n,scenarios:c,allScenarios:r,analyzedEntities:o,allEntities:l,glossaryFunctions:m,glossaryEntries:v,entityImports:y,pageFilePaths:S,entityChangeStatus:g,modifiedFiles:I,featureName:f,userPrompt:B,projectTitle:O,projectDescription:L,defaultScreenSize:F,screenSizes:_,editorStep:N,editorStepLabel:M,claudeSessionId:U,focusedEntitySha:p,newerEntitySha:x,focusedEntity:b,migrationMode:h,migrationState:w}=ps(),[k,T]=hs(),A=us(),C=i.useRef(null),K=i.useRef(null),he=i.useRef(null),[ue,fe]=i.useState(p);i.useEffect(()=>{fe(p)},[p]);const Z=i.useMemo(()=>ea(ue,l,r),[ue,l,r]),P=(Z==null?void 0:Z.displayName)??void 0,R=k.get("scenario")||void 0,[J,V]=i.useState(()=>P?[P]:[]),$=i.useRef(null),se=i.useRef([]),ne=i.useRef(null);i.useEffect(()=>{var H;const d=R||((H=ys(r))==null?void 0:H.id);if(!vs(d,$.current))return;const j=r.find(te=>te.id===d);if(!j)return;$.current=d;const E=qe(j,se.current,ne.current);E&&ce(E);const W=Ye(j.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:W,scenarioId:j.id,scenarioName:j.name,scenarioType:j.type})}).catch(()=>{})},[R,r]),i.useEffect(()=>{const d=new BroadcastChannel("codeyam-editor");return d.onmessage=j=>{var E;if(((E=j.data)==null?void 0:E.type)==="switch-scenario"&&j.data.scenarioId){const W=j.data.scenarioId,H=r.find(Ge=>Ge.id===W);if(!H)return;$.current=W;const te=new URLSearchParams(k);te.set("scenario",W),te.delete("zoom"),T(te),u(null),D(null),ie(null),ye(!0);const Ve=Ye(H.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:Ve,scenarioId:W,scenarioType:H.type})}).then(()=>{Q(!1),Ie(Ge=>Ge+1)}).catch(()=>{ye(!1)})}},()=>d.close()},[k,T,r]),i.useEffect(()=>{if(k.get("ref")!=="link"||!R)return;const d=new BroadcastChannel("codeyam-editor");d.postMessage({type:"switch-scenario",scenarioId:R}),d.close(),window.close()},[]);const{devServerUrl:G,proxyUrl:le,isStarting:ae,error:re,canStartServer:ge,retryServer:Pe,startServer:Ee}=ha({skipAutoStart:h==="candidate"||h==="active"}),[je,Q]=i.useState(!1),[q,u]=i.useState(null),[z,D]=i.useState(null),[_e,Ze]=i.useState(!1),[Le,ie]=i.useState(null),Ft=i.useCallback(async d=>{const E=await(await fetch("/api/editor-load-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitSha:d})})).json();return E.success&&(ie(null),Q(!1)),E},[]),Dt=i.useCallback((d,j)=>{D(E=>(d&&d!==E&&Q(!1),d)),!j&&d&&Q(!0),Ze(j)},[]),et=i.useCallback(d=>{ie(null),u(E=>(E&&E.analysisId===d.analysisId||(D(null),Ie(H=>H+1)),d)),Ze(!0),Q(!1);const j=new URLSearchParams(k);j.delete("scenario"),j.delete("zoom"),T(j)},[k,T]),[Y,ce]=i.useState(F?{name:F.name,width:F.width,height:F.height}:{name:"Desktop",width:1440,height:900}),[tt,st]=i.useState(!1),at=F?{name:F.name,width:F.width,height:F.height}:null;ne.current=at;const nt=fs(),X=i.useMemo(()=>{const d=nt.pathname.split("/").filter(Boolean),j=d[d.length-1];return j==="build"||j==="journal"?j:j==="structure"?"data":"app"},[nt.pathname]),ee=i.useCallback(d=>{fe(null),V([]);const j=d==="app"?"":`/${d==="data"?"structure":d}`,E=k.get("scenario"),W=E?`?scenario=${E}`:"";A(`/editor${j}${W}`)},[A,k]),Bt=i.useCallback(()=>{ee("build"),de(!0)},[ee]),Ot=i.useCallback(()=>{ee("build"),de(!0),setTimeout(()=>{var d;(d=C.current)==null||d.sendInput("codeyam editor migrate")},300)},[ee]),[zt,de]=i.useState(X==="build"),Wt=!!(f&&N),[Me,Ut]=i.useState(Wt?"pending":"no-session");i.useEffect(()=>{Me==="pending"&&(ee("build"),de(!0))},[Me,ee]);const Ht=i.useCallback(()=>{Ut("continue")},[]),[Fe,De]=i.useState(!1),[Jt,rt]=i.useState(!1),Vt=i.useCallback(d=>{De(d),d&&rt(!1)},[]);ua(Fe);const[be,it]=i.useState("split"),[Be,ot]=i.useState(!1),Gt=i.useCallback(()=>{ot(!0),ee("build"),de(!0)},[ee]),lt=i.useCallback(()=>{ot(!1)},[]),qt=i.useCallback(d=>{ce(d),fetch("/api/editor-project-info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultScreenSize:d,skipBroadcast:!0})})},[]),[ct,dt]=i.useState(Ns);i.useEffect(()=>{const d=ws();dt(d),d.systemNotification&&typeof Notification<"u"&&Notification.permission==="default"&&Notification.requestPermission()},[]);const Yt=i.useCallback(d=>{dt(d),Ss(d)},[]);i.useEffect(()=>{if(X==="build"){De(!1);const d=setTimeout(()=>{var j,E;(j=C.current)==null||j.scrollToBottom(),(E=C.current)==null||E.focus()},50);return()=>clearTimeout(d)}},[X]),i.useEffect(()=>{function d(){!document.hidden&&X==="build"&&De(!1)}return document.addEventListener("visibilitychange",d),()=>document.removeEventListener("visibilitychange",d)},[X]);const[Oe,Kt]=i.useState(null);i.useEffect(()=>{const d=he.current;if(!d)return;const j=new ResizeObserver(E=>{const W=E[0];W&&Kt({width:W.contentRect.width,height:W.contentRect.height})});return j.observe(d),()=>j.disconnect()},[]);const me=i.useMemo(()=>Oe?ks(Oe,Y):1,[Oe,Y]),[ze,Ie]=i.useState(0),[mt,We]=i.useState(null),[xt,ye]=i.useState(!1),[Xt,Te]=i.useState(!1),[Qt,pt]=i.useState(!1),Zt=i.useCallback(()=>{Te(!0)},[]),ht=i.useCallback(async d=>{pt(!0);try{const E=await(await fetch("/api/editor-save-seed-state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:d})})).json();E.success?Te(!1):console.error("[editor] Save seed state failed:",E.error)}catch(j){console.error("[editor] Save seed state error:",j)}finally{pt(!1)}},[]),es=i.useCallback((d,j)=>{if(We(d||null),j){const E=new URLSearchParams(k);E.set("scenario",j),$.current=j,T(E);const W=r.find(H=>H.id===j);if(W){const H=qe(W,se.current,ne.current);H&&ce(H)}}ie(null),Q(!1),Ie(E=>E+1)},[k,T,r]),{customSizes:Ue,addCustomSize:ts,removeCustomSize:ss}=js(s),He=i.useMemo(()=>$s(_),[_]),Je=i.useMemo(()=>[...He,...Ue],[He,Ue]);se.current=Je;const ut=i.useMemo(()=>{const d=new Map;for(const j of l){d.set(j.name,j.sha);const E=Ce(ke(j.filePath));E!==j.name&&d.set(E,j.sha)}return d},[l]),as=i.useMemo(()=>{const d=[{name:"App"}];for(const j of J)d.push({name:j,componentName:j,entitySha:ut.get(j)});return d},[J,ut]),ft=i.useCallback((d,j)=>{if(!d){V([]),fe(null);const te=k.get("scenario"),Ve=te?`?scenario=${te}`:"";A(`/editor${Ve}`);return}if(!j){console.error(`[editor] No entity SHA for "${d}" — entity missing from database`);return}const E=J.indexOf(d);E>=0?V(J.slice(0,E+1)):V([...J,d]);const W=r.find(te=>te.entitySha===j);fe(j);const H=W?`?scenario=${W.id}`:"";A(`/editor/entity/${j}${H}`)},[A,r,J,k]),ve=i.useCallback(d=>{u(null),D(null),ie(null),We(null);const j=qe(d,Je,at);j&&ce(j),$.current=d.id;const E=new URLSearchParams(k);E.set("scenario",d.id),T(E),ye(!0),Te(!1);const W=Ye(d.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:W,scenarioId:d.id,scenarioType:d.type,skipBroadcast:!0})}).then(()=>{Q(!1),Ie(H=>H+1)}).catch(()=>{ye(!1)})},[k,T,Je]),ns=i.useCallback(d=>{if(!d.commitSha){const j=r.find(E=>E.name===d.scenarioName);if(j){ve(j);return}}ie(d)},[r,ve]),rs=d=>{const j={name:d.name,width:d.width,height:d.height};ce(j),fetch("/api/editor-project-info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultScreenSize:j,skipBroadcast:!0})})},is=(d,j,E)=>{ts(d,j,E)},os=d=>{ce(d),fetch("/api/editor-project-info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultScreenSize:d,skipBroadcast:!0})})},ls=()=>{q||Q(!0),ye(!1)},Ne=i.useMemo(()=>Cs({activeAnalyzedScenario:!!q,analyzedPreviewUrl:z,activeScenarioId:R||null,scenarios:r,proxyUrl:le,devServerUrl:G,zoomComponent:P||null}),[le,G,P,R,r,q,z]),gt=i.useMemo(()=>{const d=Ps(Ne,mt);if(!d)return null;const j=d.includes("?")?"&":"?";return`${d}${j}__cb=${ze}`},[Ne,mt,ze]),cs=i.useMemo(()=>({projectSlug:s,hasProject:n,scenarioCount:c==null?void 0:c.length,allScenarioCount:r==null?void 0:r.length,analyzedEntityCount:o==null?void 0:o.length,glossaryFunctionCount:m==null?void 0:m.length,entityChangeStatusKeys:g?Object.keys(g):[],featureName:f}),[s,n,c,r,o,m,g,f]);return e.jsxs(e.Fragment,{children:[e.jsx(fa,{loaderSnapshot:cs,children:e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[q&&e.jsx(ma,{analysisId:q.analysisId,scenarioId:q.scenarioId,scenarioName:q.scenarioName,entityName:q.entityName,projectSlug:s,onStateChange:Dt},q.analysisId),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",style:be==="editor-only"?{display:"none"}:void 0,children:[e.jsxs("div",{className:"bg-[#2d2d2d] border-b border-[#3d3d3d] shrink-0 z-10 h-10 flex items-center px-4 relative",children:[e.jsx("div",{className:"flex items-center gap-1 shrink-0 z-10",children:e.jsx("button",{onClick:()=>it(d=>d==="preview-only"?"split":"preview-only"),className:"p-1.5 rounded text-gray-500 hover:text-gray-300 transition-colors cursor-pointer",title:be==="preview-only"?"Show sidebar":"Hide sidebar",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M9 3v18"})]})})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center gap-1 pointer-events-none",children:e.jsxs("div",{className:"flex items-center gap-1 pointer-events-auto",children:[Re.map(d=>e.jsxs("button",{onClick:()=>rs(d),className:`p-1.5 rounded transition-colors cursor-pointer ${Y.name===d.name?"text-white bg-[#555]":"text-gray-500 hover:text-gray-300"}`,title:`${d.name} (${d.width}×${d.height})`,children:[d.name==="Desktop"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M8 21h8M12 17v4"})]}),d.name==="Laptop"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8H4V6z"}),e.jsx("path",{d:"M2 18h20"})]}),d.name==="Tablet"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2"}),e.jsx("path",{d:"M12 18h.01"})]}),d.name==="Mobile"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"7",y:"2",width:"10",height:"20",rx:"2"}),e.jsx("path",{d:"M12 18h.01"})]})]},d.name)),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>st(d=>!d),className:`flex items-center gap-1.5 px-2 py-1 rounded transition-colors cursor-pointer ${tt||!Re.some(d=>d.name===Y.name)?"text-white bg-[#555]":"text-gray-400 hover:text-gray-200 hover:bg-[#444]"}`,title:"Custom dimensions",children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M17 3a2.83 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})}),e.jsxs("span",{className:"text-xs font-mono",children:[Y.width," ×"," ",Y.height??900]})]}),tt&&e.jsx(bs,{currentWidth:Y.width,currentHeight:Y.height??900,devicePresets:He,customSizes:Ue,onApply:os,onSave:is,onRemove:ss,onClose:()=>st(!1)})]})]})}),e.jsx("div",{className:"ml-auto flex items-center gap-1 shrink-0 z-10",children:e.jsx("button",{onClick:()=>{const d=gt||Ne;d&&window.open(d,"_blank")},className:"p-1.5 rounded text-gray-500 hover:text-gray-300 transition-colors cursor-pointer",title:"Open preview in new window",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})})})]}),Xt&&e.jsx(xa,{onSaveToCurrent:()=>void ht("overwrite"),onSaveAsNew:()=>void ht("new"),onDismiss:()=>Te(!1),isSaving:Qt}),e.jsx("div",{ref:he,className:"flex-1 flex items-center justify-center overflow-hidden p-8",style:Le?{backgroundColor:"#f5f0e8",backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 19px, #e8e0d0 19px, #e8e0d0 20px), repeating-linear-gradient(90deg, transparent, transparent 19px, #e8e0d0 19px, #e8e0d0 20px)"}:{backgroundImage:`
49
+ linear-gradient(45deg, #333 25%, transparent 25%),
50
+ linear-gradient(-45deg, #333 25%, transparent 25%),
51
+ linear-gradient(45deg, transparent 75%, #333 75%),
52
+ linear-gradient(-45deg, transparent 75%, #333 75%)
53
+ `,backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px",backgroundColor:"#2d2d2d"},children:Le?e.jsx(ca,{preview:Le,onDismiss:()=>ie(null),onLoadCommit:Ft}):Ne?e.jsx("div",{style:{width:`${Y.width*me}px`,height:`${(Y.height??900)*me}px`},children:e.jsxs("div",{className:"relative bg-white origin-top-left",style:{width:`${Y.width}px`,height:`${Y.height??900}px`,transform:me<1?`scale(${me})`:void 0},children:[!je&&!xt&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 bg-[#2a2a2a] rounded-lg p-8 w-[500px] h-[300px]",children:[e.jsx("div",{className:"mb-4",children:e.jsx(bt,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Loading Preview"}),e.jsx("p",{className:"text-sm text-gray-400 leading-5 m-0 font-['IBM_Plex_Sans']",children:"Waiting for the app to render"})]})]})}),xt&&e.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center",style:{backgroundColor:"rgba(0, 0, 0, 0.25)",backdropFilter:"blur(1px)",transition:"opacity 200ms ease-out"},children:e.jsxs("div",{className:"flex flex-col items-center gap-3 animate-pulse",children:[e.jsx("svg",{className:"w-6 h-6 text-white/80 animate-spin",viewBox:"0 0 24 24",fill:"none",children:e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"50 100"})}),e.jsx("span",{className:"text-white/70 text-xs font-['IBM_Plex_Sans']",children:"Switching scenario"})]})}),e.jsx("iframe",{ref:K,src:gt||Ne,className:"w-full h-full border-none",title:"Editor preview",onLoad:ls,style:{opacity:je?1:0}},ze)]})}):e.jsx("div",{className:"bg-[#2a2a2a] rounded-lg flex flex-col items-center justify-center",style:{width:`${Y.width*me}px`,height:`${(Y.height??900)*me}px`},children:re?e.jsxs("div",{className:"flex flex-col gap-4 text-center px-8 max-w-[600px]",children:[e.jsx("h2",{className:"text-xl font-medium text-red-400 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Dev Server Failed"}),e.jsx("pre",{className:"text-xs text-left bg-[#1e1e1e] text-gray-300 p-4 rounded overflow-auto max-h-[300px] w-full font-mono whitespace-pre-wrap",children:re}),e.jsx("button",{onClick:Pe,className:"mx-auto px-4 py-2 bg-[#005c75] text-white text-sm font-medium rounded hover:bg-[#004d63] transition-colors cursor-pointer",children:"Retry"})]}):ae||_e?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx(bt,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:_e?"Starting Interactive Mode":"Starting Dev Server"}),e.jsx("p",{className:"text-sm text-gray-400 leading-5 m-0 font-['IBM_Plex_Sans']",children:_e?"Loading component preview...":"Your dev server is starting up..."})]})]}):e.jsxs("div",{className:"flex flex-col gap-3 text-center px-8",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Live Preview"}),e.jsx("p",{className:"text-sm text-gray-500 leading-5 m-0 font-['IBM_Plex_Sans']",children:"Describe what you want to build in the Build tab"})]})})})]}),e.jsxs("aside",{className:`bg-[#1e1e1e] border-r border-[#3d3d3d] shrink-0 flex flex-col overflow-hidden order-first ${be==="editor-only"?"w-full max-w-none min-w-0":"w-[50%] min-w-[400px] max-w-[800px]"}`,style:be==="preview-only"?{display:"none"}:void 0,children:[x&&Z&&e.jsxs("div",{className:"px-3 py-2 text-xs flex items-center justify-between",style:{background:"#2a1f00",borderBottom:"1px solid #3d2e00",color:"#f0c040"},children:[e.jsxs("span",{children:["Viewing an older version of"," ",e.jsx("strong",{children:Z.name}),". A newer version exists."]}),e.jsx("a",{href:`/editor/entity/${x}`,className:"px-2 py-0.5 rounded text-xs",style:{background:"#3d2e00",color:"#f0c040",textDecoration:"none"},children:"View latest"})]}),e.jsx(la,{activeTab:X,onTabChange:d=>{ee(d),d==="build"&&de(!0)},buildIdle:Fe,panelLayout:be,onToggleExpand:()=>it(d=>d==="editor-only"?"split":"editor-only")}),e.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[Fe&&X!=="build"&&!Jt&&e.jsxs("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-50 animate-[slideDown_0.3s_ease-out]",children:[e.jsx("style",{children:`
54
+ @keyframes slideDown {
55
+ from { transform: translate(-50%, -100%); opacity: 0; }
56
+ to { transform: translate(-50%, 0); opacity: 1; }
57
+ }
58
+ `}),e.jsxs("div",{className:"flex items-center gap-1 bg-amber-50 border-2 border-amber-300 rounded-lg shadow-lg",children:[e.jsxs("button",{onClick:()=>{ee("build"),de(!0)},className:"flex items-center gap-2 px-4 py-2 cursor-pointer hover:bg-amber-100 transition-colors rounded-l-md",children:[e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-amber-400 animate-pulse"}),e.jsx("span",{className:"text-sm font-medium text-amber-900",children:"Claude is waiting for you"}),e.jsx("span",{className:"text-xs text-amber-600 ml-1",children:"Go to Build"})]}),e.jsx("button",{onClick:d=>{d.stopPropagation(),rt(!0)},className:"px-2 py-2 cursor-pointer hover:bg-amber-100 transition-colors rounded-r-md text-amber-400 hover:text-amber-600","aria-label":"Dismiss",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:e.jsx("path",{d:"M3 3l8 8M11 3l-8 8"})})})]})]}),zt&&e.jsxs("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:X==="build"?"visible":"hidden"},children:[e.jsx("div",{className:Be?"flex-1 min-h-0":"flex-1",style:Be?{flex:"1 1 50%"}:void 0,children:Me==="pending"?e.jsx(As,{featureName:f,editorStep:N,editorStepLabel:M,onContinue:Ht}):e.jsx(Es,{ref:C,entityName:"Editor",projectSlug:s,entityFilePath:null,scenarioName:null,onRefreshPreview:es,onShowResults:Gt,onHideResults:lt,onSetViewport:qt,onDataMutationForwarded:Zt,editorMode:!0,onIdleChange:Vt,notificationSettings:ct,buildTabActive:X==="build",claudeStartMode:Me==="continue"?"resume":"fresh",claudeSessionId:U})}),Be&&e.jsx("div",{style:{flex:"1 1 50%"},className:"min-h-0 border-t-2 border-gray-300",children:e.jsx(ia,{scenarios:c,allScenarios:r,glossaryFunctions:m,projectRoot:a,activeScenarioId:R,onScenarioSelect:ve,onClose:lt,entityChangeStatus:g,modifiedFiles:I,featureName:f,userPrompt:B})})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:X==="app"?"visible":"hidden"},children:e.jsx(aa,{hasProject:n,scenarios:r,analyzedEntities:o,allEntities:l,glossaryFunctions:m,glossaryEntries:v,projectRoot:a,activeScenarioId:R,onScenarioSelect:ve,onAnalyzedScenarioSelect:et,onSwitchToBuild:Bt,zoomComponent:P,focusedEntity:Z,onZoomChange:ft,entityImports:y,pageFilePaths:S,projectTitle:O,projectDescription:L,breadcrumbItems:as,migrationMode:h,migrationState:w,onStartMigration:Ot})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:X==="data"?"visible":"hidden"},children:e.jsx(_s,{scenarios:r,projectRoot:a,activeScenarioId:R,onScenarioSelect:ve,zoomComponent:P,focusedEntity:Z,onZoomChange:ft,analyzedEntities:[],glossaryFunctions:m,activeAnalyzedScenarioId:q==null?void 0:q.scenarioId,onAnalyzedScenarioSelect:et,entityImports:y,pageFilePaths:S})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:X==="journal"?"visible":"hidden"},children:e.jsx(Gs,{isActive:X==="journal",onScreenshotClick:ns,glossaryFunctions:m})})]}),e.jsx(Ms,{serverUrl:G,isStarting:ae,projectSlug:s,devServerError:re,onStartServer:ge?Ee:void 0,notificationSettings:ct,onChangeNotificationSettings:Yt})]})]})]})}),e.jsx(gs,{})]})});export{Ta as default,Ia as meta,Ma as shouldRevalidate};
@@ -0,0 +1,41 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/addon-web-links-74hnHF59.js","assets/chunk-JZWAC4HX-BBXArFPl.js"])))=>i.map(i=>d[i]);
2
+ var xe=Object.defineProperty;var he=(r,e,o)=>e in r?xe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o;var G=(r,e,o)=>he(r,typeof e!="symbol"?e+"":e,o);import{j as l}from"./jsx-runtime-D_zvdyIk.js";import{r as u}from"./chunk-JZWAC4HX-BBXArFPl.js";import{_ as V}from"./preload-helper-ckwbz45p.js";const P={sound:"soft-double-tap",systemNotification:!0},ye=[{id:"soft-double-tap",label:"Soft double tap"},{id:"gentle-chime",label:"Gentle chime"},{id:"warm-ding",label:"Warm ding"},{id:"mellow-two-tone",label:"Mellow two-tone"},{id:"triangle-bell",label:"Triangle bell"},{id:"off",label:"No sound"}],ie="codeyam-editor-notifications";function _e(){try{const r=localStorage.getItem(ie);if(!r)return P;const e=JSON.parse(r);return typeof e=="string"?e==="true"?P:{...P,sound:"off",systemNotification:!1}:{...P,...e}}catch{return P}}function Oe(r){localStorage.setItem(ie,JSON.stringify(r))}function se(r){var e;if(r!=="off")try{const o=new AudioContext,a={"soft-double-tap":t=>{[0,.12].forEach(n=>{const i=t.createOscillator(),g=t.createGain();i.connect(g),g.connect(t.destination),i.type="sine",i.frequency.value=392,g.gain.setValueAtTime(.25,t.currentTime+n),g.gain.exponentialRampToValueAtTime(.01,t.currentTime+n+.1),i.start(t.currentTime+n),i.stop(t.currentTime+n+.1)})},"gentle-chime":t=>{const n=t.createOscillator(),i=t.createGain();n.connect(i),i.connect(t.destination),n.type="sine",n.frequency.setValueAtTime(523,t.currentTime),n.frequency.setValueAtTime(659,t.currentTime+.15),i.gain.setValueAtTime(.3,t.currentTime),i.gain.exponentialRampToValueAtTime(.01,t.currentTime+.4),n.start(),n.stop(t.currentTime+.4)},"warm-ding":t=>{const n=t.createOscillator(),i=t.createGain();n.connect(i),i.connect(t.destination),n.type="sine",n.frequency.value=330,i.gain.setValueAtTime(.35,t.currentTime),i.gain.exponentialRampToValueAtTime(.01,t.currentTime+.6),n.start(),n.stop(t.currentTime+.6)},"mellow-two-tone":t=>{const n=t.createOscillator(),i=t.createGain();n.connect(i),i.connect(t.destination),n.type="sine",n.frequency.setValueAtTime(294,t.currentTime),n.frequency.setValueAtTime(440,t.currentTime+.18),i.gain.setValueAtTime(.3,t.currentTime),i.gain.exponentialRampToValueAtTime(.01,t.currentTime+.5),n.start(),n.stop(t.currentTime+.5)},"triangle-bell":t=>{const n=t.createOscillator(),i=t.createGain();n.connect(i),i.connect(t.destination),n.type="triangle",n.frequency.value=523,i.gain.setValueAtTime(.4,t.currentTime),i.gain.exponentialRampToValueAtTime(.01,t.currentTime+.8),n.start(),n.stop(t.currentTime+.8)}};(e=a[r])==null||e.call(a,o)}catch{}}function Re({serverUrl:r,isStarting:e,projectSlug:o,devServerError:a,onStartServer:t,notificationSettings:n,onChangeNotificationSettings:i}){const[g,S]=u.useState(null),[m,w]=u.useState(!1),E=u.useRef(null),A=u.useRef(null);u.useEffect(()=>{if(!o)return;const x=new EventSource("/api/dev-mode-events");return x.onmessage=_=>{try{const j=JSON.parse(_.data);j.type==="file-synced"&&(S(j.fileName),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{S(null)},5e3))}catch{}},()=>{x.close(),A.current&&clearTimeout(A.current)}},[o]),u.useEffect(()=>{if(!m)return;function x(_){E.current&&!E.current.contains(_.target)&&w(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[m]);let N;a?N="error":e?N="starting":r?N="running":N="stopped";const k={starting:"bg-yellow-400",running:"bg-green-400",stopped:"bg-gray-400",error:"bg-red-400"},I={starting:"Starting...",running:r||"Running",stopped:"Stopped",error:"Error"},R=n&&(n.sound!=="off"||n.systemNotification);return l.jsxs("div",{className:"bg-[#1e1e1e] border-t border-[#3d3d3d] h-7 flex items-center px-4 gap-4 shrink-0 text-xs font-mono",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:`w-2 h-2 rounded-full ${k[N]}`}),l.jsxs("span",{className:"text-gray-400",children:["Server:"," ",l.jsx("span",{className:"text-gray-300",children:I[N]})]}),(N==="stopped"||N==="error")&&t&&l.jsx("button",{onClick:t,className:"ml-1 px-2.5 py-0.5 bg-[#005c75] hover:bg-[#007a9a] text-white text-[11px] font-medium rounded transition-colors cursor-pointer border-none leading-tight",children:"Start Server"})]}),l.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"}),g&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4ade80",strokeWidth:"2",children:l.jsx("path",{d:"M20 6L9 17l-5-5"})}),l.jsxs("span",{className:"text-green-400",children:["Synced: ",g]})]}),l.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"})]}),l.jsx("div",{className:"flex-1"}),i&&n&&l.jsxs("div",{className:"relative",ref:E,children:[l.jsx("button",{onClick:()=>w(!m),className:`text-[11px] rounded transition-colors cursor-pointer ${R?"text-green-400 hover:text-green-300":"text-gray-500 hover:text-gray-300"}`,children:R?"Notifications On":"Notifications Off"}),m&&l.jsxs("div",{className:"absolute bottom-full right-0 mb-2 w-56 bg-[#2d2d2d] border border-[#4d4d4d] rounded-lg shadow-xl p-3 flex flex-col gap-3 z-50",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] text-gray-400 mb-1.5",children:"Notification sound"}),l.jsx("div",{className:"flex flex-col gap-0.5",children:ye.map(x=>l.jsx("button",{onClick:()=>{i({...n,sound:x.id}),x.id!=="off"&&se(x.id)},className:`text-left text-[11px] px-2 py-1 rounded cursor-pointer transition-colors ${n.sound===x.id?"bg-[#444] text-white":"text-gray-300 hover:bg-[#3a3a3a]"}`,children:x.label},x.id))})]}),l.jsxs("div",{className:"border-t border-[#4d4d4d] pt-2",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:n.systemNotification,onChange:x=>{const _=x.target.checked;i({...n,systemNotification:_}),_&&typeof Notification<"u"&&Notification.permission==="default"&&Notification.requestPermission()},className:"accent-green-500"}),l.jsx("span",{className:"text-[11px] text-gray-300",children:"System notification"})]}),l.jsx("div",{className:"text-[10px] text-gray-500 mt-1 ml-5",children:"Shows when tab is not visible"})]})]})]})]})}async function ge(r,e){try{const{WebglAddon:a}=await V(async()=>{const{WebglAddon:n}=await import("./addon-webgl-DI8QOUvO.js").then(i=>i.a);return{WebglAddon:n}},[]),t=new a;return t.onContextLoss(()=>{e==null||e("webgl","canvas",new Error("WebGL context lost")),t.dispose(),oe(r).then(n=>{n||e==null||e("canvas","dom",new Error("Canvas fallback failed after context loss"))})}),r.loadAddon(t),{type:"webgl",dispose:()=>t.dispose()}}catch(a){e==null||e("webgl","canvas",a)}const o=await oe(r);return o||(e==null||e("canvas","dom",new Error("Canvas addon failed")),{type:"dom",dispose:()=>{}})}async function oe(r){try{const{CanvasAddon:e}=await V(async()=>{const{CanvasAddon:a}=await import("./addon-canvas-DpzMmAy5.js").then(t=>t.a);return{CanvasAddon:a}},[]),o=new e;return r.loadAddon(o),{type:"canvas",dispose:()=>o.dispose()}}catch{return null}}class we{constructor(e,o){G(this,"deferred",!1);G(this,"actions");G(this,"env");this.actions=e,this.env=o}onIdle(e,o){return o&&this.env.hasBrowserFocus()?(this.deferred=!0,"deferred"):(this.deferred=!1,this.notify(e))}onBuildTabChange(e,o){return!e&&this.deferred?(this.deferred=!1,this.notify(o),!0):!1}onActive(){this.deferred=!1}onUserEngagement(){const e=this.deferred;return this.deferred=!1,e}get isDeferred(){return this.deferred}notify(e){const o=!!(e!=null&&e.sound)&&e.sound!=="off";return o&&this.actions.playSound(e.sound),!this.env.hasBrowserFocus()&&(e!=null&&e.systemNotification)&&this.env.hasNotificationPermission()&&this.actions.showSystemNotification(),o?"played":"played-no-sound"}}const ve=`
3
+ .xterm { cursor: text; position: relative; user-select: none; -ms-user-select: none; -webkit-user-select: none; }
4
+ .xterm.focus, .xterm:focus { outline: none; }
5
+ .xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
6
+ .xterm .xterm-helper-textarea { padding: 0; border: 0; margin: 0; position: absolute; opacity: 0; left: -9999em; top: 0; width: 0; height: 0; z-index: -5; white-space: nowrap; overflow: hidden; resize: none; caret-color: transparent !important; clip-path: inset(100%) !important; }
7
+ .xterm .composition-view { background: #000; color: #FFF; display: none; position: absolute; white-space: nowrap; z-index: 1; }
8
+ .xterm .composition-view.active { display: block; }
9
+ .xterm .xterm-viewport { background-color: #000; overflow-y: scroll; cursor: default; position: absolute; right: 0; left: 0; top: 0; bottom: 0; }
10
+ .xterm .xterm-screen { position: relative; }
11
+ .xterm .xterm-screen canvas { position: absolute; left: 0; top: 0; }
12
+ .xterm .xterm-scroll-area { visibility: hidden; }
13
+ .xterm-char-measure-element { display: inline-block; visibility: hidden; position: absolute; top: 0; left: -9999em; line-height: normal; }
14
+ .xterm.enable-mouse-events { cursor: default; }
15
+ .xterm.xterm-cursor-pointer, .xterm .xterm-cursor-pointer { cursor: pointer; }
16
+ .xterm.column-select.focus { cursor: crosshair; }
17
+ .xterm .xterm-accessibility:not(.debug), .xterm .xterm-message { position: absolute; left: 0; top: 0; bottom: 0; right: 0; z-index: 10; color: transparent; pointer-events: none; }
18
+ .xterm .xterm-accessibility-tree:not(.debug) *::selection { color: transparent; }
19
+ .xterm .xterm-accessibility-tree { user-select: text; white-space: pre; }
20
+ .xterm .live-region { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
21
+ .xterm-dim { opacity: 1 !important; }
22
+ .xterm-underline-1 { text-decoration: underline; }
23
+ .xterm-underline-2 { text-decoration: double underline; }
24
+ .xterm-underline-3 { text-decoration: wavy underline; }
25
+ .xterm-underline-4 { text-decoration: dotted underline; }
26
+ .xterm-underline-5 { text-decoration: dashed underline; }
27
+ .xterm-overline { text-decoration: overline; }
28
+ .xterm-strikethrough { text-decoration: line-through; }
29
+ .xterm-screen .xterm-decoration-container .xterm-decoration { z-index: 6; position: absolute; }
30
+ .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { z-index: 7; }
31
+ .xterm-decoration-overview-ruler { z-index: 8; position: absolute; top: 0; right: 0; pointer-events: none; }
32
+ .xterm-decoration-top { z-index: 2; position: relative; }
33
+ `;function be(){let r=document.getElementById("xterm-css");r||(r=document.createElement("style"),r.id="xterm-css",document.head.appendChild(r)),r.textContent=ve}const je=u.forwardRef(function({entityName:e,entityType:o,entitySha:a,entityFilePath:t,scenarioName:n,scenarioDescription:i,analysisId:g,projectSlug:S,onRefreshPreview:m,onShowResults:w,onHideResults:E,onSetViewport:A,editorMode:N,onIdleChange:k,notificationSettings:I,buildTabActive:R,claudeStartMode:x,claudeSessionId:_,onDataMutationForwarded:j},ce){const J=u.useRef(null),z=u.useRef(null),$=u.useRef(null),B=u.useRef(null),q=u.useRef(null),H=u.useRef(!1),M=u.useRef(0),X=u.useRef(!1),v=u.useRef(k);v.current=k;const K=u.useRef(I);K.current=I;const Q=u.useRef(R);Q.current=R;const O=u.useRef(null),L=u.useRef(null);L.current||(L.current=new we({playSound:c=>se(c),showSystemNotification:()=>{O.current&&O.current.close();const c=new Notification("Claude is ready for you",{body:"Claude has finished and is waiting for your input.",tag:"claude-idle"});c.onclick=()=>{window.focus(),c.close()},O.current=c}},{hasBrowserFocus:()=>document.hasFocus(),hasNotificationPermission:()=>typeof Notification<"u"&&Notification.permission==="granted"}));function ae(){O.current&&(O.current.close(),O.current=null)}function Y(){var c,p;ae(),(c=v.current)==null||c.call(v,!1),(p=L.current)==null||p.onUserEngagement()}u.useEffect(()=>{function c(){Y()}function p(){document.hidden||Y()}return window.addEventListener("focus",c),document.addEventListener("visibilitychange",p),()=>{window.removeEventListener("focus",c),document.removeEventListener("visibilitychange",p)}},[]),u.useEffect(()=>{var c;(c=L.current)==null||c.onBuildTabChange(!!R,K.current)},[R]);const le=u.useCallback(()=>{var c;(c=$.current)==null||c.focus()},[]);return u.useImperativeHandle(ce,()=>({sendInput(c){const p=B.current;p&&p.readyState===WebSocket.OPEN&&(p.send(JSON.stringify({type:"input",data:c})),setTimeout(()=>{p.readyState===WebSocket.OPEN&&p.send(JSON.stringify({type:"input",data:"\r"}))},100))},focus(){var c;(c=$.current)==null||c.focus()},scrollToBottom(){var p;const c=(p=J.current)==null?void 0:p.querySelector(".xterm-viewport");c&&(c.scrollTop=c.scrollHeight)}})),u.useEffect(()=>{const c=J.current;if(!c)return;let p=!1;return be(),Promise.all([V(()=>import("./xterm-BqvuqXEL.js"),[]),V(()=>import("./addon-fit-YJmn1quW.js"),[]),V(()=>import("./addon-web-links-74hnHF59.js").then(W=>W.a),__vite__mapDeps([0,1]))]).then(([W,ue,de])=>{if(p)return;const d=new W.Terminal({cursorBlink:!1,cursorInactiveStyle:"none",scrollback:5e3,fontSize:13,fontFamily:"'IBM Plex Mono', 'Menlo', 'Monaco', monospace",theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#1e1e1e",selectionBackground:"#264f78"},linkHandler:{activate(f,s){try{const y=new URL(s),b=y.searchParams.get("scenario");if(b&&y.pathname.startsWith("/editor")){const T=new BroadcastChannel("codeyam-editor");T.postMessage({type:"switch-scenario",scenarioId:b}),T.close();return}}catch{}window.open(s,"_blank")}}}),U=new ue.FitAddon;d.loadAddon(U),d.loadAddon(new de.WebLinksAddon),d.open(c),d.write("\x1B[?25l");let D=null;ge(d,(f,s,y)=>{console.warn(`[Terminal] Renderer fallback: ${f} → ${s}`,y)}).then(f=>{if(p){f.dispose();return}console.log(`[Terminal] Using ${f.type} renderer`),D=f.dispose}),requestAnimationFrame(()=>{try{U.fit()}catch{}}),$.current=d,d.focus(),setTimeout(()=>d.focus(),100),setTimeout(()=>d.focus(),500);const fe=window.location.protocol==="https:"?"wss:":"ws:",me=window.location.host;function pe(f){const s=new URLSearchParams;return s.set("entityName",e),o&&s.set("entityType",o),a&&s.set("entitySha",a),t&&s.set("entityFilePath",t),n&&s.set("scenarioName",n),i&&s.set("scenarioDescription",i),g&&s.set("analysisId",g),S&&s.set("projectSlug",S),N&&s.set("editorMode","true"),f&&s.set("reconnectId",f),x&&s.set("claudeStartMode",x),_&&s.set("claudeSessionId",_),`${fe}//${me}/ws/terminal?${s.toString()}`}function Z(f){const s=pe(f),y=new WebSocket(s);B.current=y,y.onopen=()=>{M.current=0,X.current=!1,y.send(JSON.stringify({type:"resize",cols:d.cols,rows:d.rows}))},y.onmessage=b=>{var T,ee,te,re,ne;try{const h=JSON.parse(b.data);if(h.type==="session-id"){q.current=h.sessionId;return}if(h.type==="refresh-preview"){m==null||m(h.path,h.scenarioId);return}if(h.type==="show-results"){w==null||w();return}if(h.type==="hide-results"){E==null||E();return}if(h.type==="data-mutation-forwarded"){j==null||j();return}if(h.type==="set-viewport"){A==null||A({name:h.name,width:h.width,height:h.height});return}if(h.type==="claude-idle"){(T=v.current)==null||T.call(v,!0),(ee=L.current)==null||ee.onIdle(K.current,Q.current??!1);return}if(h.type==="claude-active"){(te=v.current)==null||te.call(v,!1),(re=L.current)==null||re.onActive(),O.current&&(O.current.close(),O.current=null);return}h.type==="output"&&(d.write(h.data),(ne=v.current)==null||ne.call(v,!1))}catch{d.write(b.data)}},y.onclose=()=>{if(H.current){d.write(`\r
34
+ \x1B[90m[Terminal session ended]\x1B[0m\r
35
+ `);return}const b=M.current;if(b<5&&q.current){const T=1e3*Math.pow(2,Math.min(b,3));M.current=b+1,d.write(`\r
36
+ \x1B[33m[Reconnecting...]\x1B[0m\r
37
+ `),setTimeout(()=>{H.current||Z(q.current)},T)}else X.current?d.write(`\r
38
+ \x1B[90m[Terminal session ended]\x1B[0m\r
39
+ `):(X.current=!0,d.write(`\r
40
+ \x1B[33m[Starting new session...]\x1B[0m\r
41
+ `),q.current=null,M.current=0,Z())},y.onerror=()=>{}}Z(),d.onData(f=>{const s=B.current;s&&s.readyState===WebSocket.OPEN&&s.send(JSON.stringify({type:"input",data:f})),Y()});let C=null;const F=new ResizeObserver(()=>{C&&clearTimeout(C),C=setTimeout(()=>{let f;try{f=U.proposeDimensions()}catch{return}if(!f||f.cols===d.cols&&f.rows===d.rows)return;const s=c.querySelector(".xterm-viewport");let y,b=!0;s&&(y=s.scrollTop,b=s.scrollTop+s.clientHeight>=s.scrollHeight-10),U.fit(),s&&y!==void 0&&(b?s.scrollTop=s.scrollHeight:s.scrollTop=y);const T=B.current;T&&T.readyState===WebSocket.OPEN&&T.send(JSON.stringify({type:"resize",cols:d.cols,rows:d.rows}))},150)});F.observe(c),z.current=()=>{var f;C&&clearTimeout(C),F.disconnect(),H.current=!0,(f=B.current)==null||f.close(),B.current=null,D==null||D(),d.dispose(),$.current=null}}),()=>{var W;p=!0,(W=z.current)==null||W.call(z),z.current=null}},[]),l.jsx("div",{ref:J,onClick:le,className:"w-full h-full relative overflow-hidden",style:{padding:"4px 0 0 8px"}})});function Te(r){return r.replace(/[^a-zA-Z0-9_]+/g,"_")}function Be(r){const{activeAnalyzedScenario:e,analyzedPreviewUrl:o,activeScenarioId:a,scenarios:t,proxyUrl:n,devServerUrl:i,zoomComponent:g}=r;if(e&&o)return o;if(e&&!o)return null;if(a){const m=t.find(w=>w.id===a);if(m!=null&&m.url){const w=n||i;return w?m.url.startsWith("/")?`${w}${m.url}`:m.url:null}}const S=n||i;if(!S)return null;if(g&&a){const m=t.find(E=>E.id===a),w=m?Te(m.name):"Default";return`${S}/__codeyam__/${g}/${w}`}return S}function Le(r,e){if(!r||!e)return r;try{const o=new URL(r),a=e.indexOf("?");return a>=0?(o.pathname=e.slice(0,a),o.search=e.slice(a)):(o.pathname=e,o.search=""),o.href}catch{return r}}function We(r,e){return r?r!==e:!1}function ze(r){if(r.length!==0)return r.find(e=>e.type==="application")||r[0]}function Ce(r,e,o){if(!r.viewportWidth||!r.viewportHeight)return o??null;const a=e.find(t=>t.width===r.viewportWidth&&t.height===r.viewportHeight);return{name:(a==null?void 0:a.name)||"Custom",width:r.viewportWidth,height:r.viewportHeight}}function Pe(r,e){const o=e.width,a=e.height??900,t=r.width,n=r.height;return o<=t&&a<=n?1:Math.min(t/o,n/a)}export{Re as D,je as T,Le as a,Te as b,P as c,Oe as d,Pe as e,Be as f,ze as g,_e as l,Ce as r,We as s};