@codeyam/codeyam-cli 0.1.0-staging.9574237 → 0.1.0-staging.a2f381a

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 (392) 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 +4 -4
  4. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +135 -0
  5. package/analyzer-template/packages/ai/src/lib/astScopes/nodeToSource.ts +19 -0
  6. package/analyzer-template/packages/ai/src/lib/astScopes/paths.ts +11 -4
  7. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +36 -9
  8. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.ts +10 -3
  9. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +16 -6
  10. package/analyzer-template/packages/analyze/index.ts +4 -1
  11. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +28 -2
  12. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +5 -36
  13. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +10 -6
  14. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +9 -12
  15. package/analyzer-template/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.ts +21 -0
  16. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +82 -10
  17. package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +4 -0
  18. package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +4 -0
  19. package/analyzer-template/packages/analyze/src/lib/files/analyzeNextRoute.ts +8 -3
  20. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +239 -58
  21. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1684 -1462
  22. package/analyzer-template/packages/aws/package.json +6 -6
  23. package/analyzer-template/packages/database/package.json +2 -2
  24. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +25 -15
  25. package/analyzer-template/packages/database/src/lib/loadEntity.ts +19 -8
  26. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  27. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +7 -1
  28. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  29. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts +4 -1
  30. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts.map +1 -1
  31. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js +5 -5
  32. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js.map +1 -1
  33. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts +3 -1
  34. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  35. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +22 -1
  36. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  37. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +27 -0
  38. package/analyzer-template/project/analyzeFileEntities.ts +26 -0
  39. package/analyzer-template/project/runMultiScenarioServer.ts +26 -3
  40. package/background/src/lib/virtualized/project/analyzeFileEntities.js +22 -0
  41. package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
  42. package/background/src/lib/virtualized/project/runMultiScenarioServer.js +23 -3
  43. package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
  44. package/codeyam-cli/src/cli.js +24 -0
  45. package/codeyam-cli/src/cli.js.map +1 -1
  46. package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js +47 -0
  47. package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js.map +1 -0
  48. package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js +71 -0
  49. package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js.map +1 -0
  50. package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js +30 -0
  51. package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js.map +1 -0
  52. package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js +51 -0
  53. package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js.map +1 -0
  54. package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js +55 -0
  55. package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js.map +1 -0
  56. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +9 -9
  57. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +39 -3
  58. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
  59. package/codeyam-cli/src/commands/editor.js +2497 -467
  60. package/codeyam-cli/src/commands/editor.js.map +1 -1
  61. package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js +23 -0
  62. package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js.map +1 -0
  63. package/codeyam-cli/src/commands/editorIsolateArgs.js +25 -0
  64. package/codeyam-cli/src/commands/editorIsolateArgs.js.map +1 -0
  65. package/codeyam-cli/src/commands/init.js +21 -0
  66. package/codeyam-cli/src/commands/init.js.map +1 -1
  67. package/codeyam-cli/src/commands/telemetry.js +37 -0
  68. package/codeyam-cli/src/commands/telemetry.js.map +1 -0
  69. package/codeyam-cli/src/data/designSystems.js +27 -0
  70. package/codeyam-cli/src/data/designSystems.js.map +1 -0
  71. package/codeyam-cli/src/data/techStacks.js +1 -1
  72. package/codeyam-cli/src/utils/__tests__/devServerState.test.js +93 -1
  73. package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -1
  74. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +44 -0
  75. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -1
  76. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +3174 -1
  77. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
  78. package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js +137 -0
  79. package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js.map +1 -0
  80. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +70 -0
  81. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -1
  82. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +163 -4
  83. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -1
  84. package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js +67 -0
  85. package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js.map +1 -0
  86. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +11 -3
  87. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -1
  88. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +98 -1
  89. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -1
  90. package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js +1108 -0
  91. package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js.map +1 -0
  92. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +190 -0
  93. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -1
  94. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +344 -7
  95. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
  96. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +134 -1
  97. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -1
  98. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +294 -2
  99. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
  100. package/codeyam-cli/src/utils/__tests__/envFile.test.js +125 -0
  101. package/codeyam-cli/src/utils/__tests__/envFile.test.js.map +1 -0
  102. package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js +177 -0
  103. package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js.map +1 -0
  104. package/codeyam-cli/src/utils/__tests__/handoffContext.test.js +500 -0
  105. package/codeyam-cli/src/utils/__tests__/handoffContext.test.js.map +1 -0
  106. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +16 -1
  107. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -1
  108. package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js +302 -0
  109. package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js.map +1 -0
  110. package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js +127 -0
  111. package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js.map +1 -0
  112. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +57 -0
  113. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -1
  114. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +180 -1
  115. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -1
  116. package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js +84 -0
  117. package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js.map +1 -0
  118. package/codeyam-cli/src/utils/__tests__/telemetry.test.js +159 -0
  119. package/codeyam-cli/src/utils/__tests__/telemetry.test.js.map +1 -0
  120. package/codeyam-cli/src/utils/__tests__/testRunner.test.js +216 -0
  121. package/codeyam-cli/src/utils/__tests__/testRunner.test.js.map +1 -0
  122. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +6 -0
  123. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -1
  124. package/codeyam-cli/src/utils/analysisRunner.js +36 -7
  125. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  126. package/codeyam-cli/src/utils/analyzer.js +11 -1
  127. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  128. package/codeyam-cli/src/utils/backgroundServer.js +1 -1
  129. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  130. package/codeyam-cli/src/utils/designSystemShowcase.js +810 -0
  131. package/codeyam-cli/src/utils/designSystemShowcase.js.map +1 -0
  132. package/codeyam-cli/src/utils/devServerState.js +32 -0
  133. package/codeyam-cli/src/utils/devServerState.js.map +1 -1
  134. package/codeyam-cli/src/utils/editorApi.js +16 -0
  135. package/codeyam-cli/src/utils/editorApi.js.map +1 -1
  136. package/codeyam-cli/src/utils/editorAudit.js +649 -10
  137. package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
  138. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +13 -7
  139. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -1
  140. package/codeyam-cli/src/utils/editorEntityHelpers.js +18 -3
  141. package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -1
  142. package/codeyam-cli/src/utils/editorGuard.js +36 -0
  143. package/codeyam-cli/src/utils/editorGuard.js.map +1 -0
  144. package/codeyam-cli/src/utils/editorPreview.js +5 -3
  145. package/codeyam-cli/src/utils/editorPreview.js.map +1 -1
  146. package/codeyam-cli/src/utils/editorRecapture.js +109 -0
  147. package/codeyam-cli/src/utils/editorRecapture.js.map +1 -0
  148. package/codeyam-cli/src/utils/editorRoadmap.js +574 -0
  149. package/codeyam-cli/src/utils/editorRoadmap.js.map +1 -0
  150. package/codeyam-cli/src/utils/editorScenarioSwitch.js +39 -2
  151. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -1
  152. package/codeyam-cli/src/utils/editorScenarios.js +181 -17
  153. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
  154. package/codeyam-cli/src/utils/editorSeedAdapter.js +69 -16
  155. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -1
  156. package/codeyam-cli/src/utils/entityChangeStatus.js +39 -5
  157. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
  158. package/codeyam-cli/src/utils/entityChangeStatus.server.js +31 -0
  159. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
  160. package/codeyam-cli/src/utils/envFile.js +90 -0
  161. package/codeyam-cli/src/utils/envFile.js.map +1 -0
  162. package/codeyam-cli/src/utils/fileWatcher.js +38 -0
  163. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  164. package/codeyam-cli/src/utils/glossaryAdd.js +74 -0
  165. package/codeyam-cli/src/utils/glossaryAdd.js.map +1 -0
  166. package/codeyam-cli/src/utils/handoffContext.js +257 -0
  167. package/codeyam-cli/src/utils/handoffContext.js.map +1 -0
  168. package/codeyam-cli/src/utils/install-skills.js +41 -6
  169. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  170. package/codeyam-cli/src/utils/manualEntityAnalysis.js +196 -0
  171. package/codeyam-cli/src/utils/manualEntityAnalysis.js.map +1 -0
  172. package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js +159 -0
  173. package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js.map +1 -0
  174. package/codeyam-cli/src/utils/queue/job.js +35 -6
  175. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  176. package/codeyam-cli/src/utils/registerScenarioResult.js +52 -0
  177. package/codeyam-cli/src/utils/registerScenarioResult.js.map +1 -0
  178. package/codeyam-cli/src/utils/scenarioCoverage.js +4 -1
  179. package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -1
  180. package/codeyam-cli/src/utils/scenariosManifest.js +66 -2
  181. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -1
  182. package/codeyam-cli/src/utils/screenshotHash.js +26 -0
  183. package/codeyam-cli/src/utils/screenshotHash.js.map +1 -0
  184. package/codeyam-cli/src/utils/simulationGateMiddleware.js +9 -0
  185. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -1
  186. package/codeyam-cli/src/utils/techStackConfig.js +38 -0
  187. package/codeyam-cli/src/utils/techStackConfig.js.map +1 -0
  188. package/codeyam-cli/src/utils/techStackConfig.test.js +85 -0
  189. package/codeyam-cli/src/utils/techStackConfig.test.js.map +1 -0
  190. package/codeyam-cli/src/utils/telemetry.js +106 -0
  191. package/codeyam-cli/src/utils/telemetry.js.map +1 -0
  192. package/codeyam-cli/src/utils/telemetryMiddleware.js +22 -0
  193. package/codeyam-cli/src/utils/telemetryMiddleware.js.map +1 -0
  194. package/codeyam-cli/src/utils/testResultCache.js +53 -0
  195. package/codeyam-cli/src/utils/testResultCache.js.map +1 -0
  196. package/codeyam-cli/src/utils/testResultCache.server.js +81 -0
  197. package/codeyam-cli/src/utils/testResultCache.server.js.map +1 -0
  198. package/codeyam-cli/src/utils/testResultCache.server.test.js +187 -0
  199. package/codeyam-cli/src/utils/testResultCache.server.test.js.map +1 -0
  200. package/codeyam-cli/src/utils/testResultCache.test.js +230 -0
  201. package/codeyam-cli/src/utils/testResultCache.test.js.map +1 -0
  202. package/codeyam-cli/src/utils/testRunner.js +193 -1
  203. package/codeyam-cli/src/utils/testRunner.js.map +1 -1
  204. package/codeyam-cli/src/utils/webappDetection.js +4 -2
  205. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  206. package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js +99 -0
  207. package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js.map +1 -0
  208. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +119 -1
  209. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -1
  210. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +68 -1
  211. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -1
  212. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +442 -9
  213. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
  214. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +190 -21
  215. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -1
  216. package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js +135 -0
  217. package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js.map +1 -0
  218. package/codeyam-cli/src/webserver/app/lib/clientErrors.js +22 -1
  219. package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -1
  220. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  221. package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js +34 -0
  222. package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js.map +1 -0
  223. package/codeyam-cli/src/webserver/backgroundServer.js +42 -57
  224. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  225. package/codeyam-cli/src/webserver/build/client/assets/{CopyButton-CzTDWkF2.js → CopyButton-DTBZZfSk.js} +1 -1
  226. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BFbq6iFk.js → EntityItem-BxclONWq.js} +1 -1
  227. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-B6OMi58N.js → EntityTypeIcon-BsnEOJZ_.js} +1 -1
  228. package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-DuYodzo1.js → InlineSpinner-ByaELMbv.js} +1 -1
  229. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CXo9EeCl.js → InteractivePreview-6WjVfhxX.js} +2 -2
  230. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-DYCNb2It.js → LibraryFunctionPreview-ChX-Hp7W.js} +1 -1
  231. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-CZgY3sxX.js → LogViewer-C-9zQdXg.js} +1 -1
  232. package/codeyam-cli/src/webserver/build/client/assets/MiniClaudeChat-Bs2_Oua4.js +36 -0
  233. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-CnYYwRDw.js → ReportIssueModal-DQsceHVv.js} +1 -1
  234. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CDoF7ZpU.js → SafeScreenshot-DThcm_9M.js} +1 -1
  235. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DrnfvaLL.js → ScenarioViewer-Cl4oOA3A.js} +1 -1
  236. package/codeyam-cli/src/webserver/build/client/assets/Spinner-CIil5-gb.js +34 -0
  237. package/codeyam-cli/src/webserver/build/client/assets/{ViewportInspectBar-DRKR9T0U.js → ViewportInspectBar-BqkA9zyZ.js} +1 -1
  238. package/codeyam-cli/src/webserver/build/client/assets/{_index-ClR-g3tY.js → _index-DnOgyseQ.js} +1 -1
  239. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-DTH6ydEA.js → activity.(_tab)-DqM9hbNE.js} +1 -1
  240. package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-74hnHF59.js → addon-web-links-C58dYPwR.js} +1 -1
  241. package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-B8CYhCO9.js → agent-transcripts-B8NCeOrm.js} +1 -1
  242. package/codeyam-cli/src/webserver/build/client/assets/api.editor-database-verify-l0sNRNKZ.js +1 -0
  243. package/codeyam-cli/src/webserver/build/client/assets/api.editor-github-verify-l0sNRNKZ.js +1 -0
  244. package/codeyam-cli/src/webserver/build/client/assets/api.editor-handoff-l0sNRNKZ.js +1 -0
  245. package/codeyam-cli/src/webserver/build/client/assets/api.editor-hosting-verify-l0sNRNKZ.js +1 -0
  246. package/codeyam-cli/src/webserver/build/client/assets/api.editor-recapture-stale-l0sNRNKZ.js +1 -0
  247. package/codeyam-cli/src/webserver/build/client/assets/api.editor-roadmap-l0sNRNKZ.js +1 -0
  248. package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-scenario-data-l0sNRNKZ.js +1 -0
  249. package/codeyam-cli/src/webserver/build/client/assets/api.editor-schema-l0sNRNKZ.js +1 -0
  250. package/codeyam-cli/src/webserver/build/client/assets/api.editor-verify-routes-l0sNRNKZ.js +1 -0
  251. package/codeyam-cli/src/webserver/build/client/assets/api.interactive-switch-scenario-l0sNRNKZ.js +1 -0
  252. package/codeyam-cli/src/webserver/build/client/assets/{book-open-CLaoh4ac.js → book-open-BFSIqZgO.js} +1 -1
  253. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-BZ2DZxbW.js → chevron-down-B9fDzFVh.js} +1 -1
  254. package/codeyam-cli/src/webserver/build/client/assets/chunk-UVKPFVEO-Bmq2apuh.js +43 -0
  255. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-CT4unAk-.js → circle-check-DLPObLUx.js} +1 -1
  256. package/codeyam-cli/src/webserver/build/client/assets/{copy-zK0B6Nu-.js → copy-DXEmO0TD.js} +1 -1
  257. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-DJB0YQJL.js → createLucideIcon-BwyFiRot.js} +1 -1
  258. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-Coe5NhbS.js +1 -0
  259. package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-CCKUIm0S.svg → cy-logo-cli-DoA97ML3.svg} +2 -2
  260. package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-CkXFP_i-.js → dev.empty-iRhRIFlp.js} +1 -1
  261. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-BZPBzV73.js +1 -0
  262. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-DhtVC4aI.js +161 -0
  263. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-C6fEYHrh.js +41 -0
  264. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BqAN7hyG.js → entity._sha._-pc-vc6wO.js} +13 -12
  265. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.dev-BOi8kpwd.js → entity._sha.scenarios._scenarioId.dev-C8AyYgYT.js} +1 -1
  266. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-Dg1NhIms.js → entity._sha.scenarios._scenarioId.fullscreen-DziaVQX1.js} +1 -1
  267. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-CJX6kkkV.js → entity._sha_.create-scenario-BTcpgIpC.js} +1 -1
  268. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BhVjZhKg.js → entity._sha_.edit._scenarioId-D_O_ajfZ.js} +1 -1
  269. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-_gzKltPN.js → entry.client-j1Vi0bco.js} +6 -6
  270. package/codeyam-cli/src/webserver/build/client/assets/{files-CV_17tZS.js → files-kuny2Q_s.js} +1 -1
  271. package/codeyam-cli/src/webserver/build/client/assets/{git-D-YXmMbR.js → git-DgCZPMie.js} +1 -1
  272. package/codeyam-cli/src/webserver/build/client/assets/globals-L-aUIeux.css +1 -0
  273. package/codeyam-cli/src/webserver/build/client/assets/{index-CCrgCshv.js → index-BliGSSpl.js} +1 -1
  274. package/codeyam-cli/src/webserver/build/client/assets/{index-Blo6EK8G.js → index-SqjQKTdH.js} +1 -1
  275. package/codeyam-cli/src/webserver/build/client/assets/{index-BsX0F-9C.js → index-vyrZD2g4.js} +1 -1
  276. package/codeyam-cli/src/webserver/build/client/assets/{labs-Byazq8Pv.js → labs-c3yLxSEp.js} +1 -1
  277. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DVQ0oHR7.js → loader-circle-D-q28GLF.js} +1 -1
  278. package/codeyam-cli/src/webserver/build/client/assets/manifest-79d0d81a.js +1 -0
  279. package/codeyam-cli/src/webserver/build/client/assets/{memory-b-VmA2Vj.js → memory-CEWIUC4t.js} +1 -1
  280. package/codeyam-cli/src/webserver/build/client/assets/{pause-DGcndCAa.js → pause-BP6fitdh.js} +1 -1
  281. package/codeyam-cli/src/webserver/build/client/assets/root-L2V0jea7.js +80 -0
  282. package/codeyam-cli/src/webserver/build/client/assets/{search-C0Uw0bcK.js → search-BooqacKS.js} +1 -1
  283. package/codeyam-cli/src/webserver/build/client/assets/{settings-OoNgHIfW.js → settings-BM0nbryO.js} +1 -1
  284. package/codeyam-cli/src/webserver/build/client/assets/{simulations-Bcemfu8a.js → simulations-ovy6FjRY.js} +1 -1
  285. package/codeyam-cli/src/webserver/build/client/assets/{terminal-BgMmG7R9.js → terminal-DHemCJIs.js} +1 -1
  286. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-Cs87hJYK.js → triangle-alert-D87ekDl8.js} +1 -1
  287. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-BR3Rs7JY.js → useCustomSizes-Dk0Tciqg.js} +1 -1
  288. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C8QvIe05.js +2 -0
  289. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-BermyNU5.js → useReportContext-jkCytuYz.js} +1 -1
  290. package/codeyam-cli/src/webserver/build/client/assets/{useToast-a_QN_W9_.js → useToast-BgqkixU9.js} +1 -1
  291. package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-QgInFGdU.js +16 -0
  292. package/codeyam-cli/src/webserver/build/server/assets/{index-CHSrVJtC.js → index-zblh9auj.js} +1 -1
  293. package/codeyam-cli/src/webserver/build/server/assets/init-DaE0CBjk.js +14 -0
  294. package/codeyam-cli/src/webserver/build/server/assets/server-build-CNvgz1cC.js +853 -0
  295. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  296. package/codeyam-cli/src/webserver/build-info.json +5 -5
  297. package/codeyam-cli/src/webserver/editorProxy.js +388 -26
  298. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
  299. package/codeyam-cli/src/webserver/idleDetector.js +65 -8
  300. package/codeyam-cli/src/webserver/idleDetector.js.map +1 -1
  301. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +53 -0
  302. package/codeyam-cli/src/webserver/server.js +151 -14
  303. package/codeyam-cli/src/webserver/server.js.map +1 -1
  304. package/codeyam-cli/src/webserver/terminalServer.js +253 -41
  305. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
  306. package/codeyam-cli/templates/__tests__/editor-step-hook.prompt-capture.test.ts +118 -0
  307. package/codeyam-cli/templates/codeyam-editor-claude.md +2 -0
  308. package/codeyam-cli/templates/codeyam-editor-codex.md +61 -0
  309. package/codeyam-cli/templates/codeyam-editor-gemini.md +59 -0
  310. package/codeyam-cli/templates/codeyam-editor-reference.md +216 -0
  311. package/codeyam-cli/templates/design-systems/clean-dashboard-design-system.md +255 -0
  312. package/codeyam-cli/templates/design-systems/editorial-design-system.md +267 -0
  313. package/codeyam-cli/templates/design-systems/mono-brutalist-design-system.md +256 -0
  314. package/codeyam-cli/templates/design-systems/neo-brutalist-design-system.md +294 -0
  315. package/codeyam-cli/templates/editor-step-hook.py +93 -46
  316. package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +204 -5
  317. package/codeyam-cli/templates/expo-react-native/__tests__/.gitkeep +0 -0
  318. package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +6 -3
  319. package/codeyam-cli/templates/expo-react-native/app/index.tsx +36 -0
  320. package/codeyam-cli/templates/expo-react-native/app.json +11 -0
  321. package/codeyam-cli/templates/expo-react-native/babel.config.js +1 -0
  322. package/codeyam-cli/templates/expo-react-native/gitignore +2 -0
  323. package/codeyam-cli/templates/expo-react-native/global.css +7 -0
  324. package/codeyam-cli/templates/expo-react-native/lib/theme.ts +73 -0
  325. package/codeyam-cli/templates/expo-react-native/package.json +32 -16
  326. package/codeyam-cli/templates/expo-react-native/patches/expo-modules-autolinking+3.0.24.patch +29 -0
  327. package/codeyam-cli/templates/isolation-route/expo-router.tsx.template +54 -0
  328. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +1 -0
  329. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +1 -1
  330. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +47 -34
  331. package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +1 -1
  332. package/codeyam-cli/templates/seed-adapters/supabase.ts +271 -78
  333. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +34 -1
  334. package/package.json +2 -1
  335. package/packages/ai/src/lib/astScopes/methodSemantics.js +99 -0
  336. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  337. package/packages/ai/src/lib/astScopes/nodeToSource.js +16 -0
  338. package/packages/ai/src/lib/astScopes/nodeToSource.js.map +1 -1
  339. package/packages/ai/src/lib/astScopes/paths.js +12 -3
  340. package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
  341. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +27 -10
  342. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  343. package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js +9 -2
  344. package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js.map +1 -1
  345. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +14 -4
  346. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  347. package/packages/analyze/index.js +1 -1
  348. package/packages/analyze/index.js.map +1 -1
  349. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +16 -2
  350. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  351. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +6 -26
  352. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  353. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +3 -2
  354. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  355. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +9 -7
  356. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  357. package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js +14 -0
  358. package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js.map +1 -1
  359. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +44 -11
  360. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  361. package/packages/analyze/src/lib/files/analyzeChange.js +1 -0
  362. package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
  363. package/packages/analyze/src/lib/files/analyzeInitial.js +1 -0
  364. package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
  365. package/packages/analyze/src/lib/files/analyzeNextRoute.js +5 -1
  366. package/packages/analyze/src/lib/files/analyzeNextRoute.js.map +1 -1
  367. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +120 -28
  368. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  369. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +1368 -1193
  370. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  371. package/packages/database/src/lib/loadAnalysis.js +7 -1
  372. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  373. package/packages/database/src/lib/loadEntity.js +5 -5
  374. package/packages/database/src/lib/loadEntity.js.map +1 -1
  375. package/packages/utils/src/lib/fs/rsyncCopy.js +22 -1
  376. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  377. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Df3UCi8k.js +0 -34
  378. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-BBXArFPl.js +0 -43
  379. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +0 -1
  380. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-DPw7NZHc.js +0 -1
  381. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-Dmg9cGK3.js +0 -58
  382. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-DBa7T2FK.js +0 -41
  383. package/codeyam-cli/src/webserver/build/client/assets/globals-Bqg9V6XV.css +0 -1
  384. package/codeyam-cli/src/webserver/build/client/assets/manifest-422a3551.js +0 -1
  385. package/codeyam-cli/src/webserver/build/client/assets/root-ue8uWVRS.js +0 -67
  386. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-BxxP_XF9.js +0 -2
  387. package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-DXQyOV0G.js +0 -13
  388. package/codeyam-cli/src/webserver/build/server/assets/init-DL8vWZ6m.js +0 -10
  389. package/codeyam-cli/src/webserver/build/server/assets/server-build-BUKVjBSZ.js +0 -501
  390. package/codeyam-cli/templates/expo-react-native/app/(tabs)/_layout.tsx +0 -33
  391. package/codeyam-cli/templates/expo-react-native/app/(tabs)/index.tsx +0 -12
  392. package/codeyam-cli/templates/expo-react-native/app/(tabs)/settings.tsx +0 -12
@@ -1 +1 @@
1
- import{w as R,u as $,r as l,a as B,d as D,L as F}from"./chunk-JZWAC4HX-BBXArFPl.js";import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{u as O}from"./useReportContext-BermyNU5.js";import{S as U}from"./SafeScreenshot-CDoF7ZpU.js";import{L as V}from"./LoadingDots-By5zI316.js";import{E as P}from"./EntityTypeIcon-B6OMi58N.js";import{g as Y,a as Q,f as q}from"./fileTableUtils-Daa96Fr1.js";import{C as J}from"./chevron-down-BZ2DZxbW.js";import{S as K}from"./search-C0Uw0bcK.js";import{L as W}from"./loader-circle-DVQ0oHR7.js";import"./createLucideIcon-DJB0YQJL.js";const ce=()=>[{title:"Simulations - CodeYam"},{name:"description",content:"A visual gallery of your recently captured component screenshots"}],de=R(function(){const i=$(),c=i.entities,x=i.queueState;O({source:"simulations-page"});const[n,u]=l.useState(""),[d,S]=l.useState("visual"),g=l.useMemo(()=>{const a=[];return c.forEach(t=>{var y;const r=(y=t.analyses)==null?void 0:y[0];if(r!=null&&r.scenarios){const b=r.scenarios.filter(o=>{var m;return!((m=o.metadata)!=null&&m.sameAsDefault)}).map(o=>{var z,k,A,L,E;const m=(k=(z=o.metadata)==null?void 0:z.screenshotPaths)==null?void 0:k[0],N=(A=o.metadata)==null?void 0:A.noScreenshotSaved,M=m&&!N,T=(E=(L=r.status)==null?void 0:L.scenarios)==null?void 0:E.find(H=>H.name===o.name),I=T&&T.screenshotStartedAt&&!T.screenshotFinishedAt;let w;return M?w="completed":I?w="capturing":w="error",{scenarioName:o.name,scenarioDescription:o.description||"",screenshotPath:m||"",scenarioId:o.id,state:w}}).filter(o=>o.state==="completed"||o.state==="capturing");b.length>0&&a.push({entity:t,screenshots:b,createdAt:r.createdAt||""})}}),a.sort((t,r)=>new Date(r.createdAt).getTime()-new Date(t.createdAt).getTime()),a},[c]),v=l.useMemo(()=>c.filter(a=>{var y,b;const t=(y=a.analyses)==null?void 0:y[0];return!((b=t==null?void 0:t.scenarios)==null?void 0:b.some(o=>{var m,N;return(N=(m=o.metadata)==null?void 0:m.screenshotPaths)==null?void 0:N[0]}))}),[c]),p=l.useMemo(()=>g.filter(({entity:a})=>{const t=!n||a.name.toLowerCase().includes(n.toLowerCase()),r=d==="all"||a.entityType===d;return t&&r}),[g,n,d]),f=l.useMemo(()=>v.filter(a=>{const t=!n||a.name.toLowerCase().includes(n.toLowerCase()),r=d==="all"||a.entityType===d;return t&&r}),[v,n,d]),C=l.useCallback(a=>{u(a.target.value)},[]),j=l.useCallback(a=>{S(a.target.value)},[]),h=g.length>0;return e.jsx("div",{className:"bg-[#F8F7F6] min-h-screen overflow-y-auto",children:e.jsxs("div",{className:"px-20 py-12",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-[28px] font-semibold text-gray-900 mb-2",children:"Simulations"}),e.jsx("p",{className:"text-[15px] text-gray-500",children:"A visual gallery of your recently captured simulations."})]}),!h&&e.jsx("div",{className:"bg-[#D1F3F9] border border-[#A5E8F0] rounded-lg p-4 mb-6",children:e.jsxs("p",{className:"text-sm text-gray-700 m-0",children:["This page will display a visual gallery of your recently captured component simulations."," ",e.jsx("strong",{children:"Start by analyzing your first component below."})]})}),e.jsxs("div",{className:"bg-white border-b border-gray-200 rounded-t-lg px-5 py-4 mb-3",children:[e.jsx("div",{className:"text-[11px] text-gray-500 mb-2 uppercase",children:"Filters"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"appearance-none bg-gray-50 border border-gray-200 rounded px-3 pr-8 text-[13px] h-[39px] cursor-pointer focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] hover:border-gray-300 transition-colors",value:d,onChange:j,children:[e.jsx("option",{value:"all",children:"All Types"}),e.jsx("option",{value:"visual",children:"Visual"}),e.jsx("option",{value:"library",children:"Library"})]}),e.jsx(J,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-3 h-3 text-gray-500 pointer-events-none"})]}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(K,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search component",className:"w-full bg-gray-50 border border-gray-200 rounded pl-9 pr-3 text-[13px] h-[39px] placeholder:text-gray-400 focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] transition-colors",value:n,onChange:C})]})]})]}),h&&p.length>0&&e.jsx("div",{className:"mb-2",children:e.jsxs("div",{className:"flex items-center py-3",children:[e.jsxs("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#8b8b8b",fontWeight:500,letterSpacing:"0.05em"},children:[e.jsx("span",{style:{color:"#000000"},children:p.length})," ",p.length===1?"entity":"entities"]}),e.jsxs("div",{className:"relative group inline-flex items-center ml-1.5",children:[e.jsx("svg",{className:"w-3 h-3 text-gray-400 cursor-help",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsx("div",{className:"absolute left-0 top-full mt-2 hidden group-hover:block z-50 w-80",children:e.jsxs("div",{className:"bg-gray-900 text-white text-xs rounded-lg px-3 py-2 shadow-lg",children:["In CodeYam, an entity is a discrete, analyzable unit of code that can be independently simulated and tested.",e.jsx("div",{className:"absolute -top-1 left-4 w-2 h-2 bg-gray-900 transform rotate-45"})]})})]}),e.jsx("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#d1d5db",fontWeight:500,letterSpacing:"0.05em",marginLeft:"8px"},children:"|"}),e.jsxs("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#8b8b8b",fontWeight:500,letterSpacing:"0.05em",marginLeft:"8px"},children:[e.jsx("span",{style:{color:"#000000"},children:p.reduce((a,{screenshots:t})=>a+t.length,0)})," ","scenarios"]})]})}),e.jsxs("div",{className:"flex flex-col gap-3",children:[h&&(p.length===0?e.jsx("div",{className:"bg-white border border-gray-200 rounded-lg p-8 text-center text-gray-500",children:"No simulations match your filters."}):e.jsx(e.Fragment,{children:p.map(({entity:a,screenshots:t})=>e.jsx(G,{entity:a,screenshots:t,queueJobs:(x==null?void 0:x.jobs)||[]},a.sha))})),!h&&(f.length===0?e.jsx("div",{className:"bg-white border border-gray-200 rounded-b-lg p-8 text-center text-gray-500",children:"No components found matching your filters."}):f.map(a=>e.jsx(X,{entity:a},a.sha)))]})]})})});function G({entity:s,screenshots:i,queueJobs:c}){var j,h,a;const x=B(),n=D(),[u,d]=l.useState(!1),S=i.length||(((a=(h=(j=s.analyses)==null?void 0:j[0])==null?void 0:h.scenarios)==null?void 0:a.length)??0),g=t=>{x(`/entity/${s.sha}/scenarios/${t}?from=simulations`)},v=()=>{d(!0),n.submit({entitySha:s.sha,filePath:s.filePath||""},{method:"post",action:"/api/analyze"})};l.useEffect(()=>{n.state==="idle"&&u&&d(!1)},[n.state,u]);const p=Y(s,c),f=Q(p),C=p==="out-of-date";return e.jsx("div",{className:"rounded-[8px]",style:{backgroundColor:"#ffffff",border:"1px solid #e1e1e1"},children:e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center px-[15px] py-[15px]",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(P,{type:s.entityType||"other",size:"large"})}),e.jsxs("div",{className:"flex flex-col flex-shrink-0",style:{marginLeft:"15px",gap:"4px"},children:[e.jsxs("div",{className:"flex items-center gap-[5px]",children:[e.jsxs(F,{to:`/entity/${s.sha}`,className:"hover:underline cursor-pointer",title:s.name,style:{fontSize:"14px",lineHeight:"18px",color:"#343434",fontWeight:500},children:[s.name," (",S,")"]}),e.jsx("div",{className:"flex items-center justify-center px-2 rounded",style:{height:"20px",backgroundColor:f.bgColor,color:f.textColor,fontSize:"12px",lineHeight:"16px",fontWeight:400},children:f.text})]}),e.jsx("div",{style:{fontSize:"12px",lineHeight:"15px",color:"#b0b0b0",fontWeight:400},className:"font-mono",title:s.filePath,children:s.filePath})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex-shrink-0 flex items-center gap-2",children:[C&&e.jsx(e.Fragment,{children:u||n.state!=="idle"?e.jsxs("div",{className:"px-2 py-1 bg-pink-100 rounded flex items-center gap-1.5",children:[e.jsx(W,{size:14,className:"animate-spin",style:{color:"#be185d"}}),e.jsx("span",{style:{color:"#be185d",fontSize:"10px",lineHeight:"20px",fontWeight:600},children:"Analyzing..."})]}):e.jsx("button",{onClick:v,className:"px-[10px] rounded transition-colors whitespace-nowrap",style:{backgroundColor:"#005c75",color:"#ffffff",fontSize:"10px",lineHeight:"22px",fontWeight:600},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#004d5e"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#005c75"},children:"Re-analyze"})}),e.jsx("button",{onClick:()=>void x(`/entity/${s.sha}/logs`),className:"px-[10px] rounded transition-colors whitespace-nowrap",style:{backgroundColor:"#e0e9ec",color:"#005c75",fontSize:"10px",lineHeight:"22px",fontWeight:600},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#d0dfe3"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#e0e9ec"},children:"View Logs"})]})]}),e.jsx("div",{className:"border-t border-gray-200"}),e.jsx("div",{className:"flex gap-2.5 overflow-x-auto pb-3 px-[15px] pt-3",style:{paddingLeft:"47px"},children:i.length>0?i.map(t=>e.jsxs("div",{className:"shrink-0 flex flex-col gap-2",children:[e.jsx("button",{onClick:()=>g(t.scenarioId||""),className:"block cursor-pointer bg-transparent border-none p-0",children:e.jsx("div",{className:"w-36 h-24 rounded-md border overflow-hidden flex items-center justify-center transition-all",style:{"--hover-border":"#005C75",backgroundColor:t.state==="capturing"?"#f9f9f9":"#f3f4f6",borderColor:t.state==="capturing"?"#efefef":"#d1d5db"},onMouseEnter:r=>{t.state==="completed"&&(r.currentTarget.style.borderColor="#005C75",r.currentTarget.style.boxShadow="0 4px 12px rgba(0, 92, 117, 0.15)")},onMouseLeave:r=>{r.currentTarget.style.borderColor=t.state==="capturing"?"#efefef":"#d1d5db",r.currentTarget.style.boxShadow="none"},children:t.state==="completed"?e.jsx(U,{screenshotPath:t.screenshotPath,alt:t.scenarioName,className:"max-w-full max-h-full object-contain"}):t.state==="capturing"?e.jsx(V,{size:"medium"}):null})}),e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"text-left text-xs text-gray-600 cursor-default",style:{fontSize:"11px",lineHeight:"14px",maxWidth:"144px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.scenarioName}),e.jsx("div",{className:"fixed hidden group-hover:block pointer-events-none",style:{zIndex:1e4,transform:"translateY(8px)"},children:e.jsxs("div",{className:"bg-gray-100 text-gray-800 text-xs rounded-lg px-3 py-2 shadow-lg max-w-xs border border-gray-200",children:[t.scenarioName,t.scenarioDescription&&e.jsxs(e.Fragment,{children:[": ",t.scenarioDescription]}),e.jsx("div",{className:"absolute -top-1 left-4 w-2 h-2 bg-gray-100 border-l border-t border-gray-200 transform rotate-45"})]})})]})]},t.scenarioId)):e.jsx("div",{className:"text-xs text-gray-400 py-4",children:"No screenshots available"})})]})})}function X({entity:s}){const i=D(),[c,x]=l.useState(!1),n=()=>{x(!0),i.submit({entitySha:s.sha,filePath:s.filePath||""},{method:"post",action:"/api/analyze"})};return l.useEffect(()=>{i.state==="idle"&&c&&x(!1)},[i.state,c]),e.jsx("div",{className:"bg-white rounded hover:bg-gray-100 transition-colors cursor-pointer border-b border-[#e1e1e1]",onClick:n,children:e.jsxs("div",{className:"px-5 py-4 flex items-center",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx(P,{type:s.entityType}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-0.5",children:[e.jsx(F,{to:`/entity/${s.sha}`,className:"text-sm font-medium text-gray-900 no-underline",children:s.name}),e.jsx("span",{className:"text-[10px] font-semibold px-1 py-0.5 rounded",style:{color:s.entityType==="visual"?"#7c3aed":s.entityType==="library"?"#0DBFE9":s.entityType==="type"?"#dc2626":s.entityType==="data"?"#2563eb":s.entityType==="index"?"#ea580c":s.entityType==="functionCall"?"#7c3aed":s.entityType==="class"?"#059669":s.entityType==="method"?"#0891b2":"#6b7280",backgroundColor:s.entityType==="visual"?"#f3e8ff":s.entityType==="library"?"#cffafe":s.entityType==="type"?"#fee2e2":s.entityType==="data"?"#dbeafe":s.entityType==="index"?"#ffedd5":s.entityType==="functionCall"?"#f3e8ff":s.entityType==="class"?"#d1fae5":s.entityType==="method"?"#cffafe":"#f3f4f6"},children:s.entityType?s.entityType.toUpperCase():"UNKNOWN"})]}),e.jsx("div",{className:"text-xs text-gray-400 truncate",children:s.filePath})]})]}),e.jsx("div",{className:"w-32 flex justify-center",children:e.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-100 px-2 py-1 rounded",children:"Not analyzed"})}),e.jsx("div",{className:"w-32 text-center text-[10px] text-gray-500",children:q(s.createdAt||null)}),e.jsx("div",{className:"w-24 flex justify-end",children:c||i.state!=="idle"?e.jsxs("div",{className:"px-2 py-1 bg-pink-100 rounded text-xs text-pink-700 font-semibold flex items-center gap-1.5",children:[e.jsx(W,{size:14,className:"animate-spin"}),"Analyzing..."]}):e.jsx("button",{onClick:n,className:"bg-[#e0e9ec] text-[#005c75] px-4 py-1.5 rounded text-xs font-medium hover:bg-[#d0dde1] transition-colors cursor-pointer",children:"Analyze"})})]})})}export{de as default,ce as meta};
1
+ import{w as R,u as $,r as l,a as B,d as D,L as F}from"./chunk-UVKPFVEO-Bmq2apuh.js";import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{u as O}from"./useReportContext-jkCytuYz.js";import{S as U}from"./SafeScreenshot-DThcm_9M.js";import{L as V}from"./LoadingDots-By5zI316.js";import{E as P}from"./EntityTypeIcon-BsnEOJZ_.js";import{g as Y,a as Q,f as q}from"./fileTableUtils-Daa96Fr1.js";import{C as J}from"./chevron-down-B9fDzFVh.js";import{S as K}from"./search-BooqacKS.js";import{L as W}from"./loader-circle-D-q28GLF.js";import"./createLucideIcon-BwyFiRot.js";const ce=()=>[{title:"Simulations - CodeYam"},{name:"description",content:"A visual gallery of your recently captured component screenshots"}],de=R(function(){const i=$(),c=i.entities,x=i.queueState;O({source:"simulations-page"});const[n,u]=l.useState(""),[d,S]=l.useState("visual"),g=l.useMemo(()=>{const a=[];return c.forEach(t=>{var y;const r=(y=t.analyses)==null?void 0:y[0];if(r!=null&&r.scenarios){const b=r.scenarios.filter(o=>{var m;return!((m=o.metadata)!=null&&m.sameAsDefault)}).map(o=>{var z,k,A,L,E;const m=(k=(z=o.metadata)==null?void 0:z.screenshotPaths)==null?void 0:k[0],N=(A=o.metadata)==null?void 0:A.noScreenshotSaved,M=m&&!N,T=(E=(L=r.status)==null?void 0:L.scenarios)==null?void 0:E.find(H=>H.name===o.name),I=T&&T.screenshotStartedAt&&!T.screenshotFinishedAt;let w;return M?w="completed":I?w="capturing":w="error",{scenarioName:o.name,scenarioDescription:o.description||"",screenshotPath:m||"",scenarioId:o.id,state:w}}).filter(o=>o.state==="completed"||o.state==="capturing");b.length>0&&a.push({entity:t,screenshots:b,createdAt:r.createdAt||""})}}),a.sort((t,r)=>new Date(r.createdAt).getTime()-new Date(t.createdAt).getTime()),a},[c]),v=l.useMemo(()=>c.filter(a=>{var y,b;const t=(y=a.analyses)==null?void 0:y[0];return!((b=t==null?void 0:t.scenarios)==null?void 0:b.some(o=>{var m,N;return(N=(m=o.metadata)==null?void 0:m.screenshotPaths)==null?void 0:N[0]}))}),[c]),p=l.useMemo(()=>g.filter(({entity:a})=>{const t=!n||a.name.toLowerCase().includes(n.toLowerCase()),r=d==="all"||a.entityType===d;return t&&r}),[g,n,d]),f=l.useMemo(()=>v.filter(a=>{const t=!n||a.name.toLowerCase().includes(n.toLowerCase()),r=d==="all"||a.entityType===d;return t&&r}),[v,n,d]),C=l.useCallback(a=>{u(a.target.value)},[]),j=l.useCallback(a=>{S(a.target.value)},[]),h=g.length>0;return e.jsx("div",{className:"bg-[#F8F7F6] min-h-screen overflow-y-auto",children:e.jsxs("div",{className:"px-20 py-12",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-[28px] font-semibold text-gray-900 mb-2",children:"Simulations"}),e.jsx("p",{className:"text-[15px] text-gray-500",children:"A visual gallery of your recently captured simulations."})]}),!h&&e.jsx("div",{className:"bg-[#D1F3F9] border border-[#A5E8F0] rounded-lg p-4 mb-6",children:e.jsxs("p",{className:"text-sm text-gray-700 m-0",children:["This page will display a visual gallery of your recently captured component simulations."," ",e.jsx("strong",{children:"Start by analyzing your first component below."})]})}),e.jsxs("div",{className:"bg-white border-b border-gray-200 rounded-t-lg px-5 py-4 mb-3",children:[e.jsx("div",{className:"text-[11px] text-gray-500 mb-2 uppercase",children:"Filters"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"appearance-none bg-gray-50 border border-gray-200 rounded px-3 pr-8 text-[13px] h-[39px] cursor-pointer focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] hover:border-gray-300 transition-colors",value:d,onChange:j,children:[e.jsx("option",{value:"all",children:"All Types"}),e.jsx("option",{value:"visual",children:"Visual"}),e.jsx("option",{value:"library",children:"Library"})]}),e.jsx(J,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-3 h-3 text-gray-500 pointer-events-none"})]}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(K,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search component",className:"w-full bg-gray-50 border border-gray-200 rounded pl-9 pr-3 text-[13px] h-[39px] placeholder:text-gray-400 focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] transition-colors",value:n,onChange:C})]})]})]}),h&&p.length>0&&e.jsx("div",{className:"mb-2",children:e.jsxs("div",{className:"flex items-center py-3",children:[e.jsxs("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#8b8b8b",fontWeight:500,letterSpacing:"0.05em"},children:[e.jsx("span",{style:{color:"#000000"},children:p.length})," ",p.length===1?"entity":"entities"]}),e.jsxs("div",{className:"relative group inline-flex items-center ml-1.5",children:[e.jsx("svg",{className:"w-3 h-3 text-gray-400 cursor-help",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsx("div",{className:"absolute left-0 top-full mt-2 hidden group-hover:block z-50 w-80",children:e.jsxs("div",{className:"bg-gray-900 text-white text-xs rounded-lg px-3 py-2 shadow-lg",children:["In CodeYam, an entity is a discrete, analyzable unit of code that can be independently simulated and tested.",e.jsx("div",{className:"absolute -top-1 left-4 w-2 h-2 bg-gray-900 transform rotate-45"})]})})]}),e.jsx("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#d1d5db",fontWeight:500,letterSpacing:"0.05em",marginLeft:"8px"},children:"|"}),e.jsxs("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#8b8b8b",fontWeight:500,letterSpacing:"0.05em",marginLeft:"8px"},children:[e.jsx("span",{style:{color:"#000000"},children:p.reduce((a,{screenshots:t})=>a+t.length,0)})," ","scenarios"]})]})}),e.jsxs("div",{className:"flex flex-col gap-3",children:[h&&(p.length===0?e.jsx("div",{className:"bg-white border border-gray-200 rounded-lg p-8 text-center text-gray-500",children:"No simulations match your filters."}):e.jsx(e.Fragment,{children:p.map(({entity:a,screenshots:t})=>e.jsx(G,{entity:a,screenshots:t,queueJobs:(x==null?void 0:x.jobs)||[]},a.sha))})),!h&&(f.length===0?e.jsx("div",{className:"bg-white border border-gray-200 rounded-b-lg p-8 text-center text-gray-500",children:"No components found matching your filters."}):f.map(a=>e.jsx(X,{entity:a},a.sha)))]})]})})});function G({entity:s,screenshots:i,queueJobs:c}){var j,h,a;const x=B(),n=D(),[u,d]=l.useState(!1),S=i.length||(((a=(h=(j=s.analyses)==null?void 0:j[0])==null?void 0:h.scenarios)==null?void 0:a.length)??0),g=t=>{x(`/entity/${s.sha}/scenarios/${t}?from=simulations`)},v=()=>{d(!0),n.submit({entitySha:s.sha,filePath:s.filePath||""},{method:"post",action:"/api/analyze"})};l.useEffect(()=>{n.state==="idle"&&u&&d(!1)},[n.state,u]);const p=Y(s,c),f=Q(p),C=p==="out-of-date";return e.jsx("div",{className:"rounded-[8px]",style:{backgroundColor:"#ffffff",border:"1px solid #e1e1e1"},children:e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center px-[15px] py-[15px]",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(P,{type:s.entityType||"other",size:"large"})}),e.jsxs("div",{className:"flex flex-col flex-shrink-0",style:{marginLeft:"15px",gap:"4px"},children:[e.jsxs("div",{className:"flex items-center gap-[5px]",children:[e.jsxs(F,{to:`/entity/${s.sha}`,className:"hover:underline cursor-pointer",title:s.name,style:{fontSize:"14px",lineHeight:"18px",color:"#343434",fontWeight:500},children:[s.name," (",S,")"]}),e.jsx("div",{className:"flex items-center justify-center px-2 rounded",style:{height:"20px",backgroundColor:f.bgColor,color:f.textColor,fontSize:"12px",lineHeight:"16px",fontWeight:400},children:f.text})]}),e.jsx("div",{style:{fontSize:"12px",lineHeight:"15px",color:"#b0b0b0",fontWeight:400},className:"font-mono",title:s.filePath,children:s.filePath})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex-shrink-0 flex items-center gap-2",children:[C&&e.jsx(e.Fragment,{children:u||n.state!=="idle"?e.jsxs("div",{className:"px-2 py-1 bg-pink-100 rounded flex items-center gap-1.5",children:[e.jsx(W,{size:14,className:"animate-spin",style:{color:"#be185d"}}),e.jsx("span",{style:{color:"#be185d",fontSize:"10px",lineHeight:"20px",fontWeight:600},children:"Analyzing..."})]}):e.jsx("button",{onClick:v,className:"px-[10px] rounded transition-colors whitespace-nowrap",style:{backgroundColor:"#005c75",color:"#ffffff",fontSize:"10px",lineHeight:"22px",fontWeight:600},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#004d5e"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#005c75"},children:"Re-analyze"})}),e.jsx("button",{onClick:()=>void x(`/entity/${s.sha}/logs`),className:"px-[10px] rounded transition-colors whitespace-nowrap",style:{backgroundColor:"#e0e9ec",color:"#005c75",fontSize:"10px",lineHeight:"22px",fontWeight:600},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#d0dfe3"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#e0e9ec"},children:"View Logs"})]})]}),e.jsx("div",{className:"border-t border-gray-200"}),e.jsx("div",{className:"flex gap-2.5 overflow-x-auto pb-3 px-[15px] pt-3",style:{paddingLeft:"47px"},children:i.length>0?i.map(t=>e.jsxs("div",{className:"shrink-0 flex flex-col gap-2",children:[e.jsx("button",{onClick:()=>g(t.scenarioId||""),className:"block cursor-pointer bg-transparent border-none p-0",children:e.jsx("div",{className:"w-36 h-24 rounded-md border overflow-hidden flex items-center justify-center transition-all",style:{"--hover-border":"#005C75",backgroundColor:t.state==="capturing"?"#f9f9f9":"#f3f4f6",borderColor:t.state==="capturing"?"#efefef":"#d1d5db"},onMouseEnter:r=>{t.state==="completed"&&(r.currentTarget.style.borderColor="#005C75",r.currentTarget.style.boxShadow="0 4px 12px rgba(0, 92, 117, 0.15)")},onMouseLeave:r=>{r.currentTarget.style.borderColor=t.state==="capturing"?"#efefef":"#d1d5db",r.currentTarget.style.boxShadow="none"},children:t.state==="completed"?e.jsx(U,{screenshotPath:t.screenshotPath,alt:t.scenarioName,className:"max-w-full max-h-full object-contain"}):t.state==="capturing"?e.jsx(V,{size:"medium"}):null})}),e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"text-left text-xs text-gray-600 cursor-default",style:{fontSize:"11px",lineHeight:"14px",maxWidth:"144px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.scenarioName}),e.jsx("div",{className:"fixed hidden group-hover:block pointer-events-none",style:{zIndex:1e4,transform:"translateY(8px)"},children:e.jsxs("div",{className:"bg-gray-100 text-gray-800 text-xs rounded-lg px-3 py-2 shadow-lg max-w-xs border border-gray-200",children:[t.scenarioName,t.scenarioDescription&&e.jsxs(e.Fragment,{children:[": ",t.scenarioDescription]}),e.jsx("div",{className:"absolute -top-1 left-4 w-2 h-2 bg-gray-100 border-l border-t border-gray-200 transform rotate-45"})]})})]})]},t.scenarioId)):e.jsx("div",{className:"text-xs text-gray-400 py-4",children:"No screenshots available"})})]})})}function X({entity:s}){const i=D(),[c,x]=l.useState(!1),n=()=>{x(!0),i.submit({entitySha:s.sha,filePath:s.filePath||""},{method:"post",action:"/api/analyze"})};return l.useEffect(()=>{i.state==="idle"&&c&&x(!1)},[i.state,c]),e.jsx("div",{className:"bg-white rounded hover:bg-gray-100 transition-colors cursor-pointer border-b border-[#e1e1e1]",onClick:n,children:e.jsxs("div",{className:"px-5 py-4 flex items-center",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx(P,{type:s.entityType}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-0.5",children:[e.jsx(F,{to:`/entity/${s.sha}`,className:"text-sm font-medium text-gray-900 no-underline",children:s.name}),e.jsx("span",{className:"text-[10px] font-semibold px-1 py-0.5 rounded",style:{color:s.entityType==="visual"?"#7c3aed":s.entityType==="library"?"#0DBFE9":s.entityType==="type"?"#dc2626":s.entityType==="data"?"#2563eb":s.entityType==="index"?"#ea580c":s.entityType==="functionCall"?"#7c3aed":s.entityType==="class"?"#059669":s.entityType==="method"?"#0891b2":"#6b7280",backgroundColor:s.entityType==="visual"?"#f3e8ff":s.entityType==="library"?"#cffafe":s.entityType==="type"?"#fee2e2":s.entityType==="data"?"#dbeafe":s.entityType==="index"?"#ffedd5":s.entityType==="functionCall"?"#f3e8ff":s.entityType==="class"?"#d1fae5":s.entityType==="method"?"#cffafe":"#f3f4f6"},children:s.entityType?s.entityType.toUpperCase():"UNKNOWN"})]}),e.jsx("div",{className:"text-xs text-gray-400 truncate",children:s.filePath})]})]}),e.jsx("div",{className:"w-32 flex justify-center",children:e.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-100 px-2 py-1 rounded",children:"Not analyzed"})}),e.jsx("div",{className:"w-32 text-center text-[10px] text-gray-500",children:q(s.createdAt||null)}),e.jsx("div",{className:"w-24 flex justify-end",children:c||i.state!=="idle"?e.jsxs("div",{className:"px-2 py-1 bg-pink-100 rounded text-xs text-pink-700 font-semibold flex items-center gap-1.5",children:[e.jsx(W,{size:14,className:"animate-spin"}),"Analyzing..."]}):e.jsx("button",{onClick:n,className:"bg-[#e0e9ec] text-[#005c75] px-4 py-1.5 rounded text-xs font-medium hover:bg-[#d0dde1] transition-colors cursor-pointer",children:"Analyze"})})]})})}export{de as default,ce as meta};
@@ -1,4 +1,4 @@
1
- import{c as o}from"./createLucideIcon-DJB0YQJL.js";/**
1
+ import{c as o}from"./createLucideIcon-BwyFiRot.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./createLucideIcon-DJB0YQJL.js";/**
1
+ import{c as e}from"./createLucideIcon-BwyFiRot.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{r}from"./chunk-JZWAC4HX-BBXArFPl.js";function D({currentWidth:d,currentHeight:u,devicePresets:l,customSizes:i,onApply:a,onSave:b,onRemove:x,onClose:s}){const[n,o]=r.useState(String(d)),[c,y]=r.useState(String(u)),[m,p]=r.useState(""),[v,L]=r.useState(!1),w=r.useRef(null),S=r.useRef(null);r.useEffect(()=>{const t=N=>{w.current&&!w.current.contains(N.target)&&s()};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[s]),r.useEffect(()=>{const t=N=>{N.key==="Escape"&&s()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[s]),r.useEffect(()=>{var t;(t=S.current)==null||t.select()},[]);const g=parseInt(n,10),f=parseInt(c,10),h=g>0&&f>0,k=h&&(g!==d||f!==u),C=()=>{h&&(a({name:"Custom",width:g,height:f}),s())},E=()=>{const t=m.trim();!t||!h||(b(t,g,f),a({name:t,width:g,height:f}),s())},j=t=>{t.key==="Enter"&&(v&&m.trim()?E():k&&C())};return e.jsxs("div",{ref:w,className:"absolute top-full mt-1 right-0 bg-[#2a2a2a] border border-[#444] rounded-lg shadow-xl z-50 w-64",children:[l&&l.length>0&&e.jsxs("div",{className:"border-b border-[#444]",children:[e.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wider text-gray-500",children:"Presets"}),l.map(t=>e.jsxs("button",{onClick:()=>{a(t),s()},className:`w-full px-3 py-1.5 text-left text-xs transition-colors cursor-pointer ${t.width===d&&t.height===u?"text-white bg-[#444]":"text-gray-300 hover:text-white hover:bg-[#333]"}`,children:[e.jsx("span",{className:"font-medium",children:t.name}),e.jsxs("span",{className:"text-gray-500 ml-1.5",children:[t.width,"×",t.height]})]},t.name))]}),i.length>0&&e.jsxs("div",{className:"border-b border-[#444]",children:[e.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wider text-gray-500",children:"Saved Sizes"}),i.map(t=>e.jsxs("div",{className:"flex items-center group hover:bg-[#333] transition-colors",children:[e.jsxs("button",{onClick:()=>{a(t),s()},className:"flex-1 px-3 py-1.5 text-left text-xs text-gray-300 hover:text-white transition-colors cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:t.name}),e.jsxs("span",{className:"text-gray-500 ml-1.5",children:[t.width,"×",t.height]})]}),e.jsx("button",{onClick:()=>x(t.name),className:"px-2 py-1.5 text-gray-600 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-all cursor-pointer",title:"Remove",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]},t.name))]}),e.jsxs("div",{className:"p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("input",{ref:S,type:"number",value:n,onChange:t=>o(t.target.value),onKeyDown:j,min:"100",max:"7680",className:"w-full px-2 py-1.5 bg-[#1a1a1a] border border-[#555] rounded text-xs text-white text-center focus:outline-none focus:border-[#007a99] [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",placeholder:"Width"}),e.jsx("span",{className:"text-gray-500 text-xs flex-shrink-0",children:"×"}),e.jsx("input",{type:"number",value:c,onChange:t=>y(t.target.value),onKeyDown:j,min:"100",max:"7680",className:"w-full px-2 py-1.5 bg-[#1a1a1a] border border-[#555] rounded text-xs text-white text-center focus:outline-none focus:border-[#007a99] [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",placeholder:"Height"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:C,disabled:!h||!k,className:"flex-1 px-2 py-1.5 bg-[#007a99] text-white text-xs font-medium rounded hover:bg-[#006080] transition-colors cursor-pointer disabled:bg-[#333] disabled:text-gray-600 disabled:cursor-not-allowed",children:"Apply"}),v?e.jsxs("div",{className:"flex gap-1",children:[e.jsx("input",{type:"text",value:m,onChange:t=>p(t.target.value),onKeyDown:j,placeholder:"Name",className:"w-20 px-2 py-1.5 bg-[#1a1a1a] border border-[#555] rounded text-xs text-white focus:outline-none focus:border-[#007a99]",autoFocus:!0}),e.jsx("button",{onClick:E,disabled:!m.trim()||!h,className:"px-2 py-1.5 bg-[#007a99] text-white text-xs rounded hover:bg-[#006080] transition-colors cursor-pointer disabled:bg-[#333] disabled:text-gray-600 disabled:cursor-not-allowed",children:"OK"})]}):e.jsx("button",{onClick:()=>L(!0),disabled:!h,className:"px-2 py-1.5 bg-[#333] text-gray-300 text-xs rounded hover:bg-[#444] transition-colors cursor-pointer disabled:text-gray-600 disabled:cursor-not-allowed",title:"Save as preset",children:"Save"})]})]})]})}function I({width:d,height:u,onSave:l,onCancel:i}){const[a,b]=r.useState(""),[x,s]=r.useState(""),n=()=>{const o=a.trim();if(!o){s("Please enter a name");return}l(o)};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center p-4 z-50",children:e.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6 shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Save Custom Size"}),e.jsx("button",{onClick:i,className:"text-gray-400 hover:text-gray-600 transition-colors cursor-pointer","aria-label":"Close",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"mb-6 p-4 bg-gray-50 rounded-lg border border-gray-200",children:[e.jsx("div",{className:"text-sm text-gray-500 mb-1",children:"Dimensions"}),e.jsxs("div",{className:"text-lg font-medium text-gray-900",children:[d,"px × ",u,"px"]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"custom-size-name",className:"block text-sm font-medium text-gray-700 mb-2",children:"Name"}),e.jsx("input",{id:"custom-size-name",type:"text",value:a,onChange:o=>{b(o.target.value),s("")},onKeyDown:o=>{o.key==="Enter"&&a.trim()&&n(),o.key==="Escape"&&i()},placeholder:"e.g., iPhone 15 Pro",className:`w-full px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:border-[#005c75] ${x?"border-red-300":"border-gray-300"}`,autoFocus:!0}),x&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:x})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:i,className:"px-4 py-2 bg-gray-100 text-gray-700 text-sm font-medium rounded-md hover:bg-gray-200 transition-colors cursor-pointer",children:"Cancel"}),e.jsx("button",{onClick:n,disabled:!a.trim(),className:"px-4 py-2 bg-[#005c75] text-white text-sm font-medium rounded-md hover:bg-[#004a5c] transition-colors cursor-pointer disabled:bg-gray-300 disabled:cursor-not-allowed",children:"Save"})]})]})})}function R(d){const[u,l]=r.useState([]),i=d?`codeyam-custom-sizes-${d}`:null;r.useEffect(()=>{if(!i||typeof window>"u"){l([]);return}try{const s=localStorage.getItem(i);if(s){const n=JSON.parse(s);Array.isArray(n)&&l(n)}}catch(s){console.error("[useCustomSizes] Failed to load custom sizes:",s),l([])}},[i]);const a=r.useCallback(s=>{if(!(!i||typeof window>"u"))try{localStorage.setItem(i,JSON.stringify(s))}catch(n){console.error("[useCustomSizes] Failed to save custom sizes:",n)}},[i]),b=r.useCallback((s,n,o)=>{l(c=>{const y=c.findIndex(v=>v.name===s),m={name:s,width:n,height:o};let p;return y>=0?(p=[...c],p[y]=m):p=[...c,m],a(p),p})},[a]),x=r.useCallback(s=>{l(n=>{const o=n.filter(c=>c.name!==s);return a(o),o})},[a]);return{customSizes:u,addCustomSize:b,removeCustomSize:x}}export{D as C,I as S,R as u};
1
+ import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{r}from"./chunk-UVKPFVEO-Bmq2apuh.js";function D({currentWidth:d,currentHeight:u,devicePresets:l,customSizes:i,onApply:a,onSave:b,onRemove:x,onClose:s}){const[n,o]=r.useState(String(d)),[c,y]=r.useState(String(u)),[m,p]=r.useState(""),[v,L]=r.useState(!1),w=r.useRef(null),S=r.useRef(null);r.useEffect(()=>{const t=N=>{w.current&&!w.current.contains(N.target)&&s()};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[s]),r.useEffect(()=>{const t=N=>{N.key==="Escape"&&s()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[s]),r.useEffect(()=>{var t;(t=S.current)==null||t.select()},[]);const g=parseInt(n,10),f=parseInt(c,10),h=g>0&&f>0,k=h&&(g!==d||f!==u),C=()=>{h&&(a({name:"Custom",width:g,height:f}),s())},E=()=>{const t=m.trim();!t||!h||(b(t,g,f),a({name:t,width:g,height:f}),s())},j=t=>{t.key==="Enter"&&(v&&m.trim()?E():k&&C())};return e.jsxs("div",{ref:w,className:"absolute top-full mt-1 right-0 bg-[#2a2a2a] border border-[#444] rounded-lg shadow-xl z-50 w-64",children:[l&&l.length>0&&e.jsxs("div",{className:"border-b border-[#444]",children:[e.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wider text-gray-500",children:"Presets"}),l.map(t=>e.jsxs("button",{onClick:()=>{a(t),s()},className:`w-full px-3 py-1.5 text-left text-xs transition-colors cursor-pointer ${t.width===d&&t.height===u?"text-white bg-[#444]":"text-gray-300 hover:text-white hover:bg-[#333]"}`,children:[e.jsx("span",{className:"font-medium",children:t.name}),e.jsxs("span",{className:"text-gray-500 ml-1.5",children:[t.width,"×",t.height]})]},t.name))]}),i.length>0&&e.jsxs("div",{className:"border-b border-[#444]",children:[e.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wider text-gray-500",children:"Saved Sizes"}),i.map(t=>e.jsxs("div",{className:"flex items-center group hover:bg-[#333] transition-colors",children:[e.jsxs("button",{onClick:()=>{a(t),s()},className:"flex-1 px-3 py-1.5 text-left text-xs text-gray-300 hover:text-white transition-colors cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:t.name}),e.jsxs("span",{className:"text-gray-500 ml-1.5",children:[t.width,"×",t.height]})]}),e.jsx("button",{onClick:()=>x(t.name),className:"px-2 py-1.5 text-gray-600 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-all cursor-pointer",title:"Remove",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]},t.name))]}),e.jsxs("div",{className:"p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("input",{ref:S,type:"number",value:n,onChange:t=>o(t.target.value),onKeyDown:j,min:"100",max:"7680",className:"w-full px-2 py-1.5 bg-[#1a1a1a] border border-[#555] rounded text-xs text-white text-center focus:outline-none focus:border-[#007a99] [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",placeholder:"Width"}),e.jsx("span",{className:"text-gray-500 text-xs flex-shrink-0",children:"×"}),e.jsx("input",{type:"number",value:c,onChange:t=>y(t.target.value),onKeyDown:j,min:"100",max:"7680",className:"w-full px-2 py-1.5 bg-[#1a1a1a] border border-[#555] rounded text-xs text-white text-center focus:outline-none focus:border-[#007a99] [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",placeholder:"Height"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:C,disabled:!h||!k,className:"flex-1 px-2 py-1.5 bg-[#007a99] text-white text-xs font-medium rounded hover:bg-[#006080] transition-colors cursor-pointer disabled:bg-[#333] disabled:text-gray-600 disabled:cursor-not-allowed",children:"Apply"}),v?e.jsxs("div",{className:"flex gap-1",children:[e.jsx("input",{type:"text",value:m,onChange:t=>p(t.target.value),onKeyDown:j,placeholder:"Name",className:"w-20 px-2 py-1.5 bg-[#1a1a1a] border border-[#555] rounded text-xs text-white focus:outline-none focus:border-[#007a99]",autoFocus:!0}),e.jsx("button",{onClick:E,disabled:!m.trim()||!h,className:"px-2 py-1.5 bg-[#007a99] text-white text-xs rounded hover:bg-[#006080] transition-colors cursor-pointer disabled:bg-[#333] disabled:text-gray-600 disabled:cursor-not-allowed",children:"OK"})]}):e.jsx("button",{onClick:()=>L(!0),disabled:!h,className:"px-2 py-1.5 bg-[#333] text-gray-300 text-xs rounded hover:bg-[#444] transition-colors cursor-pointer disabled:text-gray-600 disabled:cursor-not-allowed",title:"Save as preset",children:"Save"})]})]})]})}function I({width:d,height:u,onSave:l,onCancel:i}){const[a,b]=r.useState(""),[x,s]=r.useState(""),n=()=>{const o=a.trim();if(!o){s("Please enter a name");return}l(o)};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center p-4 z-50",children:e.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6 shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Save Custom Size"}),e.jsx("button",{onClick:i,className:"text-gray-400 hover:text-gray-600 transition-colors cursor-pointer","aria-label":"Close",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"mb-6 p-4 bg-gray-50 rounded-lg border border-gray-200",children:[e.jsx("div",{className:"text-sm text-gray-500 mb-1",children:"Dimensions"}),e.jsxs("div",{className:"text-lg font-medium text-gray-900",children:[d,"px × ",u,"px"]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"custom-size-name",className:"block text-sm font-medium text-gray-700 mb-2",children:"Name"}),e.jsx("input",{id:"custom-size-name",type:"text",value:a,onChange:o=>{b(o.target.value),s("")},onKeyDown:o=>{o.key==="Enter"&&a.trim()&&n(),o.key==="Escape"&&i()},placeholder:"e.g., iPhone 15 Pro",className:`w-full px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:border-[#005c75] ${x?"border-red-300":"border-gray-300"}`,autoFocus:!0}),x&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:x})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:i,className:"px-4 py-2 bg-gray-100 text-gray-700 text-sm font-medium rounded-md hover:bg-gray-200 transition-colors cursor-pointer",children:"Cancel"}),e.jsx("button",{onClick:n,disabled:!a.trim(),className:"px-4 py-2 bg-[#005c75] text-white text-sm font-medium rounded-md hover:bg-[#004a5c] transition-colors cursor-pointer disabled:bg-gray-300 disabled:cursor-not-allowed",children:"Save"})]})]})})}function R(d){const[u,l]=r.useState([]),i=d?`codeyam-custom-sizes-${d}`:null;r.useEffect(()=>{if(!i||typeof window>"u"){l([]);return}try{const s=localStorage.getItem(i);if(s){const n=JSON.parse(s);Array.isArray(n)&&l(n)}}catch(s){console.error("[useCustomSizes] Failed to load custom sizes:",s),l([])}},[i]);const a=r.useCallback(s=>{if(!(!i||typeof window>"u"))try{localStorage.setItem(i,JSON.stringify(s))}catch(n){console.error("[useCustomSizes] Failed to save custom sizes:",n)}},[i]),b=r.useCallback((s,n,o)=>{l(c=>{const y=c.findIndex(v=>v.name===s),m={name:s,width:n,height:o};let p;return y>=0?(p=[...c],p[y]=m):p=[...c,m],a(p),p})},[a]),x=r.useCallback(s=>{l(n=>{const o=n.filter(c=>c.name!==s);return a(o),o})},[a]);return{customSizes:u,addCustomSize:b,removeCustomSize:x}}export{D as C,I as S,R as u};
@@ -0,0 +1,2 @@
1
+ import{r as t}from"./chunk-UVKPFVEO-Bmq2apuh.js";function U(c,s){const[R,l]=t.useState(""),[d,a]=t.useState(!1),[p,r]=t.useState(null),[C,o]=t.useState(null),[L,i]=t.useState(!1);t.useEffect(()=>{s&&(i(!1),a(!1),r(null),o(null))},[s]),t.useEffect(()=>{if(!c||!s){s||l("");return}const E=async()=>{if(!L)try{const u=await fetch(`/api/logs/${c}`);if(u.ok){const n=(await u.text()).trim().split(`
2
+ `).filter(e=>e.length>0);if(n.length<3){a(!1),i(!1),r(null),o(null),l("");return}const f=n.filter(e=>e.includes("CodeYam Log Level 1"));if(f.length>0){const e=f[f.length-1];l(e.replace(/.*CodeYam Log Level 1: /,""))}const $=n.find(e=>e.includes("$$INTERACTIVE_SERVER_URL$$:"));if($){const e=$.split("$$INTERACTIVE_SERVER_URL$$:")[1].trim();r(e),i(!0)}const I=n.find(e=>e.includes("$$INTERACTIVE_SCENARIO_URLS$$:"));if(I)try{const e=I.split("$$INTERACTIVE_SCENARIO_URLS$$:")[1].trim();o(JSON.parse(e))}catch{}n.some(e=>e.includes("CodeYam: Exiting start.js"))&&a(!0)}}catch{}};E().catch(()=>{});const h=setInterval(()=>{E().catch(()=>{})},500);return()=>clearInterval(h)},[c,s,L]);const g=t.useCallback(()=>{l(""),a(!1),r(null),o(null),i(!1)},[]);return{lastLine:R,interactiveUrl:p,scenarioUrlMap:C,isCompleted:d,resetLogs:g}}export{U as u};
@@ -1 +1 @@
1
- import{j as i}from"./jsx-runtime-D_zvdyIk.js";import{r as e,c as x}from"./chunk-JZWAC4HX-BBXArFPl.js";const s={source:"navbar"},r=e.createContext(void 0);function D({children:t}){const[n,o]=e.useState(s),a=e.useCallback(u=>{o(u)},[]),c=e.useCallback(()=>{o(s)},[]);return i.jsx(r.Provider,{value:{contextData:n,setContextData:a,resetContextData:c},children:t})}function p(t){const n=e.useContext(r),o=e.useRef(n);e.useEffect(()=>{if(o.current)return o.current.setContextData(t),()=>{var a;(a=o.current)==null||a.resetContextData()}},[t.source,t.entitySha,t.scenarioId,t.analysisId,t.entityName,t.entityType,t.scenarioName,t.errorMessage])}function m(){const t=e.useContext(r),n=x();return t?{source:t.contextData.source,entitySha:t.contextData.entitySha,scenarioId:t.contextData.scenarioId,analysisId:t.contextData.analysisId,currentUrl:n.pathname,entityName:t.contextData.entityName,entityType:t.contextData.entityType,scenarioName:t.contextData.scenarioName,errorMessage:t.contextData.errorMessage}:{source:"navbar",currentUrl:n.pathname}}export{D as R,m as a,p as u};
1
+ import{j as i}from"./jsx-runtime-D_zvdyIk.js";import{r as e,c as x}from"./chunk-UVKPFVEO-Bmq2apuh.js";const s={source:"navbar"},r=e.createContext(void 0);function D({children:t}){const[n,o]=e.useState(s),a=e.useCallback(u=>{o(u)},[]),c=e.useCallback(()=>{o(s)},[]);return i.jsx(r.Provider,{value:{contextData:n,setContextData:a,resetContextData:c},children:t})}function p(t){const n=e.useContext(r),o=e.useRef(n);e.useEffect(()=>{if(o.current)return o.current.setContextData(t),()=>{var a;(a=o.current)==null||a.resetContextData()}},[t.source,t.entitySha,t.scenarioId,t.analysisId,t.entityName,t.entityType,t.scenarioName,t.errorMessage])}function m(){const t=e.useContext(r),n=x();return t?{source:t.contextData.source,entitySha:t.contextData.entitySha,scenarioId:t.contextData.scenarioId,analysisId:t.contextData.analysisId,currentUrl:n.pathname,entityName:t.contextData.entityName,entityType:t.contextData.entityType,scenarioName:t.contextData.scenarioName,errorMessage:t.contextData.errorMessage}:{source:"navbar",currentUrl:n.pathname}}export{D as R,m as a,p as u};
@@ -1 +1 @@
1
- import{j as T}from"./jsx-runtime-D_zvdyIk.js";import{r as t}from"./chunk-JZWAC4HX-BBXArFPl.js";const n=t.createContext(void 0);function p({children:o}){const[i,r]=t.useState([]),c=t.useCallback((s,e="info",a=5e3)=>{const d={id:`toast-${Date.now()}-${Math.random()}`,message:s,type:e,duration:a};r(x=>[...x,d])},[]),u=t.useCallback(s=>{r(e=>e.filter(a=>a.id!==s))},[]);return T.jsx(n.Provider,{value:{toasts:i,showToast:c,closeToast:u},children:o})}function v(){const o=t.useContext(n);if(!o)throw new Error("useToast must be used within a ToastProvider");return o}export{p as T,v as u};
1
+ import{j as T}from"./jsx-runtime-D_zvdyIk.js";import{r as t}from"./chunk-UVKPFVEO-Bmq2apuh.js";const n=t.createContext(void 0);function p({children:o}){const[i,r]=t.useState([]),c=t.useCallback((s,e="info",a=5e3)=>{const d={id:`toast-${Date.now()}-${Math.random()}`,message:s,type:e,duration:a};r(x=>[...x,d])},[]),u=t.useCallback(s=>{r(e=>e.filter(a=>a.id!==s))},[]);return T.jsx(n.Provider,{value:{toasts:i,showToast:c,closeToast:u},children:o})}function v(){const o=t.useContext(n);if(!o)throw new Error("useToast must be used within a ToastProvider");return o}export{p as T,v as u};
@@ -0,0 +1,16 @@
1
+ import*as _ from"fs/promises";import*as h from"path";import{P as J,w as H}from"./progress-CHTtrxFG.js";import{ab as V,ac as B,ad as G,ae as U,af as K,ag as Q,ah as X,ai as Z,aj as W,ak as ee,u as te,al as re,am as oe,an as ne}from"./server-build-CNvgz1cC.js";import{spawn as z,execSync as se}from"child_process";import*as E from"fs";import{fileURLToPath as ie}from"url";import"fetch-retry";import"typescript";import"pluralize";import"piscina";import"json5";import"cli-spinners";import"chalk";import"react/jsx-runtime";import"node:stream";import"@react-router/node";import"react-router";import"isbot";import"react-dom/server";import"react";import"lucide-react";import"better-sqlite3";import"pg";import"kysely";import"kysely/helpers/sqlite";import"kysely/helpers/postgres";import"os";import"prompts";import"crypto";import"util";import"dotenv";import"events";import"uuid";import"http";import"net";import"ws";import"node-pty";import"openai";import"p-queue";import"p-retry";import"@aws-sdk/client-dynamodb";import"lru-cache";import"@aws-sdk/util-dynamodb";import"v8";import"react-syntax-highlighter";import"react-syntax-highlighter/dist/cjs/styles/prism/index.js";import"node:crypto";import"minimatch";import"react-markdown";import"remark-gfm";import"react-diff-viewer-continued";const ae=ie(import.meta.url),ce=h.dirname(ae);async function le(O){let a=O.port;const{rootPath:l,project:p,branch:k,processName:T="server"}=O;let m=!1;const{running:g,state:e,pids:y}=V();if(g&&e)if(e.cliVersion!==B)console.log(`CLI version mismatch (server: ${e.cliVersion??"unknown"} → CLI: ${B}), restarting server...`),G(),m=!0;else return{url:e.url,pid:e.pid,wasAlreadyRunning:!0};else g&&y&&y.length>0&&(U(a)||(a=K(a,U)));const C=`http://localhost:${a}`,f=h.join(ce,"..","webserver","bootstrap.js"),o=h.join(l,".codeyam","logs");E.existsSync(o)||E.mkdirSync(o,{recursive:!0});const D={CODEYAM_PORT:a.toString(),CODEYAM_ROOT_PATH:l,CODEYAM_PROJECT:p?JSON.stringify(p):"",CODEYAM_BRANCH:k?JSON.stringify(k):"",CODEYAM_PROCESS_NAME:`codeyam-${T}`,...m?{CODEYAM_WAIT_FOR_PORT:"true"}:{},...process.env.CODEYAM_TRACE_TRANSFORMS?{CODEYAM_TRACE_TRANSFORMS:process.env.CODEYAM_TRACE_TRANSFORMS}:{}};let d;if(process.platform==="win32")d=await pe(f,D,o);else{const n=E.openSync(h.join(o,"background-server.log"),"a"),r=E.openSync(h.join(o,"background-server-error.log"),"a"),w=z("node",["--max-old-space-size=8192",f],{detached:!0,stdio:["ignore",n,r],env:{...process.env,...D}});w.unref(),d=w.pid}try{const n=se(`lsof -ti:${a}`,{encoding:"utf8"}).trim();if(n){const r=n.split(`
2
+ `),w=r.find(R=>R===String(d)),s=r.filter(R=>R!==String(d));s.length>0&&console.warn(`[BackgroundServer] Port ${a} still held by other PID(s): ${s.join(", ")} (server PID: ${d})`)}}catch{}const L=`http://127.0.0.1:${a}/api/health`,v=6e4,F=500,c=Date.now();let u="",b=!1;for(;Date.now()-c<v;){try{process.kill(d,0)}catch{const r=((Date.now()-c)/1e3).toFixed(1);console.error(`[BackgroundServer] Server process (PID ${d}) died after ${r}s`);const w=h.join(o,"background-server.log");try{const $=E.readFileSync(w,"utf8").trim().split(`
3
+ `).slice(-15).join(`
4
+ `);console.error(`[BackgroundServer] Last log lines:
5
+ ${$}`)}catch{console.error(`[BackgroundServer] Could not read log at: ${w}`)}const s=h.join(o,"background-server-error.log");try{const $=E.readFileSync(s,"utf8").trim().split(`
6
+ `).slice(-15).join(`
7
+ `);$&&console.error(`[BackgroundServer] Error log:
8
+ ${$}`)}catch{}break}try{const r=await fetch(L);if(r.ok)break;u=`HTTP ${r.status}`}catch(r){u=r instanceof Error?r.message.split(`
9
+ `)[0]:String(r)}const n=Date.now()-c;n>=1e4&&!b?(console.log(`[BackgroundServer] Still waiting for server... (${(n/1e3).toFixed(0)}s, last: ${u})`),b=!0):n>=2e4&&n%1e4<F&&console.log(`[BackgroundServer] Still waiting... (${(n/1e3).toFixed(0)}s, last: ${u})`),await new Promise(r=>setTimeout(r,F))}if(Date.now()-c>=v){console.warn(`[BackgroundServer] Warning: Server did not become ready within ${v/1e3}s`),console.warn(`[BackgroundServer] Last error: ${u}`);const n=h.join(o,"background-server.log");try{const s=E.readFileSync(n,"utf8").trim().split(`
10
+ `).slice(-15).join(`
11
+ `);console.warn(`[BackgroundServer] Last log lines:
12
+ ${s}`)}catch{console.warn(`[BackgroundServer] Could not read log at: ${n}`)}}const x={pid:d,port:a,url:C,startTime:Date.now(),projectRoot:l,logDir:o,cliVersion:B};return Q(x),{url:C,pid:d,wasAlreadyRunning:!1}}async function pe(O,a,l){const p=m=>m.replace(/'/g,"''"),k=h.join(l,"start-server.ps1"),T=Object.entries(a).map(([m,g])=>`$env:${m} = '${p(g)}'`);return E.writeFileSync(k,[...T,`$env:CODEYAM_LOG_DIR = '${p(l)}'`,`$bootstrapPath = '${p(O)}'`,`$p = Start-Process -FilePath "node" -ArgumentList ('--max-old-space-size=8192', '"{0}"' -f $bootstrapPath) -WindowStyle Hidden -PassThru`,"Write-Output $p.Id"].join(`
13
+ `)),new Promise((m,g)=>{const e=z("powershell.exe",["-NoProfile","-ExecutionPolicy","Bypass","-File",k],{windowsHide:!0,stdio:["ignore","pipe","pipe"]});let y="",C="";e.stdout.on("data",o=>{y+=o.toString()}),e.stderr.on("data",o=>{C+=o.toString()});const f=setTimeout(()=>{e.kill(),g(new Error("Timed out waiting for PowerShell to start server (30s)"))},3e4);e.on("close",o=>{if(clearTimeout(f),o!==0){g(new Error(`Failed to start server via PowerShell (exit ${o}): ${C}`));return}const D=parseInt(y.trim(),10);if(isNaN(D)){g(new Error(`Failed to parse server PID from PowerShell output: ${y}`));return}m(D)})})}async function it(O){const{projectRoot:a,filePaths:l,entityNames:p,progress:k,context:T,scenarioCount:m,onlyDataStructure:g}=O,e=k||new J(!1);try{const t=X(a)}catch(t){throw e.fail("AI service configuration error"),t}const y=h.join(a,".codeyam","config.json");e.start("Loading project configuration...");const C=JSON.parse(await _.readFile(y,"utf8")),{projectSlug:f,branchId:o}=C;if(!f||!o)throw e.fail("Invalid project configuration"),new Error("Missing project slug or branch ID. Try reinitializing with: codeyam init --force");if(e.succeed("Loaded project configuration"),e.start("Validating environment..."),!await H(()=>ne()))throw e.fail("Environment validation failed"),new Error("Environment validation failed");e.succeed("Environment validated"),e.start("Loading project from database...");const{project:d,branch:L}=await Z(f);e.succeed("Loaded project and branch"),e.start("Starting web server...");const{url:v,wasAlreadyRunning:F}=await le({port:3111,rootPath:a,project:d,branch:L});F?e.succeed(`Web server already running at ${v}`):e.succeed(`Web server started at ${v}`);let c=[];if(p&&p.length>0){e.start(`Looking up ${p.length} entities...`);const t=await W({projectId:d.id,names:p,filePaths:l});if(t.length===0)throw e.fail(`No entities found with names: ${p.join(", ")}`),new Error(`Entities not found: ${p.join(", ")}`);c=t.map(i=>i.sha),e.succeed(`Found ${t.length} entities`)}else{e.start(`Looking up entities in ${l.length} files...`);const t=await W({projectId:d.id,filePaths:l});t.length>0?(c=t.map(i=>i.sha),e.succeed(`Found ${t.length} existing entities in database for ${l.length} files`)):e.succeed("No existing entities found (will be discovered)")}e.start("Snapshotting current code for analysis...");const u=await ee(d,L,l);e.succeed("Code snapshot created"),await te({commitSha:u.sha,runStatusUpdate:{queuedAt:new Date().toISOString(),currentEntityShas:c,entityCount:c.length>0?c.length:l.length,analysesCompleted:0,capturesCompleted:0,createdAt:new Date().toISOString()},updateCallback:t=>{const i=t.currentRun;if(i&&i.id&&i.archivedAt)return;i&&(i.analysesCompleted&&i.analysesCompleted>0||i.capturesCompleted&&i.capturesCompleted>0)&&re(t)}}),e.start("Enqueueing analysis job...");const b=await fetch(`${v}/api/queue`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"enqueue",type:"analysis",commitSha:u.sha,projectSlug:f,filePaths:l,entityShas:c,entityNames:p,...T?{context:T}:{},...m?{scenarioCount:m}:{},...g?{onlyDataStructure:!0}:{}})});if(!b.ok){const t=await b.json();throw new Error(`Failed to enqueue job: ${t.error||b.statusText}`)}const{jobId:x}=await b.json();e.succeed(`Job queued (${x.substring(0,8)})`),e.start(g?"Running import analysis...":"Running analysis and capture...");const n=oe(f);e.info(`Full analysis log: ${n}`);let r=0,w=0;const s=[],R=async()=>{try{const t=await _.stat(n);if(t.size>r){const i=(await import("fs")).createReadStream(n,{start:r,encoding:"utf8"});let A="";for await(const I of i)A+=I;r=t.size;const S=/CodeYam Log Level \d+: (.+)/g;let P;const j=[];for(;(P=S.exec(A))!==null;){const I=P[1];j.push(I)}const N=/CodeYam Error: (.+)/g;let Y;for(;(Y=N.exec(A))!==null;){const I=Y[1];s.includes(I)||s.push(I)}const q=Date.now();j.length>0&&q-w>500&&(e.update(j[j.length-1]),w=q)}}catch{}},M=setInterval(()=>{R().catch(()=>{})},500);try{let i=!1;for(;!i;){await new Promise(j=>setTimeout(j,1e3));const S=await fetch(`${v}/api/queue?queryType=job&jobId=${encodeURIComponent(x)}`);if(!S.ok)throw new Error(`Failed to check job status: ${S.statusText}`);const P=await S.json();if(P.status==="failed")throw new Error(`Analysis failed: ${P.error||"Unknown error"}`);P.status==="completed"&&(i=!0)}s.length>0?(e.warn(`Analysis completed with ${s.length} error(s):`),s.slice(0,5).forEach(S=>{console.log(` • ${S.substring(0,200)}${S.length>200?"...":""}`)}),s.length>5&&console.log(` ... and ${s.length-5} more errors`)):e.succeed("Analysis completed");const A=h.join(a,".codeyam","analysis-errors.txt");if(s.length>0){const S=[`Analysis errors — ${new Date().toISOString()}`,`Project: ${f}`,`Commit: ${u.sha}`,`Total errors: ${s.length}`,"─".repeat(60),""].join(`
14
+ `),P=s.map((j,N)=>`[${N+1}] ${j}`).join(`
15
+
16
+ `);await _.writeFile(A,S+P,"utf8"),e.warn("Full error report saved to .codeyam/analysis-errors.txt")}else try{await _.unlink(A)}catch{}}catch(t){throw e.fail(`Analysis failed — see full log: ${n}`),t&&typeof t=="object"&&!("commitSha"in t)&&(t.commitSha=u.sha,t.entityShas=c),t}finally{M&&clearInterval(M)}let $;return c.length===1?$=`http://localhost:3111/entity/${c[0]}`:$=`http://localhost:3111/commit/${u.sha}`,{commitSha:u.sha,entityShas:c,url:$}}export{it as runAnalysisForEntities};
@@ -1 +1 @@
1
- import"fetch-retry";import{K as Z,N as _,Q as $,R as aa,U as ea,W as sa,Z as ta,a1 as ra,a4 as oa,J as ia,L as ma,M as la,O as pa,P as na,S as ca,T as ba,V as Ta,X as da,Y as ua,_ as ha,$ as Ca,a0 as Sa,a2 as ya,a3 as Ba,a5 as Aa,I as Ea,a6 as Pa,a7 as ga,a8 as ja,aa as Fa,a9 as Ua,d as Da,a as Ga,b as Ma,c as qa,e as Ja,f as fa,g as ka,h as xa,i as Ha,j as La,k as va,E as wa,H as za,G as Ia,F as Ka,l as Na,m as Oa,n as Qa,o as Ra,p as Va,q as Wa,r as Xa,s as Ya,t as Za,u as _a,v as $a,w as ae,x as ee,y as se,z as te,A as re,B as oe,C as ie,D as me}from"./server-build-BUKVjBSZ.js";import"typescript";import"kysely";import"react/jsx-runtime";import"node:stream";import"@react-router/node";import"react-router";import"isbot";import"react-dom/server";import"react";import"lucide-react";import"better-sqlite3";import"pg";import"fs";import"path";import"kysely/helpers/sqlite";import"kysely/helpers/postgres";import"fs/promises";import"os";import"prompts";import"chalk";import"crypto";import"child_process";import"url";import"util";import"dotenv";import"events";import"uuid";import"http";import"net";import"ws";import"node-pty";import"openai";import"p-queue";import"p-retry";import"@aws-sdk/client-dynamodb";import"lru-cache";import"pluralize";import"piscina";import"json5";import"@aws-sdk/util-dynamodb";import"v8";import"react-syntax-highlighter";import"react-syntax-highlighter/dist/cjs/styles/prism/index.js";import"node:crypto";import"minimatch";import"react-markdown";import"remark-gfm";import"react-diff-viewer-continued";export{Z as AnalysisBranchesTableColumns,_ as BranchesTableColumns,$ as CommitsTableColumns,aa as CommitsTableColumnsLite,ea as EntitiesTableColumns,sa as EntityBranchesTableColumns,ta as FilesTableColumns,ra as ProjectsTableColumns,oa as ScenariosTableColumns,ia as createAnalysesTable,ma as createAnalysisBranchesTable,la as createBackgroundJobsTable,pa as createBranchesTable,na as createCommitBranchesTable,ca as createCommitsTable,ba as createEditorScenariosTable,Ta as createEntitiesTable,da as createEntityBranchesTable,ua as createEntityStatementsTable,ha as createFilesTable,Ca as createGithubPayloadsTable,Sa as createGithubUsersTable,ya as createProjectsTable,Ba as createScenarioCommentsTable,Aa as createScenariosTable,Ea as createSqliteSchema,Pa as createStatementsTable,ga as createTeamsTable,ja as createUserScenariosTable,Fa as createUserTeamsTable,Ua as createUsersTable,Da as dbToAnalysis,Ga as dbToAnalysisBranch,Ma as dbToBranch,qa as dbToCommit,Ja as dbToEntity,fa as dbToFile,ka as dbToProject,xa as dbToScenario,Ha as dbToUserScenario,La as deleteScenarios,va as generateSha,wa as getDatabase,za as getJsonHelper,Ia as getPostgreDatabase,Ka as getSqliteDatabase,Na as loadAnalyses,Oa as loadAnalysis,Qa as loadBranches,Ra as loadCommitBranches,Va as loadCommits,Wa as loadEntities,Xa as loadEntity,Ya as loadFiles,Za as loadProject,_a as updateCommitMetadata,$a as updateFreshAnalysisMetadata,ae as updateFreshAnalysisStatus,ee as updateProjectMetadata,se as upsertBranches,te as upsertCommitBranches,re as upsertCommits,oe as upsertGithubUser,ie as upsertProjects,me as upsertScenarios};
1
+ import"fetch-retry";import{K as Z,N as _,Q as $,R as aa,U as ea,W as sa,Z as ta,a1 as ra,a4 as oa,J as ia,L as ma,M as la,O as pa,P as na,S as ca,T as ba,V as Ta,X as da,Y as ua,_ as ha,$ as Ca,a0 as Sa,a2 as ya,a3 as Ba,a5 as Aa,I as Ea,a6 as Pa,a7 as ga,a8 as ja,aa as Fa,a9 as Ua,d as Da,a as Ga,b as Ma,c as qa,e as Ja,f as fa,g as ka,h as xa,i as Ha,j as La,k as va,E as wa,H as za,G as Ia,F as Ka,l as Na,m as Oa,n as Qa,o as Ra,p as Va,q as Wa,r as Xa,s as Ya,t as Za,u as _a,v as $a,w as ae,x as ee,y as se,z as te,A as re,B as oe,C as ie,D as me}from"./server-build-CNvgz1cC.js";import"typescript";import"react/jsx-runtime";import"node:stream";import"@react-router/node";import"react-router";import"isbot";import"react-dom/server";import"react";import"lucide-react";import"better-sqlite3";import"pg";import"fs";import"path";import"kysely";import"kysely/helpers/sqlite";import"kysely/helpers/postgres";import"fs/promises";import"os";import"prompts";import"chalk";import"crypto";import"child_process";import"url";import"util";import"dotenv";import"events";import"uuid";import"http";import"net";import"ws";import"node-pty";import"openai";import"p-queue";import"p-retry";import"@aws-sdk/client-dynamodb";import"lru-cache";import"pluralize";import"piscina";import"json5";import"@aws-sdk/util-dynamodb";import"v8";import"react-syntax-highlighter";import"react-syntax-highlighter/dist/cjs/styles/prism/index.js";import"node:crypto";import"minimatch";import"react-markdown";import"remark-gfm";import"react-diff-viewer-continued";export{Z as AnalysisBranchesTableColumns,_ as BranchesTableColumns,$ as CommitsTableColumns,aa as CommitsTableColumnsLite,ea as EntitiesTableColumns,sa as EntityBranchesTableColumns,ta as FilesTableColumns,ra as ProjectsTableColumns,oa as ScenariosTableColumns,ia as createAnalysesTable,ma as createAnalysisBranchesTable,la as createBackgroundJobsTable,pa as createBranchesTable,na as createCommitBranchesTable,ca as createCommitsTable,ba as createEditorScenariosTable,Ta as createEntitiesTable,da as createEntityBranchesTable,ua as createEntityStatementsTable,ha as createFilesTable,Ca as createGithubPayloadsTable,Sa as createGithubUsersTable,ya as createProjectsTable,Ba as createScenarioCommentsTable,Aa as createScenariosTable,Ea as createSqliteSchema,Pa as createStatementsTable,ga as createTeamsTable,ja as createUserScenariosTable,Fa as createUserTeamsTable,Ua as createUsersTable,Da as dbToAnalysis,Ga as dbToAnalysisBranch,Ma as dbToBranch,qa as dbToCommit,Ja as dbToEntity,fa as dbToFile,ka as dbToProject,xa as dbToScenario,Ha as dbToUserScenario,La as deleteScenarios,va as generateSha,wa as getDatabase,za as getJsonHelper,Ia as getPostgreDatabase,Ka as getSqliteDatabase,Na as loadAnalyses,Oa as loadAnalysis,Qa as loadBranches,Ra as loadCommitBranches,Va as loadCommits,Wa as loadEntities,Xa as loadEntity,Ya as loadFiles,Za as loadProject,_a as updateCommitMetadata,$a as updateFreshAnalysisMetadata,ae as updateFreshAnalysisStatus,ee as updateProjectMetadata,se as upsertBranches,te as upsertCommitBranches,re as upsertCommits,oe as upsertGithubUser,ie as upsertProjects,me as upsertScenarios};
@@ -0,0 +1,14 @@
1
+ import*as c from"fs/promises";import*as h from"fs";import*as e from"path";import x from"chalk";import{execSync as F}from"child_process";import{h as E,s as P,e as v,P as _,i as B,w as I}from"./progress-CHTtrxFG.js";import{ao as W,ap as R,aq as M,ab as O,ad as T,ar as A,as as G,at as N,F as U,I as q,an as Y,au as z,av as J,x as D}from"./server-build-CNvgz1cC.js";import"fetch-retry";import"typescript";import{fileURLToPath as L}from"url";import"cli-spinners";import"react/jsx-runtime";import"node:stream";import"@react-router/node";import"react-router";import"isbot";import"react-dom/server";import"react";import"lucide-react";import"better-sqlite3";import"pg";import"kysely";import"kysely/helpers/sqlite";import"kysely/helpers/postgres";import"os";import"prompts";import"crypto";import"util";import"dotenv";import"events";import"uuid";import"http";import"net";import"ws";import"node-pty";import"openai";import"p-queue";import"p-retry";import"@aws-sdk/client-dynamodb";import"lru-cache";import"pluralize";import"piscina";import"json5";import"@aws-sdk/util-dynamodb";import"v8";import"react-syntax-highlighter";import"react-syntax-highlighter/dist/cjs/styles/prism/index.js";import"node:crypto";import"minimatch";import"react-markdown";import"remark-gfm";import"react-diff-viewer-continued";function H(a){try{const r=F("git config --get remote.origin.url",{cwd:a,encoding:"utf8"}).trim().match(/github\.com[:/]([^/]+)\/([^/]+?)(?:\.git)?$/);if(r)return`${r[1]}-${r[2]}`}catch{}return e.basename(a)}const V=L(import.meta.url),K=e.dirname(V);async function g(a,t){await c.mkdir(t,{recursive:!0});const r=await c.readdir(a,{withFileTypes:!0});for(const i of r){const s=e.join(a,i.name),o=e.join(t,i.name);i.isDirectory()?await g(s,o):(await c.copyFile(s,o),(i.name.endsWith(".sh")||i.name.endsWith(".mjs"))&&await c.chmod(o,493))}}async function Q(a,t){const r=(t==null?void 0:t.mode)??"memory";try{const i=e.join(a,".claude","skills"),s=e.join(K,"../../templates"),o=e.join(s,"skills"),n=e.join(s,"commands"),p=e.join(i,"codeyam-memory"),u=e.join(i,"codeyam-new-rule");await g(e.join(o,"codeyam-memory"),p),await g(e.join(o,"codeyam-new-rule"),u);const w=r==="editor"||(t==null?void 0:t.editorMode)===!0;if(w){const d=e.join(i,"codeyam-editor");await g(e.join(o,"codeyam-editor"),d);let f="claude";try{const l=e.join(a,".codeyam","config.json");f=JSON.parse(await c.readFile(l,"utf8")).provider||"claude"}catch{}if(f==="gemini"){const l=e.join(a,"GEMINI.md");try{await c.access(l)}catch{await c.copyFile(e.join(s,"codeyam-editor-gemini.md"),l)}}else if(f==="codex"){const l=e.join(a,"AGENTS.md");try{await c.access(l)}catch{await c.copyFile(e.join(s,"codeyam-editor-codex.md"),l)}}else{const l=e.join(a,"CLAUDE.md");try{await c.access(l)}catch{await c.copyFile(e.join(s,"codeyam-editor-claude.md"),l)}}const m=e.join(a,".codeyam","docs");await c.mkdir(m,{recursive:!0}),await c.copyFile(e.join(s,"codeyam-editor-reference.md"),e.join(m,"editor-reference.md"))}if(r==="full"){const d=e.join(i,"codeyam-setup"),f=e.join(i,"codeyam-sim"),m=e.join(i,"codeyam-test"),l=e.join(i,"codeyam-verify"),S=e.join(i,"codeyam-dev-mode");await g(e.join(o,"codeyam-setup"),d),await g(e.join(o,"codeyam-sim"),f),await g(e.join(o,"codeyam-test"),m),await g(e.join(o,"codeyam-verify"),l),await g(e.join(o,"codeyam-dev-mode"),S);const k=e.join(a,".claude","commands");await c.mkdir(k,{recursive:!0}),await c.copyFile(e.join(n,"codeyam-diagnose.md"),e.join(k,"codeyam-diagnose.md"))}const y=e.join(a,".codeyam","bin");await c.mkdir(y,{recursive:!0});const j=e.join(a,".codeyam","rules");if(await c.mkdir(j,{recursive:!0}),w){try{const d=e.join(y,"editor-step-hook.py");await c.copyFile(e.join(s,"editor-step-hook.py"),d),await c.chmod(d,493)}catch{}try{const d=e.join(s,"seed-adapters"),f=e.join(a,".codeyam","seed-adapters");await g(d,f)}catch{}}try{const d=e.join(y,"memory-hook.sh");await c.copyFile(e.join(s,"codeyam-memory-hook.sh"),d),await c.chmod(d,493)}catch{}try{const d=e.join(y,"rule-reflection-hook.py");await c.copyFile(e.join(s,"rule-reflection-hook.py"),d),await c.chmod(d,493)}catch{}try{const d=e.join(y,"rule-notification-hook.py");await c.copyFile(e.join(s,"rule-notification-hook.py"),d),await c.chmod(d,493)}catch{}try{const d=e.join(y,"prompts");await c.mkdir(d,{recursive:!0});const f=await c.readdir(e.join(s,"prompts"));for(const m of f)await c.copyFile(e.join(s,"prompts",m),e.join(d,m))}catch{}try{await c.copyFile(e.join(s,"rules-instructions.md"),e.join(j,"instructions.md"))}catch{}return{success:!0,skillsPath:e.relative(a,i)}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}function X(a,t){const r=(t==null?void 0:t.mode)??"memory";try{const i=e.join(a,".claude"),s=e.join(i,"settings.local.json");h.existsSync(i)||h.mkdirSync(i,{recursive:!0});let o={};if(h.existsSync(s))try{const d=h.readFileSync(s,"utf8");o=JSON.parse(d)}catch{console.warn(`Warning: Could not parse ${s}, will create new file`)}o.permissions||(o.permissions={}),o.permissions.allow||(o.permissions.allow=[]);const n=["Skill(codeyam-memory)","Skill(codeyam-new-rule)","Bash(codeyam)","Bash(codeyam:*)","Read(.codeyam/**)","Edit(.codeyam/**)","Write(.codeyam/**)","Glob(.codeyam/**)"],p=["Skill(codeyam-setup)","Skill(codeyam-sim)","Skill(codeyam-debug)","Skill(codeyam-test)","Skill(codeyam-verify)","Skill(codeyam-dev-mode)","Read(/tmp/**)","Edit(/tmp/**)","Write(/tmp/**)","Glob(/tmp/**)","Bash(npm install:*)","Bash(npm run:*)","Bash(npx:*)","Bash(node:*)","Bash(cp:*)","Bash(mkdir:*)","Bash(chmod:*)","Bash(rm:*)","Bash(curl:*)","Bash(sleep:*)","Bash(echo:*)","Bash(grep:*)","Bash(python3:*)","Bash(cat:*)","Bash(printf:*)","Bash(ls:*)"],u=["Skill(codeyam-editor)","Bash(git:*)","Edit(**)","Write(**)"],w=r==="editor"||(t==null?void 0:t.editorMode)===!0;let y;if(r==="full"?y=[...n,...p]:r==="editor"?y=[...n,...u,...p]:y=n,w&&r!=="editor")for(const d of[...u,...p])y.includes(d)||y.push(d);let j=!1;for(const d of y)o.permissions.allow.includes(d)||(o.permissions.allow.push(d),j=!0);if(w){o.hooks||(o.hooks={});const d='test -f "$CLAUDE_PROJECT_DIR"/.codeyam/bin/editor-step-hook.py && python3 "$CLAUDE_PROJECT_DIR"/.codeyam/bin/editor-step-hook.py || true';for(const f of["PostToolUse","Stop","UserPromptSubmit"]){const m=o.hooks[f]||[];m.some(S=>{var k;return(k=S.hooks)==null?void 0:k.some(C=>{var $;return($=C.command)==null?void 0:$.includes("editor-step-hook")})})||(m.push({hooks:[{type:"command",command:d,timeout:5}]}),o.hooks[f]=m,j=!0)}}return j&&h.writeFileSync(s,JSON.stringify(o,null,2),"utf8"),!0}catch(i){return console.warn(`Warning: Could not configure Claude Code settings: ${i.message}`),!1}}function Z(a){return h.existsSync(a)?h.readFileSync(a,"utf8").split(`
2
+ `).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#")).map(r=>r.startsWith("/")?r.slice(1):r):[]}function ee(a){const t=[];function r(i){const s=e.join(i,".gitignore");if(h.existsSync(s)){const o=Z(s),n=e.relative(a,i),p=o.map(u=>n?e.join(n,u):u);t.push(...p)}try{const o=h.readdirSync(i,{withFileTypes:!0});for(const n of o)n.isDirectory()&&n.name!=="node_modules"&&n.name!==".git"&&n.name!=="dist"&&n.name!=="build"&&r(e.join(i,n.name))}catch{}}return r(a),t}function te(a){let t=a.replace(/\/$/,"");const r=t.startsWith("**/");r&&(t=t.slice(3));const i=t.startsWith("/");return i&&(t=t.slice(1)),t=t.replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),t=t.replace(/\\\*\\\*/g,".*").replace(/\\\*/g,"[^/]*").replace(/\\\?/g,"."),i&&!r?`^${t}(/.*)?$`:`^(.*/)?${t}(/.*)?$`}function oe(){return["^(.*/)?node_modules/.*$","^(.*/)?dist/.*$","^(.*/)?build/.*$","^(.*/)?\\.next/.*$","^(.*/)?out/.*$","^(.*/)?\\.cache/.*$","^(.*/)?__tests__/.*$","^(.*/)?__mocks__/.*$","^(.*/)?.+\\.test\\.(ts|tsx|js|jsx)$","^(.*/)?.+\\.spec\\.(ts|tsx|js|jsx)$","^(.*/)?test/.*$","^(.*/)?tests/.*$","^(.*/)?__test","^(.*/)?\\.git/.*$","^(.*/)?coverage/.*$","^(.*/)?\\.nyc_output/.*$","^(.*/)?\\.vscode/.*$","^(.*/)?\\.idea/.*$","^(.*/)?\\.DS_Store$"]}function ie(a){const t=oe();try{const i=ee(a).filter(o=>o.trim().length>0).map(o=>te(o)),s=[...t,...i];return Array.from(new Set(s))}catch(r){return console.warn("Failed to load gitignore patterns:",r),t}}const tt={command:"init",describe:"Initialize a project for CodeYam CLI analysis",builder:{force:{type:"boolean",alias:"f",describe:"Force initialization even if .codeyam already exists",default:!1},"keep-server":{type:"boolean",describe:"Skip stopping the running CodeYam server (use when running inside the editor)",default:!1},provider:{type:"string",describe:"The AI provider for the editor (claude, gemini, or codex)",choices:["claude","gemini","codex"],default:"claude"}},handler:async a=>{E("Initializing CodeYam CLI project");let t=W();if(t&&!a.force){P("Project already initialized. Use --force to reinitialize.");return}if(t||(t=process.cwd()),R(t)){v("Cannot initialize CodeYam in your home directory or filesystem root."),v("Please run codeyam init from inside a project directory.");return}M(t);const{running:r}=O();r&&!a["keep-server"]&&(T()?P("CodeYam server stopped"):v("Failed to stop CodeYam server - it may have already stopped"));const i=e.join(t,".codeyam"),s=e.join(i,"config.json"),o=new _;try{o.start("Setting up project scaffolding..."),await c.mkdir(i,{recursive:!0}),await ae(t),o.succeed("Project scaffolding ready");let n=H(t);try{const m=JSON.parse(h.readFileSync(s,"utf8"));m.projectSlug&&!m.projectSlug.startsWith("local-")&&(n=m.projectSlug)}catch{}const p=re(t);let u=[];try{u=A(t)}catch{}if(u.length>0){const m=u.map(l=>`${l.path==="."?"Root":l.path} (${l.framework})`).join(", ");B(`Found ${u.length} web application${u.length>1?"s":""}: ${m}`)}o.start("Configuring project...");const w=G(s),y={projectSlug:n,packageManager:p,webapps:u,environmentVariables:[],createdAt:new Date().toISOString(),provider:a.provider||"claude",handoff:{},...w};await c.writeFile(s,JSON.stringify(y,null,2));const j=N();if(!h.existsSync(j)){const m=U(j);await q(m)}if(!await I(()=>Y())){o.fail("Environment validation failed");return}try{const{project:m}=await z({slug:n,packageManager:p,unapprovedPaths:ie(t),webapps:u});o.succeed("Project configured"),o.start("Installing Claude Code skills...");const l=!!a["keep-server"],S=await Q(t,{mode:l?"editor":"memory",editorMode:l}),{branch:k}=await J(m);y.branchId=k.id,await c.writeFile(s,JSON.stringify(y,null,2)),X(t,{mode:l?"editor":"memory",editorMode:l}),S.success?o.succeed("Claude Code skills installed"):o.warn("Could not install skills");try{a["keep-server"]?await D({projectSlug:n,metadataUpdate:{editorMode:!0,labs:{simulations:!0}}}):await D({projectSlug:n,metadataUpdate:{labs:{simulations:!1}}})}catch{}y.aiMode="interactive"}catch(m){o.fail("Failed to create project"),v(m.message);return}const f=u.length>0?`, ${u.map(m=>m.framework).join(", ")}`:"";console.log(),P(`✨ Initialized ${n} (${p}${f})`),a.autoInit||(console.log(),console.log(x.bold(' Run "codeyam" to start the dashboard')),console.log(' Run "codeyam --help" for all commands'))}catch(n){o.fail("Failed to initialize project"),v(n.message),process.exit(1)}}};function re(a){return h.existsSync(e.join(a,"pnpm-lock.yaml"))?"pnpm":h.existsSync(e.join(a,"yarn.lock"))?"yarn":(h.existsSync(e.join(a,"package-lock.json")),"npm")}const b=[".codeyam/db.sqlite3",".codeyam/db.sqlite3-wal",".codeyam/db.sqlite3-shm",".codeyam/secrets.json",".codeyam/server.json",".codeyam/server-state.json",".codeyam/queue.json",".codeyam/active-scenario.json",".codeyam/editor-step.json",".codeyam/editor-user-prompt.txt",".codeyam/claude-session-id.txt",".codeyam/editor-mode-context.md",".codeyam/dev-mode-context.md",".codeyam/handoff-context.md",".codeyam/logs/",".codeyam/llm-calls/",".codeyam/captures/",".codeyam/results/",".codeyam/tmp/",".codeyam/rules/",".codeyam/bin/",".codeyam/docs/"];async function ae(a){const t=e.join(a,".gitignore");let r="";try{r=await c.readFile(t,"utf8")}catch{}const i=r.split(`
3
+ `),s=i.findIndex(n=>n.trim()===".codeyam"||n.trim()==="/.codeyam");if(s!==-1){const n=s>0&&i[s-1].trim().startsWith("# CodeYam local files")?s-1:s;i.splice(n,s-n+1),r=i.join(`
4
+ `)}if(b.some(n=>i.some(p=>p.trim()===n))){const n=b.filter(p=>!i.some(u=>u.trim()===p));if(n.length>0){const p=r+(r&&!r.endsWith(`
5
+ `)?`
6
+ `:"")+n.join(`
7
+ `)+`
8
+ `;await c.writeFile(t,p,"utf8")}}else{const n=`
9
+ # CodeYam - local only (not shared)
10
+ `+b.join(`
11
+ `)+`
12
+ `,p=r+(r&&!r.endsWith(`
13
+ `)?`
14
+ `:"")+n;await c.writeFile(t,p,"utf8")}}export{tt as default};