@lovelybunch/api 1.0.76-alpha.10 → 1.0.76-alpha.11

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 (244) hide show
  1. package/dist/lib/git.d.ts +3 -0
  2. package/dist/lib/git.js +35 -0
  3. package/dist/routes/api/v1/git/index.js +27 -1
  4. package/dist/routes/api/v1/resources/generate/route.js +10 -3
  5. package/dist/routes/api/v1/slack/route.d.ts +6 -6
  6. package/package.json +4 -4
  7. package/static/assets/{ActivityPage-B3rsYt_4.js → ActivityPage-CUPUsmhW.js} +1 -1
  8. package/static/assets/ActivityPage-DGW0f70r.js +1 -0
  9. package/static/assets/{AgentsContextEditPage-4D7qO4S-.js → AgentsContextEditPage-CBZaG033.js} +1 -1
  10. package/static/assets/AgentsContextEditPage-CJbx9qwA.js +9 -0
  11. package/static/assets/{AgentsContextPage-NmvLRo0k.js → AgentsContextPage-BWzSvM5V.js} +1 -1
  12. package/static/assets/AgentsContextPage-C1wcPVUs.js +1 -0
  13. package/static/assets/{ApiKeysSettingsPage-BGj5p9zw.js → ApiKeysSettingsPage-CauZEPsx.js} +1 -1
  14. package/static/assets/ApiKeysSettingsPage-Ceww_YUR.js +2 -0
  15. package/static/assets/{ArchitectureEditPage-DI2jNmc9.js → ArchitectureEditPage-DZhYQihz.js} +1 -1
  16. package/static/assets/ArchitectureEditPage-Dk8NNc4k.js +15 -0
  17. package/static/assets/{ArchitecturePage-DiIuThUM.js → ArchitecturePage-Cvj4j0Mo.js} +1 -1
  18. package/static/assets/ArchitecturePage-D0gLaPg5.js +1 -0
  19. package/static/assets/{AuthSettingsPage-DWuwxAS0.js → AuthSettingsPage-22eaC7la.js} +1 -1
  20. package/static/assets/AuthSettingsPage-BHPV0uSB.js +11 -0
  21. package/static/assets/{CallbackPage-BCmkYhEr.js → CallbackPage-DCf0WTl0.js} +1 -1
  22. package/static/assets/CallbackPage-buKCnkYC.js +1 -0
  23. package/static/assets/{CodePage-BZhIkymg.js → CodePage-CuyF2xDA.js} +1 -1
  24. package/static/assets/CodePage-x32C4yuN.js +2 -0
  25. package/static/assets/{CollapsibleSection-BJzLVd-x.js → CollapsibleSection-CUHXgJIe.js} +1 -1
  26. package/static/assets/CollapsibleSection-DMf0wWjc.js +1 -0
  27. package/static/assets/{DashboardPage-DtwE553F.js → DashboardPage-DIU-4dPO.js} +1 -1
  28. package/static/assets/DashboardPage-Dr4S3wVm.js +41 -0
  29. package/static/assets/{GitPage-qG7VYL9b.js → GitPage-BGHRNljT.js} +1 -1
  30. package/static/assets/GitPage-DpCcZosR.js +16 -0
  31. package/static/assets/{GitSettingsPage-C8Bgpj-X.js → GitSettingsPage-A4ty6ftB.js} +1 -1
  32. package/static/assets/GitSettingsPage-BRuP4Ihk.js +6 -0
  33. package/static/assets/{IdentityPage-Cf8Ruu-g.js → IdentityPage-4xn0DPW8.js} +1 -1
  34. package/static/assets/IdentityPage-Bps9Zjk3.js +6 -0
  35. package/static/assets/{ImplementationStepsEditor-BXIRT7o1.js → ImplementationStepsEditor-CaMsbJPb.js} +1 -1
  36. package/static/assets/ImplementationStepsEditor-KJkRc2Jn.js +6 -0
  37. package/static/assets/{IntegrationsSettingsPage-th56kUgi.js → IntegrationsSettingsPage-B1sX003q.js} +1 -1
  38. package/static/assets/IntegrationsSettingsPage-CpTuAA-H.js +1 -0
  39. package/static/assets/{JobDetailPage-ZyEcbPAe.js → JobDetailPage-BdYlGn4G.js} +1 -1
  40. package/static/assets/JobDetailPage-C5N3IyX3.js +1 -0
  41. package/static/assets/{KnowledgeDetailPage-BklEOfs0.js → KnowledgeDetailPage-Dvk-QAJJ.js} +1 -1
  42. package/static/assets/KnowledgeDetailPage-Dy0M4FgC.js +1 -0
  43. package/static/assets/{KnowledgeEditPage-BGqzVqHi.js → KnowledgeEditPage-CN0wPWMV.js} +1 -1
  44. package/static/assets/KnowledgeEditPage-DEP0bweP.js +1 -0
  45. package/static/assets/{KnowledgePage-Dmm7vzAj.js → KnowledgePage-BLe2lXja.js} +1 -1
  46. package/static/assets/KnowledgePage-_bvnWXPU.js +3 -0
  47. package/static/assets/{LoginPage-PDafaEnq.js → LoginPage-BkZt_pMw.js} +1 -1
  48. package/static/assets/LoginPage-VfOnXGad.js +1 -0
  49. package/static/assets/{MailInboxPage-M5_2gGkB.js → MailInboxPage-DklkHMyO.js} +1 -1
  50. package/static/assets/MailInboxPage-UF82OTOE.js +1 -0
  51. package/static/assets/{MailProcessingModal-C4PotIFc.js → MailProcessingModal-BHFYVTQc.js} +1 -1
  52. package/static/assets/MailProcessingModal-rKHRB-wC.js +6 -0
  53. package/static/assets/{MailReadPage-D32FUx5o.js → MailReadPage-B-vLDq-6.js} +1 -1
  54. package/static/assets/MailReadPage-mg3Wqvqh.js +1 -0
  55. package/static/assets/{MailSentPage-CjBrbezf.js → MailSentPage-DIJJ8I5v.js} +1 -1
  56. package/static/assets/MailSentPage-OJeb1vU9.js +1 -0
  57. package/static/assets/{McpSettingsPage-DxE-4YPc.js → McpSettingsPage-CgOnXuHZ.js} +1 -1
  58. package/static/assets/McpSettingsPage-Mi2-nB-i.js +1 -0
  59. package/static/assets/{MemoryEditPage-BlQ5EN1w.js → MemoryEditPage-CR6SmDXU.js} +1 -1
  60. package/static/assets/MemoryEditPage-D8i7XQ5l.js +13 -0
  61. package/static/assets/{MemoryPage-B8fsgW7z.js → MemoryPage-BcWVGuiS.js} +1 -1
  62. package/static/assets/MemoryPage-vbCtMG4L.js +1 -0
  63. package/static/assets/{NewKnowledgePage-CuH201xQ.js → NewKnowledgePage-BE4X0pSc.js} +1 -1
  64. package/static/assets/NewKnowledgePage-CL3dpMwb.js +1 -0
  65. package/static/assets/{NewSkillPage-BdX7eNoi.js → NewSkillPage-B3prwJ_n.js} +1 -1
  66. package/static/assets/NewSkillPage-BCJ68pFK.js +1 -0
  67. package/static/assets/{NewTaskPage-D9W2Yi0r.js → NewTaskPage-DszXfHrv.js} +1 -1
  68. package/static/assets/NewTaskPage-vj0LvAb_.js +91 -0
  69. package/static/assets/{NotFoundPage-D9tmTVho.js → NotFoundPage-D3K7UoeF.js} +1 -1
  70. package/static/assets/NotFoundPage-DqwQiMc8.js +6 -0
  71. package/static/assets/{NotificationsSettingsPage-B4lBxS8D.js → NotificationsSettingsPage-BSuXKPiG.js} +1 -1
  72. package/static/assets/NotificationsSettingsPage-C4Gthita.js +1 -0
  73. package/static/assets/{ProjectEditPage-DdqUI91K.js → ProjectEditPage-DTdhZKQg.js} +1 -1
  74. package/static/assets/ProjectEditPage-ia6zDqUf.js +11 -0
  75. package/static/assets/{ProjectPage-DB7ugw8l.js → ProjectPage-BIk487-h.js} +1 -1
  76. package/static/assets/ProjectPage-DJ5wGekX.js +1 -0
  77. package/static/assets/{PromptsSettingsPage-DFXoKUjj.js → PromptsSettingsPage-4iJoggN0.js} +1 -1
  78. package/static/assets/PromptsSettingsPage-COjiXPsT.js +1 -0
  79. package/static/assets/{ResourceDetailPage-CWc4YIMc.js → ResourceDetailPage-DJN3Rax4.js} +1 -1
  80. package/static/assets/ResourceDetailPage-DKs83OyV.js +1 -0
  81. package/static/assets/ResourcesPage-CO45MzEx.js +41 -0
  82. package/static/assets/ResourcesPage-DF8x1i_a.js +41 -0
  83. package/static/assets/{RoleEditPage-B20UAC2r.js → RoleEditPage-B0pm5rVn.js} +1 -1
  84. package/static/assets/RoleEditPage-CBl-M2s3.js +13 -0
  85. package/static/assets/{RolePage-C5Jf7wxY.js → RolePage-B7JswOZC.js} +1 -1
  86. package/static/assets/RolePage-IVBtcgCf.js +1 -0
  87. package/static/assets/{RulesSettingsPage-91WP1FQf.js → RulesSettingsPage-CB6YdyhI.js} +1 -1
  88. package/static/assets/RulesSettingsPage-CKUt1JkO.js +16 -0
  89. package/static/assets/{SchedulePage-BijprHGn.js → SchedulePage-TCeGDlnw.js} +1 -1
  90. package/static/assets/SchedulePage-_NAbasKs.js +4 -0
  91. package/static/assets/{SkillDetailPage-Cpxz_wmk.js → SkillDetailPage-7EzSwjPh.js} +1 -1
  92. package/static/assets/SkillDetailPage-jTeSohec.js +1 -0
  93. package/static/assets/{SkillEditPage-Cz7VRg0r.js → SkillEditPage-CpouyjFV.js} +1 -1
  94. package/static/assets/SkillEditPage-D_e69AQk.js +1 -0
  95. package/static/assets/{SkillsPage-Bxmsi6Xd.js → SkillsPage-DP8zSnPo.js} +1 -1
  96. package/static/assets/SkillsPage-xfv43oJ4.js +8 -0
  97. package/static/assets/{SkillsSettingsPage-Cysx53Au.js → SkillsSettingsPage-CktzJBa7.js} +1 -1
  98. package/static/assets/SkillsSettingsPage-jhNVgVSA.js +1 -0
  99. package/static/assets/{SourceInput-D59F7hff.js → SourceInput-CQnyDxzl.js} +1 -1
  100. package/static/assets/SourceInput-KeAQ1PMl.js +1 -0
  101. package/static/assets/{TagInput-BH6wDXWJ.js → TagInput-DoO2Dwj6.js} +1 -1
  102. package/static/assets/TagInput-ZyP8Rq8B.js +1 -0
  103. package/static/assets/{TaskDetailPage-5ktdWaTr.js → TaskDetailPage-C6xKC_IM.js} +1 -1
  104. package/static/assets/TaskDetailPage-z557zwfE.js +16 -0
  105. package/static/assets/{TaskEditPage-CIZWp_s4.js → TaskEditPage-DPLOeh7K.js} +1 -1
  106. package/static/assets/TaskEditPage-XuWzVm-k.js +1 -0
  107. package/static/assets/{TasksPage-BNXDm-Er.js → TasksPage-C-toKZIZ.js} +1 -1
  108. package/static/assets/TasksPage-CwfLwTAV.js +17 -0
  109. package/static/assets/{TeamEditPage-C10siqme.js → TeamEditPage-B8qk6fWu.js} +1 -1
  110. package/static/assets/TeamEditPage-Dk7Yxh1i.js +9 -0
  111. package/static/assets/{TeamPage-CXpZVAfy.js → TeamPage-CQ4EE1rP.js} +1 -1
  112. package/static/assets/TeamPage-Dmrjf_RA.js +1 -0
  113. package/static/assets/{TerminalPage-DJ-Tu_hG.js → TerminalPage-C0CSp8st.js} +1 -1
  114. package/static/assets/TerminalPage-Y59DZGfZ.js +1 -0
  115. package/static/assets/{TerminalSessionPage-BLryJlkL.js → TerminalSessionPage-BQOMLYPX.js} +1 -1
  116. package/static/assets/TerminalSessionPage-HvnYJEpU.js +3 -0
  117. package/static/assets/{UserPreferencesPage-BvAcv5tt.js → UserPreferencesPage-1l5T8TaE.js} +1 -1
  118. package/static/assets/UserPreferencesPage-BSIvW5UI.js +1 -0
  119. package/static/assets/{UserSettingsPage-NQfoOvHf.js → UserSettingsPage-CS7BrEZJ.js} +1 -1
  120. package/static/assets/UserSettingsPage-o4ikmR9k.js +1 -0
  121. package/static/assets/{UtilitiesPage-NnBCWVn8.js → UtilitiesPage-D1YCA1eC.js} +1 -1
  122. package/static/assets/UtilitiesPage-O5kjW0V2.js +1 -0
  123. package/static/assets/{alert-CMfexl-V.js → alert-DOfUEE4H.js} +1 -1
  124. package/static/assets/alert-u79hLEuY.js +1 -0
  125. package/static/assets/{arrow-down-7VoAlw8h.js → arrow-down-DumN-Nal.js} +1 -1
  126. package/static/assets/arrow-down-Y539lEoZ.js +6 -0
  127. package/static/assets/{arrow-left-CkQCXG-O.js → arrow-left-B_QwfLPP.js} +1 -1
  128. package/static/assets/arrow-left-DmNgC0xD.js +6 -0
  129. package/static/assets/{arrow-up-Bozm6eto.js → arrow-up-B3Oj7MxZ.js} +1 -1
  130. package/static/assets/arrow-up-BbDrY9nh.js +6 -0
  131. package/static/assets/{arrow-up-down-BgZelEPF.js → arrow-up-down-D8T0kR2Q.js} +1 -1
  132. package/static/assets/arrow-up-down-DDTTwJEF.js +6 -0
  133. package/static/assets/{badge-CKqDVhJv.js → badge-BmHXIBBB.js} +1 -1
  134. package/static/assets/badge-BzEwwrAP.js +1 -0
  135. package/static/assets/{browser-modal-CIOZi1Jw.js → browser-modal-4AfJ98X7.js} +1 -1
  136. package/static/assets/browser-modal-CY4F-Mm8.js +6 -0
  137. package/static/assets/{card-jBf8qQSy.js → card-BpqK1BMM.js} +1 -1
  138. package/static/assets/card-Btt3HmXT.js +1 -0
  139. package/static/assets/{chevron-left-D1qHCYRd.js → chevron-left-CSCdB-iz.js} +1 -1
  140. package/static/assets/chevron-left-DztJMlwc.js +6 -0
  141. package/static/assets/{chevron-up-CcwaoTsZ.js → chevron-up-DaWWwb87.js} +1 -1
  142. package/static/assets/chevron-up-gnoSEbf_.js +6 -0
  143. package/static/assets/{chevrons-up-BtlNQbrw.js → chevrons-up-B2GdB4F7.js} +1 -1
  144. package/static/assets/chevrons-up-D7gsSI9g.js +11 -0
  145. package/static/assets/{circle-alert-DqK0nUqF.js → circle-alert-CQ-Ir4mS.js} +1 -1
  146. package/static/assets/circle-alert-Coa2ulVd.js +6 -0
  147. package/static/assets/{circle-check-qo4cPVA1.js → circle-check-01UufaGN.js} +1 -1
  148. package/static/assets/circle-check-C9wy7OAO.js +6 -0
  149. package/static/assets/{circle-check-big-DDQIqE0G.js → circle-check-big-CVbQ_zpj.js} +1 -1
  150. package/static/assets/circle-check-big-DqKKs8fZ.js +6 -0
  151. package/static/assets/{circle-play-CQ-UItmT.js → circle-play-COMPwZ00.js} +1 -1
  152. package/static/assets/circle-play-DoomwgYb.js +6 -0
  153. package/static/assets/{circle-x-Bd57ohC5.js → circle-x-Cs5S3HID.js} +1 -1
  154. package/static/assets/circle-x-Du7Cp5MD.js +6 -0
  155. package/static/assets/{clipboard-JQLlAwqS.js → clipboard-C-VV2jbC.js} +1 -1
  156. package/static/assets/clipboard-CqRqQoij.js +11 -0
  157. package/static/assets/{clock-DTp411N-.js → clock-BKOkXNLP.js} +1 -1
  158. package/static/assets/clock-ehUSUqcI.js +6 -0
  159. package/static/assets/{code-Bi-U-NxE.js → code-CmFlYUo3.js} +1 -1
  160. package/static/assets/code-kQPD6ttp.js +6 -0
  161. package/static/assets/{download-DNaE6rtO.js → download-Cg0a1Yh4.js} +1 -1
  162. package/static/assets/download-D8TKj0Hc.js +6 -0
  163. package/static/assets/{external-link-DRsIhdWR.js → external-link-BSAlwNHq.js} +1 -1
  164. package/static/assets/external-link-BVrPPG_7.js +6 -0
  165. package/static/assets/{eye-jqpFU8Rl.js → eye-AP4j25wH.js} +1 -1
  166. package/static/assets/eye-DWC_Vybx.js +6 -0
  167. package/static/assets/{folder-git-2-ixHmuqNj.js → folder-git-2-CMtTePKY.js} +1 -1
  168. package/static/assets/folder-git-2-Ds9p-D0Q.js +6 -0
  169. package/static/assets/{globe-BZEWER4V.js → globe-CJrZCIc6.js} +1 -1
  170. package/static/assets/globe-DwQuaM7_.js +6 -0
  171. package/static/assets/{index-UDlexUv4.js → index-0sq0wwbr.js} +1 -1
  172. package/static/assets/{index-M-XcYp88.js → index-B0Cea36W.js} +1 -1
  173. package/static/assets/{index-D-5sddKG.js → index-B0g-CMWG.js} +1 -1
  174. package/static/assets/{index-CiS46Fde.js → index-BFEMYO_w.js} +1 -1
  175. package/static/assets/{index-htJaaOEZ.js → index-BFevJCwl.js} +1 -1
  176. package/static/assets/{index-CK5AHHmM.js → index-BK1-hIKa.js} +1 -1
  177. package/static/assets/index-BMie63_b.js +1 -0
  178. package/static/assets/{index-2_Tb936f.js → index-BZvWD4ai.js} +1 -1
  179. package/static/assets/{index-C3ao8yMv.js → index-BlyysfDZ.js} +1 -1
  180. package/static/assets/{index-BGKQ2Csq.js → index-BpQ9T8mu.js} +1 -1
  181. package/static/assets/{index-CoeRBZRl.js → index-Bpm_mSd3.js} +1 -1
  182. package/static/assets/{index-B8B_4B2l.js → index-Brkkhgwq.js} +1 -1
  183. package/static/assets/{index-BD47WGC6.js → index-Bvj_HZmE.js} +1 -1
  184. package/static/assets/index-CE8kBKLn.js +1 -0
  185. package/static/assets/index-CL_XsRD7.js +1 -0
  186. package/static/assets/index-C_KCaLlP.js +502 -0
  187. package/static/assets/index-CfcUrE_I.js +1 -0
  188. package/static/assets/index-CisT9m8F.js +3 -0
  189. package/static/assets/index-CiyjdZHh.js +1 -0
  190. package/static/assets/index-CtnO1D9D.js +1 -0
  191. package/static/assets/{index-Bft1WzL9.js → index-D3hMbDtK.js} +1 -1
  192. package/static/assets/{index-DHAvHhw0.js → index-DBS4Ya9k.js} +1 -1
  193. package/static/assets/index-DEmcF6vO.js +1 -0
  194. package/static/assets/index-DYBGl9Zy.js +1 -0
  195. package/static/assets/{index-DffngCzC.js → index-DgeHIphZ.js} +1 -1
  196. package/static/assets/{index-BLjvGp1F.js → index-Digxc7bT.js} +1 -1
  197. package/static/assets/index-Dih0CGHs.js +1 -0
  198. package/static/assets/index-DoDazQp9.js +1 -0
  199. package/static/assets/index-DvviZzdo.js +1 -0
  200. package/static/assets/index-Dz52SxOy.js +2 -0
  201. package/static/assets/{index-CdmUQF6-.js → index-J8MrpD0P.js} +1 -1
  202. package/static/assets/index-NgkIT4SV.js +1 -0
  203. package/static/assets/index-PBkZiuRI.js +1 -0
  204. package/static/assets/{index-CtWTFIFI.js → index-ZJ8xZq44.js} +1 -1
  205. package/static/assets/index-oKV7MVo_.js +1 -0
  206. package/static/assets/{index-BWhM9fZn.js → index-opozMhku.js} +2 -2
  207. package/static/assets/index-vk3KOxHi.js +7 -0
  208. package/static/assets/index-wmWBSeOM.js +1 -0
  209. package/static/assets/{info-Na9GqbtC.js → info-D-7cQBbP.js} +1 -1
  210. package/static/assets/info-NEnL4zqX.js +6 -0
  211. package/static/assets/{label-CHVVHrlr.js → label-bMzKAcdZ.js} +1 -1
  212. package/static/assets/label-wtSCiOqT.js +1 -0
  213. package/static/assets/{markdown-editor-CT9CPLw5.js → markdown-editor-B3gIcmI2.js} +3 -3
  214. package/static/assets/markdown-editor-D_er7zWv.js +111 -0
  215. package/static/assets/{message-square-B5NR6hzj.js → message-square-Ca07XC8m.js} +1 -1
  216. package/static/assets/message-square-CvZFZAL0.js +6 -0
  217. package/static/assets/{paperclip-SI0kWfGf.js → paperclip-BICwD8BW.js} +1 -1
  218. package/static/assets/paperclip-D9bkHCO9.js +6 -0
  219. package/static/assets/{pause-DKI9nsrI.js → pause-CZwBxJjx.js} +1 -1
  220. package/static/assets/pause-DrtOMeDr.js +6 -0
  221. package/static/assets/{play-BTA0gBuh.js → play-BjDbhEcg.js} +1 -1
  222. package/static/assets/play-CQk31OJN.js +6 -0
  223. package/static/assets/{radio-group-BO2__pxZ.js → radio-group-BpmJzTM1.js} +1 -1
  224. package/static/assets/radio-group-DqCmfTij.js +1 -0
  225. package/static/assets/{refresh-cw-DLJpfa8_.js → refresh-cw-CZLHY6zD.js} +1 -1
  226. package/static/assets/refresh-cw-yMcSYdEF.js +6 -0
  227. package/static/assets/{search-SRuczbr5.js → search-Cz2_2BkO.js} +1 -1
  228. package/static/assets/search-_5ueAoCg.js +6 -0
  229. package/static/assets/{select-D8HyxWyg.js → select-9YyUa5YH.js} +1 -1
  230. package/static/assets/select-BKdFrV6O.js +1 -0
  231. package/static/assets/{switch-Ck0OeSLk.js → switch-Bhm5em7I.js} +1 -1
  232. package/static/assets/switch-D7e1drXt.js +1 -0
  233. package/static/assets/{tabs-CmFe8eVW.js → tabs-oeAz0IIg.js} +1 -1
  234. package/static/assets/tabs-qMSIjEoX.js +1 -0
  235. package/static/assets/{tag-BTjGQC_2.js → tag-D5LBbacJ.js} +1 -1
  236. package/static/assets/tag-dBrNwRvH.js +6 -0
  237. package/static/assets/{terminal-preview-BkQIuk__.js → terminal-preview-BZXyNaM9.js} +1 -1
  238. package/static/assets/terminal-preview-C3WCC5tV.js +1 -0
  239. package/static/assets/{use-terminal-CrqBojgD.js → use-terminal-CSttRkql.js} +1 -1
  240. package/static/assets/use-terminal-FzuSKCnc.js +1 -0
  241. package/static/assets/{video-BlwRNgSo.js → video-D7SzAtAp.js} +1 -1
  242. package/static/assets/video-DKqt_ev6.js +36 -0
  243. package/static/index.html +1 -1
  244. package/static/assets/ResourcesPage-BK-EXoIA.js +0 -41
package/dist/lib/git.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { InstructionFileKind, InstructionFiles } from '@lovelybunch/types';
1
2
  export declare function getRepoRoot(): Promise<string>;
2
3
  export declare function getWorktreesBase(): Promise<string>;
3
4
  export declare function sanitizeBranchName(name: string): string;
@@ -9,6 +10,8 @@ export declare function runGit(args: string[], opts?: {
9
10
  stdout: string;
10
11
  stderr: string;
11
12
  }>;
13
+ export declare function lsTree(ref?: string): Promise<string[]>;
14
+ export declare function getInstructionFiles(filter?: InstructionFileKind | 'all'): Promise<InstructionFiles>;
12
15
  export declare function getRepoStatus(): Promise<{
13
16
  branch: string;
14
17
  ahead: number;
package/dist/lib/git.js CHANGED
@@ -5,6 +5,7 @@ import { promises as fs } from 'fs';
5
5
  import { readGithubToken, isGithubTokenValid } from './github-token.js';
6
6
  import { findGaitDirectory } from './gait-path.js';
7
7
  import { loadGitSettings } from './git-settings.js';
8
+ import { INSTRUCTION_FILE_KINDS } from '@lovelybunch/types';
8
9
  const execFile = promisify(_execFile);
9
10
  // Base directory for worktrees under the repository root
10
11
  export async function getRepoRoot() {
@@ -52,6 +53,40 @@ export async function runGit(args, opts) {
52
53
  };
53
54
  return execFile('git', args, { cwd, maxBuffer: 10 * 1024 * 1024, timeout, env });
54
55
  }
56
+ // --- ls-tree ---
57
+ export async function lsTree(ref = 'HEAD') {
58
+ const { stdout } = await runGit(['ls-tree', '-r', '--name-only', ref]);
59
+ return stdout.trim().split('\n').filter(l => l && !l.startsWith('.nut/'));
60
+ }
61
+ // --- Instruction files ---
62
+ const FILENAME_TO_KIND = new Map(INSTRUCTION_FILE_KINDS.map(k => [`${k}.md`, k]));
63
+ const KIND_TO_FILENAME = new Map(INSTRUCTION_FILE_KINDS.map(k => [k, `${k}.md`]));
64
+ export async function getInstructionFiles(filter) {
65
+ const filterFilename = filter && filter !== 'all' ? KIND_TO_FILENAME.get(filter) : undefined;
66
+ const allPaths = await lsTree();
67
+ const wanted = allPaths.filter(p => {
68
+ const name = path.basename(p);
69
+ if (!FILENAME_TO_KIND.has(name))
70
+ return false;
71
+ if (filterFilename)
72
+ return name === filterFilename;
73
+ return true;
74
+ });
75
+ const entries = await Promise.all(wanted.map(async (filePath) => {
76
+ const { stdout } = await runGit(['show', `HEAD:${filePath}`]);
77
+ return { filePath, content: stdout };
78
+ }));
79
+ const result = {};
80
+ for (const { filePath, content } of entries) {
81
+ const dir = path.dirname(filePath);
82
+ const key = dir === '.' ? '.' : dir;
83
+ const kind = FILENAME_TO_KIND.get(path.basename(filePath));
84
+ if (!result[key])
85
+ result[key] = {};
86
+ result[key][kind] = content;
87
+ }
88
+ return result;
89
+ }
55
90
  // --- Status ---
56
91
  export async function getRepoStatus() {
57
92
  const { stdout } = await runGit(['status', '--porcelain=v1', '-b']);
@@ -1,6 +1,7 @@
1
1
  import { Hono } from 'hono';
2
2
  import crypto from 'crypto';
3
- import { getRepoStatus, listBranches, createBranch, deleteBranch, switchBranch, mergeBranch, pushCurrent, pullCurrent, listWorktrees, addWorktree, removeWorktree, commitInWorktree, pushWorktree, pullWorktree, checkRemoteAuth, getCredentialConfig, storeCredentials, getCommitDetails, getFileDiff, setRemoteUrl, } from '../../../../lib/git.js';
3
+ import { getRepoStatus, listBranches, createBranch, deleteBranch, switchBranch, mergeBranch, pushCurrent, pullCurrent, listWorktrees, addWorktree, removeWorktree, commitInWorktree, pushWorktree, pullWorktree, checkRemoteAuth, getCredentialConfig, storeCredentials, getCommitDetails, getFileDiff, setRemoteUrl, lsTree, getInstructionFiles, } from '../../../../lib/git.js';
4
+ import { INSTRUCTION_FILE_KINDS } from '@lovelybunch/types';
4
5
  import { saveGithubToken, clearGithubToken, readGithubToken, isGithubTokenValid } from '../../../../lib/github-token.js';
5
6
  import { createGithubAuthState, consumeGithubAuthState } from '../../../../lib/github-auth-state.js';
6
7
  import { resolveCoconutId, resolveControlPlaneUrl } from '../../../../lib/coconut-context.js';
@@ -674,4 +675,29 @@ app.get('/commits/:sha/files/:filepath{.+}', async (c) => {
674
675
  return c.json({ success: false, error: { message: e.message || 'Failed to get file diff' } }, 500);
675
676
  }
676
677
  });
678
+ // ls-tree
679
+ app.get('/ls-tree', async (c) => {
680
+ try {
681
+ const files = await lsTree();
682
+ return c.json({ success: true, data: files });
683
+ }
684
+ catch (e) {
685
+ return c.json({ success: false, error: { message: e.message || 'Failed to list tree' } }, 500);
686
+ }
687
+ });
688
+ // instruction-files
689
+ const VALID_FILTERS = new Set([...INSTRUCTION_FILE_KINDS, 'all']);
690
+ app.get('/instruction-files', async (c) => {
691
+ try {
692
+ const kind = (c.req.query('kind') || 'all');
693
+ if (!VALID_FILTERS.has(kind)) {
694
+ return c.json({ success: false, error: { message: `Invalid kind. Must be one of: ${[...VALID_FILTERS].join(', ')}` } }, 400);
695
+ }
696
+ const data = await getInstructionFiles(kind);
697
+ return c.json({ success: true, data });
698
+ }
699
+ catch (e) {
700
+ return c.json({ success: false, error: { message: e.message || 'Failed to retrieve instruction files' } }, 500);
701
+ }
702
+ });
677
703
  export default app;
@@ -70,6 +70,7 @@ const THUMBNAILS_DIR = path.join(RESOURCES_DIR, 'thumbnails');
70
70
  // Model ID mapping from frontend values to Replicate model identifiers
71
71
  const MODEL_ID_MAP = {
72
72
  'nano-banana-pro': 'google/nano-banana-pro',
73
+ 'nano-banana-2': 'google/nano-banana-2',
73
74
  'flux-2-dev': 'black-forest-labs/flux-2-dev',
74
75
  'flux-2-pro': 'black-forest-labs/flux-2-pro',
75
76
  'gpt-image-1.5': 'openai/gpt-image-1.5',
@@ -135,7 +136,7 @@ export async function POST(c) {
135
136
  }, 400);
136
137
  }
137
138
  const body = await c.req.json();
138
- const { prompt, model = 'nano-banana-pro', dimensions, resolution, output_format = 'png', output_quality, quality, go_fast, safety_tolerance, background, image_input,
139
+ const { prompt, model = 'nano-banana-2', dimensions, resolution, output_format = 'png', output_quality, quality, go_fast, safety_tolerance, background, image_input,
139
140
  // Legacy
140
141
  inspiration } = body;
141
142
  if (!prompt) {
@@ -215,7 +216,7 @@ export async function POST(c) {
215
216
  }
216
217
  }
217
218
  // Map model selector value to Replicate model ID
218
- const replicateModelId = MODEL_ID_MAP[model] || MODEL_ID_MAP['nano-banana-pro'];
219
+ const replicateModelId = MODEL_ID_MAP[model] || MODEL_ID_MAP['nano-banana-2'];
219
220
  // Build model-specific input payload
220
221
  const input = {
221
222
  prompt: fullPrompt,
@@ -233,7 +234,13 @@ export async function POST(c) {
233
234
  }
234
235
  // Model-specific parameters
235
236
  if (model === 'nano-banana-pro' || model === 'Nano Banana Pro') {
236
- // Nano Banana Pro specific settings
237
+ input.resolution = resolution || '2K';
238
+ input.safety_filter_level = 'block_only_high';
239
+ if (imageInputArray.length > 0) {
240
+ input.image_input = imageInputArray;
241
+ }
242
+ }
243
+ else if (model === 'nano-banana-2') {
237
244
  input.resolution = resolution || '2K';
238
245
  input.safety_filter_level = 'block_only_high';
239
246
  if (imageInputArray.length > 0) {
@@ -7,9 +7,6 @@ export declare function getConfig(c: Context): Promise<(Response & import("hono"
7
7
  success: true;
8
8
  data: {
9
9
  enabled: boolean;
10
- channelId: string;
11
- channelName: string;
12
- siteUrl: string;
13
10
  notifications: {
14
11
  proposals: {
15
12
  created: boolean;
@@ -24,6 +21,9 @@ export declare function getConfig(c: Context): Promise<(Response & import("hono"
24
21
  merge: boolean;
25
22
  };
26
23
  };
24
+ channelId: string;
25
+ channelName: string;
26
+ siteUrl: string;
27
27
  hasBotToken: boolean;
28
28
  hasSigningSecret: boolean;
29
29
  };
@@ -39,9 +39,6 @@ export declare function updateConfig(c: Context): Promise<(Response & import("ho
39
39
  success: true;
40
40
  data: {
41
41
  enabled: boolean;
42
- channelId: string;
43
- channelName: string;
44
- siteUrl: string;
45
42
  notifications: {
46
43
  proposals: {
47
44
  created: boolean;
@@ -56,6 +53,9 @@ export declare function updateConfig(c: Context): Promise<(Response & import("ho
56
53
  merge: boolean;
57
54
  };
58
55
  };
56
+ channelId: string;
57
+ channelName: string;
58
+ siteUrl: string;
59
59
  hasBotToken: boolean;
60
60
  hasSigningSecret: boolean;
61
61
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovelybunch/api",
3
- "version": "1.0.76-alpha.10",
3
+ "version": "1.0.76-alpha.11",
4
4
  "type": "module",
5
5
  "main": "dist/server-with-static.js",
6
6
  "exports": {
@@ -37,9 +37,9 @@
37
37
  "@ai-sdk/anthropic": "^3.0.41",
38
38
  "@hono/node-server": "^1.13.7",
39
39
  "@hono/node-ws": "^1.0.6",
40
- "@lovelybunch/core": "^1.0.76-alpha.10",
41
- "@lovelybunch/mcp": "^1.0.76-alpha.10",
42
- "@lovelybunch/types": "^1.0.76-alpha.10",
40
+ "@lovelybunch/core": "^1.0.76-alpha.11",
41
+ "@lovelybunch/mcp": "^1.0.76-alpha.11",
42
+ "@lovelybunch/types": "^1.0.76-alpha.11",
43
43
  "adm-zip": "^0.5.16",
44
44
  "ai": "^6.0.79",
45
45
  "bcryptjs": "^2.4.3",
@@ -1 +1 @@
1
- import{r as a,A as p,j as e,v,bL as y,B as N,n as w,C as b}from"./index-BWhM9fZn.js";import{C as c,a as d,b as k,c as C}from"./card-jBf8qQSy.js";import{B as m}from"./badge-CKqDVhJv.js";import{R as E}from"./refresh-cw-DLJpfa8_.js";const A=5e3;function $(){const[n,o]=a.useState([]),[i,x]=a.useState(!0),[h,u]=a.useState(new Set),l=a.useCallback(async()=>{x(!0);try{const s=await fetch(`${p}/api/v1/events?limit=${A}`);if(!s.ok)throw new Error("Failed to load events");const t=await s.json();o(Array.isArray(t.items)?[...t.items].reverse():[])}catch(s){console.error("Failed to load events:",s),o([])}finally{x(!1)}},[]),g=a.useCallback(s=>{u(t=>{const r=new Set(t);return r.has(s)?r.delete(s):r.add(s),r})},[]);a.useEffect(()=>{l()},[l]);const f=s=>{if(!s)return"Unknown time";try{return new Date(s).toLocaleString()}catch{return s}},j=s=>{switch(s?.toLowerCase()){case"error":return"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200";case"warn":case"warning":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200";case"info":return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";case"debug":return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200";default:return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}};return i?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Activity"}),e.jsx("p",{className:"text-muted-foreground",children:"View system activity and events"})]}),e.jsx(c,{children:e.jsx(d,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(v,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading events..."})]})})})]}):n.length===0?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Activity"}),e.jsx("p",{className:"text-muted-foreground",children:"View system activity and events"})]}),e.jsx(c,{children:e.jsx(d,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Events Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Activity events will appear here as they occur."})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Activity"}),e.jsxs("p",{className:"text-muted-foreground",children:["View system activity and events (",n.length," events)"]})]}),e.jsxs(N,{variant:"outline",size:"sm",onClick:()=>void l(),disabled:i,children:[e.jsx(E,{className:`h-4 w-4 mr-2 ${i?"animate-spin":""}`}),"Refresh"]})]}),e.jsx("div",{className:"space-y-3",children:n.map(s=>{const t=h.has(s.seq);return e.jsxs(c,{className:"transition-colors",children:[e.jsx(k,{className:"py-3 cursor-pointer hover:bg-muted/30",onClick:()=>g(s.seq),children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-2 flex-1 min-w-0",children:[t?e.jsx(w,{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0"}):e.jsx(b,{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0"}),e.jsxs("div",{className:"space-y-1 flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(C,{className:"text-sm font-medium",children:["#",s.seq]}),s.kind&&e.jsx(m,{variant:"outline",className:"text-xs",children:s.kind}),s.level&&e.jsx(m,{className:`text-xs ${j(s.level)}`,children:s.level})]}),s.message&&e.jsx("p",{className:`text-sm text-muted-foreground ${t?"":"truncate"}`,children:s.message})]})]}),e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:f(s.ts)})]})}),t&&e.jsx(d,{className:"pt-0 pb-4",children:e.jsx("pre",{className:"text-xs bg-muted p-3 rounded-md overflow-x-auto",children:JSON.stringify(s,null,2)})})]},s.seq)})})]})}export{$ as default};
1
+ import{r as a,A as p,j as e,v,bL as y,B as N,n as w,C as b}from"./index-C_KCaLlP.js";import{C as c,a as d,b as k,c as C}from"./card-BpqK1BMM.js";import{B as m}from"./badge-BzEwwrAP.js";import{R as E}from"./refresh-cw-yMcSYdEF.js";const A=5e3;function $(){const[n,o]=a.useState([]),[i,x]=a.useState(!0),[h,u]=a.useState(new Set),l=a.useCallback(async()=>{x(!0);try{const s=await fetch(`${p}/api/v1/events?limit=${A}`);if(!s.ok)throw new Error("Failed to load events");const t=await s.json();o(Array.isArray(t.items)?[...t.items].reverse():[])}catch(s){console.error("Failed to load events:",s),o([])}finally{x(!1)}},[]),g=a.useCallback(s=>{u(t=>{const r=new Set(t);return r.has(s)?r.delete(s):r.add(s),r})},[]);a.useEffect(()=>{l()},[l]);const f=s=>{if(!s)return"Unknown time";try{return new Date(s).toLocaleString()}catch{return s}},j=s=>{switch(s?.toLowerCase()){case"error":return"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200";case"warn":case"warning":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200";case"info":return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";case"debug":return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200";default:return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}};return i?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Activity"}),e.jsx("p",{className:"text-muted-foreground",children:"View system activity and events"})]}),e.jsx(c,{children:e.jsx(d,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(v,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading events..."})]})})})]}):n.length===0?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Activity"}),e.jsx("p",{className:"text-muted-foreground",children:"View system activity and events"})]}),e.jsx(c,{children:e.jsx(d,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Events Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Activity events will appear here as they occur."})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Activity"}),e.jsxs("p",{className:"text-muted-foreground",children:["View system activity and events (",n.length," events)"]})]}),e.jsxs(N,{variant:"outline",size:"sm",onClick:()=>void l(),disabled:i,children:[e.jsx(E,{className:`h-4 w-4 mr-2 ${i?"animate-spin":""}`}),"Refresh"]})]}),e.jsx("div",{className:"space-y-3",children:n.map(s=>{const t=h.has(s.seq);return e.jsxs(c,{className:"transition-colors",children:[e.jsx(k,{className:"py-3 cursor-pointer hover:bg-muted/30",onClick:()=>g(s.seq),children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-2 flex-1 min-w-0",children:[t?e.jsx(w,{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0"}):e.jsx(b,{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0"}),e.jsxs("div",{className:"space-y-1 flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(C,{className:"text-sm font-medium",children:["#",s.seq]}),s.kind&&e.jsx(m,{variant:"outline",className:"text-xs",children:s.kind}),s.level&&e.jsx(m,{className:`text-xs ${j(s.level)}`,children:s.level})]}),s.message&&e.jsx("p",{className:`text-sm text-muted-foreground ${t?"":"truncate"}`,children:s.message})]})]}),e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:f(s.ts)})]})}),t&&e.jsx(d,{className:"pt-0 pb-4",children:e.jsx("pre",{className:"text-xs bg-muted p-3 rounded-md overflow-x-auto",children:JSON.stringify(s,null,2)})})]},s.seq)})})]})}export{$ as default};
@@ -0,0 +1 @@
1
+ import{r as a,A as p,j as e,v,bL as y,B as N,n as w,C as b}from"./index-opozMhku.js";import{C as c,a as d,b as k,c as C}from"./card-Btt3HmXT.js";import{B as m}from"./badge-BmHXIBBB.js";import{R as E}from"./refresh-cw-CZLHY6zD.js";const A=5e3;function $(){const[n,o]=a.useState([]),[i,x]=a.useState(!0),[h,u]=a.useState(new Set),l=a.useCallback(async()=>{x(!0);try{const s=await fetch(`${p}/api/v1/events?limit=${A}`);if(!s.ok)throw new Error("Failed to load events");const t=await s.json();o(Array.isArray(t.items)?[...t.items].reverse():[])}catch(s){console.error("Failed to load events:",s),o([])}finally{x(!1)}},[]),g=a.useCallback(s=>{u(t=>{const r=new Set(t);return r.has(s)?r.delete(s):r.add(s),r})},[]);a.useEffect(()=>{l()},[l]);const f=s=>{if(!s)return"Unknown time";try{return new Date(s).toLocaleString()}catch{return s}},j=s=>{switch(s?.toLowerCase()){case"error":return"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200";case"warn":case"warning":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200";case"info":return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";case"debug":return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200";default:return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}};return i?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Activity"}),e.jsx("p",{className:"text-muted-foreground",children:"View system activity and events"})]}),e.jsx(c,{children:e.jsx(d,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(v,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading events..."})]})})})]}):n.length===0?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Activity"}),e.jsx("p",{className:"text-muted-foreground",children:"View system activity and events"})]}),e.jsx(c,{children:e.jsx(d,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Events Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Activity events will appear here as they occur."})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Activity"}),e.jsxs("p",{className:"text-muted-foreground",children:["View system activity and events (",n.length," events)"]})]}),e.jsxs(N,{variant:"outline",size:"sm",onClick:()=>void l(),disabled:i,children:[e.jsx(E,{className:`h-4 w-4 mr-2 ${i?"animate-spin":""}`}),"Refresh"]})]}),e.jsx("div",{className:"space-y-3",children:n.map(s=>{const t=h.has(s.seq);return e.jsxs(c,{className:"transition-colors",children:[e.jsx(k,{className:"py-3 cursor-pointer hover:bg-muted/30",onClick:()=>g(s.seq),children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-2 flex-1 min-w-0",children:[t?e.jsx(w,{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0"}):e.jsx(b,{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0"}),e.jsxs("div",{className:"space-y-1 flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(C,{className:"text-sm font-medium",children:["#",s.seq]}),s.kind&&e.jsx(m,{variant:"outline",className:"text-xs",children:s.kind}),s.level&&e.jsx(m,{className:`text-xs ${j(s.level)}`,children:s.level})]}),s.message&&e.jsx("p",{className:`text-sm text-muted-foreground ${t?"":"truncate"}`,children:s.message})]})]}),e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:f(s.ts)})]})}),t&&e.jsx(d,{className:"pt-0 pb-4",children:e.jsx("pre",{className:"text-xs bg-muted p-3 rounded-md overflow-x-auto",children:JSON.stringify(s,null,2)})})]},s.seq)})})]})}export{$ as default};
@@ -1,4 +1,4 @@
1
- import{u as p,a as j,r as n,A as l,j as e,B as h,L as v,a1 as N}from"./index-BWhM9fZn.js";import{C as m,a as x,b as C,c as S}from"./card-jBf8qQSy.js";import{M as w}from"./markdown-editor-CT9CPLw5.js";import{A as y}from"./arrow-left-CkQCXG-O.js";import{C as A}from"./circle-check-big-DDQIqE0G.js";import"./index-CdmUQF6-.js";function F(){const f=p(),{toast:t}=j(),[a,i]=n.useState(""),[g,r]=n.useState(!0),[o,c]=n.useState(!1);n.useEffect(()=>{fetch(`${l}/api/v1/context/agents`).then(s=>s.json()).then(s=>{s.success&&i(s.document.content.trim()),r(!1)}).catch(s=>{console.error("Failed to load context:",s),t({title:"Error",description:"Failed to load agents definition",variant:"destructive"}),r(!1)})},[t]);const u=async()=>{c(!0);try{const d=await(await fetch(`${l}/api/v1/context/agents`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:a,metadata:{}})})).json();if(d.success)t({title:"Success",description:"Agents definition saved successfully",action:e.jsx(A,{className:"h-4 w-4"})}),f("/context/agents");else throw new Error(d.error||"Failed to save")}catch(s){console.error("Save error:",s),t({title:"Error",description:"Failed to save agents definition",variant:"destructive"})}finally{c(!1)}};return g?e.jsx("div",{className:"space-y-6",children:e.jsx(m,{children:e.jsx(x,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Edit Agents Definition"}),e.jsx("p",{className:"text-muted-foreground text-sm hidden sm:block",children:"Define agents, their capabilities, and configurations"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:"/context/agents",className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(y,{className:"w-4 h-4"})})}),e.jsxs(h,{onClick:u,disabled:o,size:"sm",children:[e.jsx(N,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:o?"Saving...":"Save"})]})]})]}),e.jsxs(m,{children:[e.jsx(C,{children:e.jsx(S,{children:"Agents Documentation"})}),e.jsx(x,{children:e.jsx(w,{value:a,onChange:s=>i(s||""),placeholder:`Write your agents definition in markdown...
1
+ import{u as p,a as j,r as n,A as l,j as e,B as h,L as v,a1 as N}from"./index-C_KCaLlP.js";import{C as m,a as x,b as C,c as S}from"./card-BpqK1BMM.js";import{M as w}from"./markdown-editor-D_er7zWv.js";import{A as y}from"./arrow-left-B_QwfLPP.js";import{C as A}from"./circle-check-big-DqKKs8fZ.js";import"./index-PBkZiuRI.js";function F(){const f=p(),{toast:t}=j(),[a,i]=n.useState(""),[g,r]=n.useState(!0),[o,c]=n.useState(!1);n.useEffect(()=>{fetch(`${l}/api/v1/context/agents`).then(s=>s.json()).then(s=>{s.success&&i(s.document.content.trim()),r(!1)}).catch(s=>{console.error("Failed to load context:",s),t({title:"Error",description:"Failed to load agents definition",variant:"destructive"}),r(!1)})},[t]);const u=async()=>{c(!0);try{const d=await(await fetch(`${l}/api/v1/context/agents`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:a,metadata:{}})})).json();if(d.success)t({title:"Success",description:"Agents definition saved successfully",action:e.jsx(A,{className:"h-4 w-4"})}),f("/context/agents");else throw new Error(d.error||"Failed to save")}catch(s){console.error("Save error:",s),t({title:"Error",description:"Failed to save agents definition",variant:"destructive"})}finally{c(!1)}};return g?e.jsx("div",{className:"space-y-6",children:e.jsx(m,{children:e.jsx(x,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Edit Agents Definition"}),e.jsx("p",{className:"text-muted-foreground text-sm hidden sm:block",children:"Define agents, their capabilities, and configurations"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:"/context/agents",className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(y,{className:"w-4 h-4"})})}),e.jsxs(h,{onClick:u,disabled:o,size:"sm",children:[e.jsx(N,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:o?"Saving...":"Save"})]})]})]}),e.jsxs(m,{children:[e.jsx(C,{children:e.jsx(S,{children:"Agents Documentation"})}),e.jsx(x,{children:e.jsx(w,{value:a,onChange:s=>i(s||""),placeholder:`Write your agents definition in markdown...
2
2
 
3
3
  ## Agent Definitions
4
4
 
@@ -0,0 +1,9 @@
1
+ import{u as p,a as j,r as n,A as l,j as e,B as h,L as v,a1 as N}from"./index-opozMhku.js";import{C as m,a as x,b as C,c as S}from"./card-Btt3HmXT.js";import{M as w}from"./markdown-editor-B3gIcmI2.js";import{A as y}from"./arrow-left-DmNgC0xD.js";import{C as A}from"./circle-check-big-CVbQ_zpj.js";import"./index-J8MrpD0P.js";function F(){const f=p(),{toast:t}=j(),[a,i]=n.useState(""),[g,r]=n.useState(!0),[o,c]=n.useState(!1);n.useEffect(()=>{fetch(`${l}/api/v1/context/agents`).then(s=>s.json()).then(s=>{s.success&&i(s.document.content.trim()),r(!1)}).catch(s=>{console.error("Failed to load context:",s),t({title:"Error",description:"Failed to load agents definition",variant:"destructive"}),r(!1)})},[t]);const u=async()=>{c(!0);try{const d=await(await fetch(`${l}/api/v1/context/agents`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:a,metadata:{}})})).json();if(d.success)t({title:"Success",description:"Agents definition saved successfully",action:e.jsx(A,{className:"h-4 w-4"})}),f("/context/agents");else throw new Error(d.error||"Failed to save")}catch(s){console.error("Save error:",s),t({title:"Error",description:"Failed to save agents definition",variant:"destructive"})}finally{c(!1)}};return g?e.jsx("div",{className:"space-y-6",children:e.jsx(m,{children:e.jsx(x,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Edit Agents Definition"}),e.jsx("p",{className:"text-muted-foreground text-sm hidden sm:block",children:"Define agents, their capabilities, and configurations"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:"/context/agents",className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(y,{className:"w-4 h-4"})})}),e.jsxs(h,{onClick:u,disabled:o,size:"sm",children:[e.jsx(N,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:o?"Saving...":"Save"})]})]})]}),e.jsxs(m,{children:[e.jsx(C,{children:e.jsx(S,{children:"Agents Documentation"})}),e.jsx(x,{children:e.jsx(w,{value:a,onChange:s=>i(s||""),placeholder:`Write your agents definition in markdown...
2
+
3
+ ## Agent Definitions
4
+
5
+ Describe agents, their capabilities, and configurations.
6
+
7
+ ## Agent Guidelines
8
+
9
+ Key guidelines for agent behavior and interaction patterns.`,height:800})})]})]})}export{F as default};
@@ -1 +1 @@
1
- import{a as g,r as t,A as N,j as e,v,aw as C,B as a,L as d,_ as l,M as w,av as y,ar as E}from"./index-BWhM9fZn.js";import{C as i,a as c,b}from"./card-jBf8qQSy.js";import{c as A}from"./clipboard-B9ndUJKl.js";function D(){const{toast:r}=g(),[o,m]=t.useState(null),[x,h]=t.useState(!0),[u,n]=t.useState(!1);t.useEffect(()=>{fetch(`${N}/api/v1/context/agents`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(m(s.document),n(!0)):n(!1)}).catch(()=>{n(!1)}).finally(()=>{h(!1)})},[]);const p=async()=>{const s=".nut/context/agents.md";try{await A(s),r({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(f){console.error("Failed to copy path:",f),r({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},j=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"agents-md",filename:"agents.md",name:"agents.md",path:".nut/context/agents.md"}});window.dispatchEvent(s)};return x?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(v,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading agents definition..."})]})})})}):!u||!o?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(C,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Agents Definition Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Agents definition will appear here once created."}),e.jsx(a,{className:"mt-4",asChild:!0,children:e.jsxs(d,{to:"/context/agents/edit",children:[e.jsx(l,{className:"h-4 w-4 mr-2"}),"Create Agents Definition"]})})]})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Agents"}),e.jsx("p",{className:"text-muted-foreground",children:"Agent definitions and configurations"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(w,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(a,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(a,{size:"sm",asChild:!0,children:e.jsxs(d,{to:"/context/agents/edit",children:[e.jsx(l,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),e.jsxs(i,{children:[e.jsx(b,{className:"pb-0"}),e.jsx(c,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(E,{children:o.content||"No content available"})})})]})]})}export{D as default};
1
+ import{a as g,r as t,A as N,j as e,v,aw as C,B as a,L as d,_ as l,M as w,av as y,ar as E}from"./index-C_KCaLlP.js";import{C as i,a as c,b}from"./card-BpqK1BMM.js";import{c as A}from"./clipboard-B9ndUJKl.js";function D(){const{toast:r}=g(),[o,m]=t.useState(null),[x,h]=t.useState(!0),[u,n]=t.useState(!1);t.useEffect(()=>{fetch(`${N}/api/v1/context/agents`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(m(s.document),n(!0)):n(!1)}).catch(()=>{n(!1)}).finally(()=>{h(!1)})},[]);const p=async()=>{const s=".nut/context/agents.md";try{await A(s),r({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(f){console.error("Failed to copy path:",f),r({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},j=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"agents-md",filename:"agents.md",name:"agents.md",path:".nut/context/agents.md"}});window.dispatchEvent(s)};return x?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(v,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading agents definition..."})]})})})}):!u||!o?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(C,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Agents Definition Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Agents definition will appear here once created."}),e.jsx(a,{className:"mt-4",asChild:!0,children:e.jsxs(d,{to:"/context/agents/edit",children:[e.jsx(l,{className:"h-4 w-4 mr-2"}),"Create Agents Definition"]})})]})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Agents"}),e.jsx("p",{className:"text-muted-foreground",children:"Agent definitions and configurations"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(w,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(a,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(a,{size:"sm",asChild:!0,children:e.jsxs(d,{to:"/context/agents/edit",children:[e.jsx(l,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),e.jsxs(i,{children:[e.jsx(b,{className:"pb-0"}),e.jsx(c,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(E,{children:o.content||"No content available"})})})]})]})}export{D as default};
@@ -0,0 +1 @@
1
+ import{a as g,r as t,A as N,j as e,v,aw as C,B as a,L as d,_ as l,M as w,av as y,ar as E}from"./index-opozMhku.js";import{C as i,a as c,b}from"./card-Btt3HmXT.js";import{c as A}from"./clipboard-B9ndUJKl.js";function D(){const{toast:r}=g(),[o,m]=t.useState(null),[x,h]=t.useState(!0),[u,n]=t.useState(!1);t.useEffect(()=>{fetch(`${N}/api/v1/context/agents`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(m(s.document),n(!0)):n(!1)}).catch(()=>{n(!1)}).finally(()=>{h(!1)})},[]);const p=async()=>{const s=".nut/context/agents.md";try{await A(s),r({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(f){console.error("Failed to copy path:",f),r({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},j=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"agents-md",filename:"agents.md",name:"agents.md",path:".nut/context/agents.md"}});window.dispatchEvent(s)};return x?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(v,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading agents definition..."})]})})})}):!u||!o?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(C,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Agents Definition Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Agents definition will appear here once created."}),e.jsx(a,{className:"mt-4",asChild:!0,children:e.jsxs(d,{to:"/context/agents/edit",children:[e.jsx(l,{className:"h-4 w-4 mr-2"}),"Create Agents Definition"]})})]})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Agents"}),e.jsx("p",{className:"text-muted-foreground",children:"Agent definitions and configurations"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(w,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(a,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(a,{size:"sm",asChild:!0,children:e.jsxs(d,{to:"/context/agents/edit",children:[e.jsx(l,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),e.jsxs(i,{children:[e.jsx(b,{className:"pb-0"}),e.jsx(c,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(E,{children:o.content||"No content available"})})})]})]})}export{D as default};
@@ -1,2 +1,2 @@
1
- import{t as z,r as t,bE as y,j as e,B as a,P as R,bF as X,H as J,D as j,b as g,d as v,f,g as A,I as F,Y as N,af as W,w as i}from"./index-BWhM9fZn.js";import{C as G,b as Q,c as V,d as Z,a as _}from"./card-jBf8qQSy.js";import{L as w}from"./label-CHVVHrlr.js";import{B as ee}from"./badge-CKqDVhJv.js";import{A as I,a as C}from"./alert-CMfexl-V.js";import{I as L}from"./info-Na9GqbtC.js";import{C as se}from"./circle-alert-DqK0nUqF.js";function oe(){const{authEnabled:n}=z(),[P,k]=t.useState([]),[b,K]=t.useState(!0),[O,l]=t.useState(!1),[M,d]=t.useState(!1),[x,D]=t.useState(""),[h,E]=t.useState("never"),[c,S]=t.useState(null),[m,o]=t.useState(null);t.useEffect(()=>{p()},[]);const p=async()=>{K(!0);try{const s=await y("/api/v1/api-keys");s.success&&k(s.data?.apiKeys||[])}catch(s){console.error("Failed to load API keys:",s),k([])}finally{K(!1)}},U=async()=>{if(!x.trim()){i({title:"Error",description:"Please provide a name for the API key",variant:"destructive"});return}try{const s={name:x,scopes:["*"]};h!=="never"&&(s.expiresIn=h);const r=await y("/api/v1/api-keys",{method:"POST",body:JSON.stringify(s)});r.success&&(S(r.data),l(!1),d(!0),D(""),E("never"),await p(),i({title:"API Key Created",description:"Make sure to copy your API key now. You won't be able to see it again!"}))}catch(s){console.error("Failed to create API key:",s),i({title:"Error",description:"Failed to create API key",variant:"destructive"})}},B=async s=>{try{(await y(`/api/v1/api-keys/${s}`,{method:"DELETE"})).success&&(await p(),o(null),i({title:"API Key Deleted",description:"The API key has been permanently deleted"}))}catch(r){console.error("Failed to delete API key:",r),i({title:"Error",description:"Failed to delete API key",variant:"destructive"})}},H=async s=>{try{await navigator.clipboard.writeText(s),i({title:"Copied",description:"API key copied to clipboard"})}catch{i({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},u=s=>new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),Y=s=>s?new Date(s)<new Date:!1,$=typeof window<"u"?window.location.origin:"http://localhost:3000",q=c?`curl -H "X-API-Key: ${c.key}" \\
1
+ import{t as z,r as t,bE as y,j as e,B as a,P as R,bF as X,H as J,D as j,b as g,d as v,f,g as A,I as F,Y as N,af as W,w as i}from"./index-C_KCaLlP.js";import{C as G,b as Q,c as V,d as Z,a as _}from"./card-BpqK1BMM.js";import{L as w}from"./label-wtSCiOqT.js";import{B as ee}from"./badge-BzEwwrAP.js";import{A as I,a as C}from"./alert-u79hLEuY.js";import{I as L}from"./info-D-7cQBbP.js";import{C as se}from"./circle-alert-Coa2ulVd.js";function oe(){const{authEnabled:n}=z(),[P,k]=t.useState([]),[b,K]=t.useState(!0),[O,l]=t.useState(!1),[M,d]=t.useState(!1),[x,D]=t.useState(""),[h,E]=t.useState("never"),[c,S]=t.useState(null),[m,o]=t.useState(null);t.useEffect(()=>{p()},[]);const p=async()=>{K(!0);try{const s=await y("/api/v1/api-keys");s.success&&k(s.data?.apiKeys||[])}catch(s){console.error("Failed to load API keys:",s),k([])}finally{K(!1)}},U=async()=>{if(!x.trim()){i({title:"Error",description:"Please provide a name for the API key",variant:"destructive"});return}try{const s={name:x,scopes:["*"]};h!=="never"&&(s.expiresIn=h);const r=await y("/api/v1/api-keys",{method:"POST",body:JSON.stringify(s)});r.success&&(S(r.data),l(!1),d(!0),D(""),E("never"),await p(),i({title:"API Key Created",description:"Make sure to copy your API key now. You won't be able to see it again!"}))}catch(s){console.error("Failed to create API key:",s),i({title:"Error",description:"Failed to create API key",variant:"destructive"})}},B=async s=>{try{(await y(`/api/v1/api-keys/${s}`,{method:"DELETE"})).success&&(await p(),o(null),i({title:"API Key Deleted",description:"The API key has been permanently deleted"}))}catch(r){console.error("Failed to delete API key:",r),i({title:"Error",description:"Failed to delete API key",variant:"destructive"})}},H=async s=>{try{await navigator.clipboard.writeText(s),i({title:"Copied",description:"API key copied to clipboard"})}catch{i({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},u=s=>new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),Y=s=>s?new Date(s)<new Date:!1,$=typeof window<"u"?window.location.origin:"http://localhost:3000",q=c?`curl -H "X-API-Key: ${c.key}" \\
2
2
  + ${$}/api/v1/tasks`:"",T=n?null:e.jsxs(I,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(C,{children:["Authentication is currently disabled. API keys will only be required once you enable authentication in the ",e.jsx("a",{href:"/settings/authentication",className:"underline",children:"Authentication settings"}),"."]})]});return!n&&b?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage API keys for programmatic access"})]}),T]}):b?e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage API keys for programmatic access to your Coconut instance"})]}),T,n&&e.jsxs(I,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(C,{children:["API keys provide programmatic access to your Coconut instance. Use them in CI/CD pipelines or automation scripts by including the key in the ",e.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:"X-API-Key"})," header."]})]}),e.jsxs(G,{children:[e.jsx(Q,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(V,{children:"Active API Keys"}),e.jsx(Z,{children:"API keys you've created for programmatic access"})]}),e.jsxs(a,{onClick:()=>l(!0),disabled:!n,children:[e.jsx(R,{className:"mr-2 h-4 w-4"}),"Create API Key"]})]})}),e.jsx(_,{children:P.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(X,{className:"h-12 w-12 mx-auto mb-4 opacity-20"}),e.jsx("p",{children:"No API keys yet"}),e.jsx("p",{className:"text-sm",children:"Create an API key to get started with programmatic access"})]}):e.jsx("div",{className:"space-y-4",children:P.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"font-medium",children:s.name}),Y(s.expiresAt)&&e.jsx(ee,{variant:"destructive",children:"Expired"})]}),e.jsx("p",{className:"text-sm text-muted-foreground font-mono",children:s.keyPreview}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["Created: ",u(s.createdAt)]}),s.expiresAt&&e.jsxs("span",{children:["Expires: ",u(s.expiresAt)]}),s.lastUsedAt&&e.jsxs("span",{children:["Last used: ",u(s.lastUsedAt)]})]})]}),e.jsx(a,{variant:"ghost",size:"icon",onClick:()=>o(s.id),children:e.jsx(J,{className:"h-4 w-4 text-destructive"})})]},s.id))})})]}),e.jsx(j,{open:O,onOpenChange:l,children:e.jsxs(g,{children:[e.jsxs(v,{children:[e.jsx(f,{children:"Create API Key"}),e.jsx(A,{children:"Create a new API key for programmatic access. The key will only be shown once."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"keyName",children:"Name"}),e.jsx(F,{id:"keyName",placeholder:"CI/CD Pipeline",value:x,onChange:s=>D(s.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"A descriptive name to identify this API key"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"keyExpiry",children:"Expiration"}),e.jsxs("select",{id:"keyExpiry",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:h,onChange:s=>E(s.target.value),children:[e.jsx("option",{value:"never",children:"Never"}),e.jsx("option",{value:"30d",children:"30 days"}),e.jsx("option",{value:"90d",children:"90 days"}),e.jsx("option",{value:"1y",children:"1 year"})]})]})]}),e.jsxs(N,{children:[e.jsx(a,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(a,{onClick:U,disabled:!n,children:"Create API Key"})]})]})}),e.jsx(j,{open:M,onOpenChange:d,children:e.jsxs(g,{className:"sm:max-w-[600px]",children:[e.jsxs(v,{children:[e.jsx(f,{children:"API Key Created"}),e.jsx(A,{children:"Make sure to copy your API key now. You won't be able to see it again!"})]}),e.jsxs(I,{variant:"destructive",className:"my-4",children:[e.jsx(se,{className:"h-4 w-4"}),e.jsx(C,{children:"This is the only time you will see this key. Store it securely."})]}),c&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{children:"API Key"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(F,{readOnly:!0,value:c.key,className:"font-mono text-sm"}),e.jsx(a,{variant:"outline",size:"icon",onClick:()=>H(c.key),children:e.jsx(W,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("p",{className:"mb-2",children:"Usage example:"}),e.jsx("pre",{className:"bg-muted p-3 rounded-md whitespace-pre-wrap break-words",children:e.jsx("code",{className:"font-mono text-xs",children:q})})]})]}),e.jsx(N,{children:e.jsx(a,{onClick:()=>{d(!1),S(null)},children:"I've Saved My Key"})})]})}),e.jsx(j,{open:!!m,onOpenChange:s=>!s&&o(null),children:e.jsxs(g,{children:[e.jsxs(v,{children:[e.jsx(f,{children:"Delete API Key"}),e.jsx(A,{children:"Are you sure you want to delete this API key? This action cannot be undone and any scripts using this key will stop working."})]}),e.jsxs(N,{children:[e.jsx(a,{variant:"outline",onClick:()=>o(null),children:"Cancel"}),e.jsx(a,{variant:"destructive",onClick:()=>m&&B(m),children:"Delete API Key"})]})]})})]})}export{oe as default};
@@ -0,0 +1,2 @@
1
+ import{t as z,r as t,bE as y,j as e,B as a,P as R,bF as X,H as J,D as j,b as g,d as v,f,g as A,I as F,Y as N,af as W,w as i}from"./index-opozMhku.js";import{C as G,b as Q,c as V,d as Z,a as _}from"./card-Btt3HmXT.js";import{L as w}from"./label-bMzKAcdZ.js";import{B as ee}from"./badge-BmHXIBBB.js";import{A as I,a as C}from"./alert-DOfUEE4H.js";import{I as L}from"./info-NEnL4zqX.js";import{C as se}from"./circle-alert-CQ-Ir4mS.js";function oe(){const{authEnabled:n}=z(),[P,k]=t.useState([]),[b,K]=t.useState(!0),[O,l]=t.useState(!1),[M,d]=t.useState(!1),[x,D]=t.useState(""),[h,E]=t.useState("never"),[c,S]=t.useState(null),[m,o]=t.useState(null);t.useEffect(()=>{p()},[]);const p=async()=>{K(!0);try{const s=await y("/api/v1/api-keys");s.success&&k(s.data?.apiKeys||[])}catch(s){console.error("Failed to load API keys:",s),k([])}finally{K(!1)}},U=async()=>{if(!x.trim()){i({title:"Error",description:"Please provide a name for the API key",variant:"destructive"});return}try{const s={name:x,scopes:["*"]};h!=="never"&&(s.expiresIn=h);const r=await y("/api/v1/api-keys",{method:"POST",body:JSON.stringify(s)});r.success&&(S(r.data),l(!1),d(!0),D(""),E("never"),await p(),i({title:"API Key Created",description:"Make sure to copy your API key now. You won't be able to see it again!"}))}catch(s){console.error("Failed to create API key:",s),i({title:"Error",description:"Failed to create API key",variant:"destructive"})}},B=async s=>{try{(await y(`/api/v1/api-keys/${s}`,{method:"DELETE"})).success&&(await p(),o(null),i({title:"API Key Deleted",description:"The API key has been permanently deleted"}))}catch(r){console.error("Failed to delete API key:",r),i({title:"Error",description:"Failed to delete API key",variant:"destructive"})}},H=async s=>{try{await navigator.clipboard.writeText(s),i({title:"Copied",description:"API key copied to clipboard"})}catch{i({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},u=s=>new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),Y=s=>s?new Date(s)<new Date:!1,$=typeof window<"u"?window.location.origin:"http://localhost:3000",q=c?`curl -H "X-API-Key: ${c.key}" \\
2
+ + ${$}/api/v1/tasks`:"",T=n?null:e.jsxs(I,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(C,{children:["Authentication is currently disabled. API keys will only be required once you enable authentication in the ",e.jsx("a",{href:"/settings/authentication",className:"underline",children:"Authentication settings"}),"."]})]});return!n&&b?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage API keys for programmatic access"})]}),T]}):b?e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage API keys for programmatic access to your Coconut instance"})]}),T,n&&e.jsxs(I,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(C,{children:["API keys provide programmatic access to your Coconut instance. Use them in CI/CD pipelines or automation scripts by including the key in the ",e.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:"X-API-Key"})," header."]})]}),e.jsxs(G,{children:[e.jsx(Q,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(V,{children:"Active API Keys"}),e.jsx(Z,{children:"API keys you've created for programmatic access"})]}),e.jsxs(a,{onClick:()=>l(!0),disabled:!n,children:[e.jsx(R,{className:"mr-2 h-4 w-4"}),"Create API Key"]})]})}),e.jsx(_,{children:P.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(X,{className:"h-12 w-12 mx-auto mb-4 opacity-20"}),e.jsx("p",{children:"No API keys yet"}),e.jsx("p",{className:"text-sm",children:"Create an API key to get started with programmatic access"})]}):e.jsx("div",{className:"space-y-4",children:P.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"font-medium",children:s.name}),Y(s.expiresAt)&&e.jsx(ee,{variant:"destructive",children:"Expired"})]}),e.jsx("p",{className:"text-sm text-muted-foreground font-mono",children:s.keyPreview}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["Created: ",u(s.createdAt)]}),s.expiresAt&&e.jsxs("span",{children:["Expires: ",u(s.expiresAt)]}),s.lastUsedAt&&e.jsxs("span",{children:["Last used: ",u(s.lastUsedAt)]})]})]}),e.jsx(a,{variant:"ghost",size:"icon",onClick:()=>o(s.id),children:e.jsx(J,{className:"h-4 w-4 text-destructive"})})]},s.id))})})]}),e.jsx(j,{open:O,onOpenChange:l,children:e.jsxs(g,{children:[e.jsxs(v,{children:[e.jsx(f,{children:"Create API Key"}),e.jsx(A,{children:"Create a new API key for programmatic access. The key will only be shown once."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"keyName",children:"Name"}),e.jsx(F,{id:"keyName",placeholder:"CI/CD Pipeline",value:x,onChange:s=>D(s.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"A descriptive name to identify this API key"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"keyExpiry",children:"Expiration"}),e.jsxs("select",{id:"keyExpiry",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:h,onChange:s=>E(s.target.value),children:[e.jsx("option",{value:"never",children:"Never"}),e.jsx("option",{value:"30d",children:"30 days"}),e.jsx("option",{value:"90d",children:"90 days"}),e.jsx("option",{value:"1y",children:"1 year"})]})]})]}),e.jsxs(N,{children:[e.jsx(a,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(a,{onClick:U,disabled:!n,children:"Create API Key"})]})]})}),e.jsx(j,{open:M,onOpenChange:d,children:e.jsxs(g,{className:"sm:max-w-[600px]",children:[e.jsxs(v,{children:[e.jsx(f,{children:"API Key Created"}),e.jsx(A,{children:"Make sure to copy your API key now. You won't be able to see it again!"})]}),e.jsxs(I,{variant:"destructive",className:"my-4",children:[e.jsx(se,{className:"h-4 w-4"}),e.jsx(C,{children:"This is the only time you will see this key. Store it securely."})]}),c&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{children:"API Key"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(F,{readOnly:!0,value:c.key,className:"font-mono text-sm"}),e.jsx(a,{variant:"outline",size:"icon",onClick:()=>H(c.key),children:e.jsx(W,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("p",{className:"mb-2",children:"Usage example:"}),e.jsx("pre",{className:"bg-muted p-3 rounded-md whitespace-pre-wrap break-words",children:e.jsx("code",{className:"font-mono text-xs",children:q})})]})]}),e.jsx(N,{children:e.jsx(a,{onClick:()=>{d(!1),S(null)},children:"I've Saved My Key"})})]})}),e.jsx(j,{open:!!m,onOpenChange:s=>!s&&o(null),children:e.jsxs(g,{children:[e.jsxs(v,{children:[e.jsx(f,{children:"Delete API Key"}),e.jsx(A,{children:"Are you sure you want to delete this API key? This action cannot be undone and any scripts using this key will stop working."})]}),e.jsxs(N,{children:[e.jsx(a,{variant:"outline",onClick:()=>o(null),children:"Cancel"}),e.jsx(a,{variant:"destructive",onClick:()=>m&&B(m),children:"Delete API Key"})]})]})})]})}export{oe as default};
@@ -1,4 +1,4 @@
1
- import{u as L,a as A,r as o,A as N,j as e,B as w,L as D,a1 as M,I as c}from"./index-BWhM9fZn.js";import{C as u,a as p,b as C,c as b}from"./card-jBf8qQSy.js";import{L as n}from"./label-CHVVHrlr.js";import{M as I}from"./markdown-editor-CT9CPLw5.js";import{A as T}from"./arrow-left-CkQCXG-O.js";import{C as B}from"./circle-check-big-DDQIqE0G.js";import"./index-CdmUQF6-.js";function H(){const S=L(),{toast:i}=A(),[s,g]=o.useState({stack:{runtime:"",framework:"",language:"",database:"",deployment:"",repository:""}}),[x,j]=o.useState(""),[F,v]=o.useState(!0),[y,f]=o.useState(!1);o.useEffect(()=>{fetch(`${N}/api/v1/context/architecture`).then(t=>t.json()).then(t=>{if(t.success){const a=t.document,d={stack:{runtime:a.metadata.stack?.runtime||"",framework:a.metadata.stack?.framework||"",language:a.metadata.stack?.language||"",database:a.metadata.stack?.database||"",deployment:a.metadata.stack?.deployment||"",repository:a.metadata.stack?.repository||""}};g(d),j(a.content.trim())}v(!1)}).catch(t=>{console.error("Failed to load context:",t),i({title:"Error",description:"Failed to load architecture documentation",variant:"destructive"}),v(!1)})},[i]);const E=async()=>{f(!0);try{const a=await(await fetch(`${N}/api/v1/context/architecture`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:x,metadata:{stack:s.stack}})})).json();if(a.success)i({title:"Success",description:"Architecture documentation saved successfully",action:e.jsx(B,{className:"h-4 w-4"})}),S("/context/architecture");else throw new Error(a.error||"Failed to save context")}catch(t){console.error("Save error:",t),i({title:"Error",description:"Failed to save architecture documentation",variant:"destructive"})}finally{f(!1)}},r=(t,a)=>{g(d=>{const k={...d},l=t.split(".");let m=k;for(let h=0;h<l.length-1;h++)m=m[l[h]];return m[l[l.length-1]]=a,k})};return F?e.jsx("div",{className:"space-y-6",children:e.jsx(u,{children:e.jsx(p,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Edit Architecture"}),e.jsx("p",{className:"text-muted-foreground text-sm hidden sm:block",children:"Edit technical architecture and supporting metadata"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(w,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(D,{to:"/context/architecture",className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(T,{className:"w-4 h-4"})})}),e.jsxs(w,{onClick:E,disabled:y,size:"sm",children:[e.jsx(M,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:y?"Saving...":"Save"})]})]})]}),e.jsxs(u,{children:[e.jsx(C,{children:e.jsx(b,{children:"Technology Stack"})}),e.jsxs(p,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"runtime",children:"Runtime"}),e.jsx(c,{id:"runtime",value:s.stack.runtime,onChange:t=>r("stack.runtime",t.target.value),placeholder:"node|python|go|etc"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"framework",children:"Framework"}),e.jsx(c,{id:"framework",value:s.stack.framework,onChange:t=>r("stack.framework",t.target.value),placeholder:"express|fastify|django|gin|etc"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"language",children:"Language"}),e.jsx(c,{id:"language",value:s.stack.language,onChange:t=>r("stack.language",t.target.value),placeholder:"typescript|javascript|python|go|etc"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"database",children:"Database"}),e.jsx(c,{id:"database",value:s.stack.database,onChange:t=>r("stack.database",t.target.value),placeholder:"postgresql|mysql|mongodb|sqlite|etc"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"deployment",children:"Deployment"}),e.jsx(c,{id:"deployment",value:s.stack.deployment,onChange:t=>r("stack.deployment",t.target.value),placeholder:"docker|kubernetes|vercel|aws|etc"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"repository",children:"Repository"}),e.jsx(c,{id:"repository",value:s.stack.repository,onChange:t=>r("stack.repository",t.target.value),placeholder:"https://github.com/yourorg/yourproject"})]})]})]})]}),e.jsxs(u,{children:[e.jsx(C,{children:e.jsx(b,{children:"Architecture Documentation"})}),e.jsx(p,{children:e.jsx(I,{value:x,onChange:t=>j(t||""),placeholder:`Write your architecture documentation in markdown...
1
+ import{u as L,a as A,r as o,A as N,j as e,B as w,L as D,a1 as M,I as c}from"./index-opozMhku.js";import{C as u,a as p,b as C,c as b}from"./card-Btt3HmXT.js";import{L as n}from"./label-bMzKAcdZ.js";import{M as I}from"./markdown-editor-B3gIcmI2.js";import{A as T}from"./arrow-left-DmNgC0xD.js";import{C as B}from"./circle-check-big-CVbQ_zpj.js";import"./index-J8MrpD0P.js";function H(){const S=L(),{toast:i}=A(),[s,g]=o.useState({stack:{runtime:"",framework:"",language:"",database:"",deployment:"",repository:""}}),[x,j]=o.useState(""),[F,v]=o.useState(!0),[y,f]=o.useState(!1);o.useEffect(()=>{fetch(`${N}/api/v1/context/architecture`).then(t=>t.json()).then(t=>{if(t.success){const a=t.document,d={stack:{runtime:a.metadata.stack?.runtime||"",framework:a.metadata.stack?.framework||"",language:a.metadata.stack?.language||"",database:a.metadata.stack?.database||"",deployment:a.metadata.stack?.deployment||"",repository:a.metadata.stack?.repository||""}};g(d),j(a.content.trim())}v(!1)}).catch(t=>{console.error("Failed to load context:",t),i({title:"Error",description:"Failed to load architecture documentation",variant:"destructive"}),v(!1)})},[i]);const E=async()=>{f(!0);try{const a=await(await fetch(`${N}/api/v1/context/architecture`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:x,metadata:{stack:s.stack}})})).json();if(a.success)i({title:"Success",description:"Architecture documentation saved successfully",action:e.jsx(B,{className:"h-4 w-4"})}),S("/context/architecture");else throw new Error(a.error||"Failed to save context")}catch(t){console.error("Save error:",t),i({title:"Error",description:"Failed to save architecture documentation",variant:"destructive"})}finally{f(!1)}},r=(t,a)=>{g(d=>{const k={...d},l=t.split(".");let m=k;for(let h=0;h<l.length-1;h++)m=m[l[h]];return m[l[l.length-1]]=a,k})};return F?e.jsx("div",{className:"space-y-6",children:e.jsx(u,{children:e.jsx(p,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Edit Architecture"}),e.jsx("p",{className:"text-muted-foreground text-sm hidden sm:block",children:"Edit technical architecture and supporting metadata"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(w,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(D,{to:"/context/architecture",className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(T,{className:"w-4 h-4"})})}),e.jsxs(w,{onClick:E,disabled:y,size:"sm",children:[e.jsx(M,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:y?"Saving...":"Save"})]})]})]}),e.jsxs(u,{children:[e.jsx(C,{children:e.jsx(b,{children:"Technology Stack"})}),e.jsxs(p,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"runtime",children:"Runtime"}),e.jsx(c,{id:"runtime",value:s.stack.runtime,onChange:t=>r("stack.runtime",t.target.value),placeholder:"node|python|go|etc"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"framework",children:"Framework"}),e.jsx(c,{id:"framework",value:s.stack.framework,onChange:t=>r("stack.framework",t.target.value),placeholder:"express|fastify|django|gin|etc"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"language",children:"Language"}),e.jsx(c,{id:"language",value:s.stack.language,onChange:t=>r("stack.language",t.target.value),placeholder:"typescript|javascript|python|go|etc"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"database",children:"Database"}),e.jsx(c,{id:"database",value:s.stack.database,onChange:t=>r("stack.database",t.target.value),placeholder:"postgresql|mysql|mongodb|sqlite|etc"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"deployment",children:"Deployment"}),e.jsx(c,{id:"deployment",value:s.stack.deployment,onChange:t=>r("stack.deployment",t.target.value),placeholder:"docker|kubernetes|vercel|aws|etc"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"repository",children:"Repository"}),e.jsx(c,{id:"repository",value:s.stack.repository,onChange:t=>r("stack.repository",t.target.value),placeholder:"https://github.com/yourorg/yourproject"})]})]})]})]}),e.jsxs(u,{children:[e.jsx(C,{children:e.jsx(b,{children:"Architecture Documentation"})}),e.jsx(p,{children:e.jsx(I,{value:x,onChange:t=>j(t||""),placeholder:`Write your architecture documentation in markdown...
2
2
 
3
3
  ## System Design
4
4
 
@@ -0,0 +1,15 @@
1
+ import{u as L,a as A,r as o,A as N,j as e,B as w,L as D,a1 as M,I as c}from"./index-C_KCaLlP.js";import{C as u,a as p,b as C,c as b}from"./card-BpqK1BMM.js";import{L as n}from"./label-wtSCiOqT.js";import{M as I}from"./markdown-editor-D_er7zWv.js";import{A as T}from"./arrow-left-B_QwfLPP.js";import{C as B}from"./circle-check-big-DqKKs8fZ.js";import"./index-PBkZiuRI.js";function H(){const S=L(),{toast:i}=A(),[s,g]=o.useState({stack:{runtime:"",framework:"",language:"",database:"",deployment:"",repository:""}}),[x,j]=o.useState(""),[F,v]=o.useState(!0),[y,f]=o.useState(!1);o.useEffect(()=>{fetch(`${N}/api/v1/context/architecture`).then(t=>t.json()).then(t=>{if(t.success){const a=t.document,d={stack:{runtime:a.metadata.stack?.runtime||"",framework:a.metadata.stack?.framework||"",language:a.metadata.stack?.language||"",database:a.metadata.stack?.database||"",deployment:a.metadata.stack?.deployment||"",repository:a.metadata.stack?.repository||""}};g(d),j(a.content.trim())}v(!1)}).catch(t=>{console.error("Failed to load context:",t),i({title:"Error",description:"Failed to load architecture documentation",variant:"destructive"}),v(!1)})},[i]);const E=async()=>{f(!0);try{const a=await(await fetch(`${N}/api/v1/context/architecture`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:x,metadata:{stack:s.stack}})})).json();if(a.success)i({title:"Success",description:"Architecture documentation saved successfully",action:e.jsx(B,{className:"h-4 w-4"})}),S("/context/architecture");else throw new Error(a.error||"Failed to save context")}catch(t){console.error("Save error:",t),i({title:"Error",description:"Failed to save architecture documentation",variant:"destructive"})}finally{f(!1)}},r=(t,a)=>{g(d=>{const k={...d},l=t.split(".");let m=k;for(let h=0;h<l.length-1;h++)m=m[l[h]];return m[l[l.length-1]]=a,k})};return F?e.jsx("div",{className:"space-y-6",children:e.jsx(u,{children:e.jsx(p,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Edit Architecture"}),e.jsx("p",{className:"text-muted-foreground text-sm hidden sm:block",children:"Edit technical architecture and supporting metadata"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(w,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(D,{to:"/context/architecture",className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(T,{className:"w-4 h-4"})})}),e.jsxs(w,{onClick:E,disabled:y,size:"sm",children:[e.jsx(M,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:y?"Saving...":"Save"})]})]})]}),e.jsxs(u,{children:[e.jsx(C,{children:e.jsx(b,{children:"Technology Stack"})}),e.jsxs(p,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"runtime",children:"Runtime"}),e.jsx(c,{id:"runtime",value:s.stack.runtime,onChange:t=>r("stack.runtime",t.target.value),placeholder:"node|python|go|etc"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"framework",children:"Framework"}),e.jsx(c,{id:"framework",value:s.stack.framework,onChange:t=>r("stack.framework",t.target.value),placeholder:"express|fastify|django|gin|etc"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"language",children:"Language"}),e.jsx(c,{id:"language",value:s.stack.language,onChange:t=>r("stack.language",t.target.value),placeholder:"typescript|javascript|python|go|etc"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"database",children:"Database"}),e.jsx(c,{id:"database",value:s.stack.database,onChange:t=>r("stack.database",t.target.value),placeholder:"postgresql|mysql|mongodb|sqlite|etc"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"deployment",children:"Deployment"}),e.jsx(c,{id:"deployment",value:s.stack.deployment,onChange:t=>r("stack.deployment",t.target.value),placeholder:"docker|kubernetes|vercel|aws|etc"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"repository",children:"Repository"}),e.jsx(c,{id:"repository",value:s.stack.repository,onChange:t=>r("stack.repository",t.target.value),placeholder:"https://github.com/yourorg/yourproject"})]})]})]})]}),e.jsxs(u,{children:[e.jsx(C,{children:e.jsx(b,{children:"Architecture Documentation"})}),e.jsx(p,{children:e.jsx(I,{value:x,onChange:t=>j(t||""),placeholder:`Write your architecture documentation in markdown...
2
+
3
+ ## System Design
4
+
5
+ Describe your high-level system architecture here.
6
+
7
+ ## Directory Structure
8
+
9
+ \`\`\`
10
+ project-root/
11
+ ├── src/
12
+ │ ├── components/
13
+ │ ├── pages/
14
+ │ └── services/
15
+ \`\`\``,height:800})})]})]})}export{H as default};
@@ -1 +1 @@
1
- import{a as v,r as a,A as g,j as e,v as k,F as y,B as l,M as w,av as C,L as b,_ as E,ar as A}from"./index-BWhM9fZn.js";import{C as c,a as r,b as o,c as m}from"./card-jBf8qQSy.js";import{c as D}from"./clipboard-B9ndUJKl.js";function S(){const{toast:d}=v(),[n,h]=a.useState(null),[x,u]=a.useState(!0),[p,i]=a.useState(!1);a.useEffect(()=>{fetch(`${g}/api/v1/context/architecture`).then(t=>{if(t.ok)return t.json();throw new Error("Not found")}).then(t=>{t.success?(h(t.document),i(!0)):i(!1)}).catch(()=>{i(!1)}).finally(()=>{u(!1)})},[]);const j=async()=>{const t=".nut/context/architecture.md";try{await D(t),d({title:"Copied!",description:`Path ${t} copied to clipboard`})}catch(N){console.error("Failed to copy path:",N),d({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},f=()=>{const t=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"architecture-md",filename:"architecture.md",name:"architecture.md",path:".nut/context/architecture.md"}});window.dispatchEvent(t)};if(x)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(k,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading architecture documentation..."})]})})})});if(!p||!n)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Architecture Documentation Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Architecture documentation will appear here once created."})]})})})});const s=n.metadata;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Technical Architecture"}),e.jsx("p",{className:"text-muted-foreground",children:"System design, components, and technical patterns"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(l,{variant:"outline",size:"sm",onClick:f,children:[e.jsx(w,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(l,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(C,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(l,{size:"sm",asChild:!0,children:e.jsxs(b,{to:"/context/architecture/edit",children:[e.jsx(E,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),s&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e.jsxs(c,{children:[e.jsx(o,{className:"pb-3",children:e.jsx(m,{className:"text-lg font-semibold",children:"Technology Stack"})}),e.jsx(r,{className:"space-y-3",children:s.stack&&e.jsxs("div",{className:"space-y-1 text-sm",children:[s.stack.runtime&&e.jsxs("div",{children:["Runtime: ",s.stack.runtime]}),s.stack.framework&&e.jsxs("div",{children:["Framework: ",s.stack.framework]}),s.stack.language&&e.jsxs("div",{children:["Language: ",s.stack.language]}),s.stack.database&&e.jsxs("div",{children:["Database: ",s.stack.database]}),s.stack.deployment&&e.jsxs("div",{children:["Deployment: ",s.stack.deployment]}),s.stack.repository&&e.jsxs("div",{children:["Repository:"," ",e.jsx("a",{href:s.stack.repository,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:s.stack.repository})]})]})})]})}),e.jsxs(c,{children:[e.jsx(o,{children:e.jsx(m,{className:"text-lg font-semibold",children:"Architecture Documentation"})}),e.jsx(r,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(A,{children:n.content||"No content available"})})})]})]})}export{S as default};
1
+ import{a as v,r as a,A as g,j as e,v as k,F as y,B as l,M as w,av as C,L as b,_ as E,ar as A}from"./index-C_KCaLlP.js";import{C as c,a as r,b as o,c as m}from"./card-BpqK1BMM.js";import{c as D}from"./clipboard-B9ndUJKl.js";function S(){const{toast:d}=v(),[n,h]=a.useState(null),[x,u]=a.useState(!0),[p,i]=a.useState(!1);a.useEffect(()=>{fetch(`${g}/api/v1/context/architecture`).then(t=>{if(t.ok)return t.json();throw new Error("Not found")}).then(t=>{t.success?(h(t.document),i(!0)):i(!1)}).catch(()=>{i(!1)}).finally(()=>{u(!1)})},[]);const j=async()=>{const t=".nut/context/architecture.md";try{await D(t),d({title:"Copied!",description:`Path ${t} copied to clipboard`})}catch(N){console.error("Failed to copy path:",N),d({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},f=()=>{const t=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"architecture-md",filename:"architecture.md",name:"architecture.md",path:".nut/context/architecture.md"}});window.dispatchEvent(t)};if(x)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(k,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading architecture documentation..."})]})})})});if(!p||!n)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Architecture Documentation Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Architecture documentation will appear here once created."})]})})})});const s=n.metadata;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Technical Architecture"}),e.jsx("p",{className:"text-muted-foreground",children:"System design, components, and technical patterns"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(l,{variant:"outline",size:"sm",onClick:f,children:[e.jsx(w,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(l,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(C,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(l,{size:"sm",asChild:!0,children:e.jsxs(b,{to:"/context/architecture/edit",children:[e.jsx(E,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),s&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e.jsxs(c,{children:[e.jsx(o,{className:"pb-3",children:e.jsx(m,{className:"text-lg font-semibold",children:"Technology Stack"})}),e.jsx(r,{className:"space-y-3",children:s.stack&&e.jsxs("div",{className:"space-y-1 text-sm",children:[s.stack.runtime&&e.jsxs("div",{children:["Runtime: ",s.stack.runtime]}),s.stack.framework&&e.jsxs("div",{children:["Framework: ",s.stack.framework]}),s.stack.language&&e.jsxs("div",{children:["Language: ",s.stack.language]}),s.stack.database&&e.jsxs("div",{children:["Database: ",s.stack.database]}),s.stack.deployment&&e.jsxs("div",{children:["Deployment: ",s.stack.deployment]}),s.stack.repository&&e.jsxs("div",{children:["Repository:"," ",e.jsx("a",{href:s.stack.repository,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:s.stack.repository})]})]})})]})}),e.jsxs(c,{children:[e.jsx(o,{children:e.jsx(m,{className:"text-lg font-semibold",children:"Architecture Documentation"})}),e.jsx(r,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(A,{children:n.content||"No content available"})})})]})]})}export{S as default};
@@ -0,0 +1 @@
1
+ import{a as v,r as a,A as g,j as e,v as k,F as y,B as l,M as w,av as C,L as b,_ as E,ar as A}from"./index-opozMhku.js";import{C as c,a as r,b as o,c as m}from"./card-Btt3HmXT.js";import{c as D}from"./clipboard-B9ndUJKl.js";function S(){const{toast:d}=v(),[n,h]=a.useState(null),[x,u]=a.useState(!0),[p,i]=a.useState(!1);a.useEffect(()=>{fetch(`${g}/api/v1/context/architecture`).then(t=>{if(t.ok)return t.json();throw new Error("Not found")}).then(t=>{t.success?(h(t.document),i(!0)):i(!1)}).catch(()=>{i(!1)}).finally(()=>{u(!1)})},[]);const j=async()=>{const t=".nut/context/architecture.md";try{await D(t),d({title:"Copied!",description:`Path ${t} copied to clipboard`})}catch(N){console.error("Failed to copy path:",N),d({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},f=()=>{const t=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"architecture-md",filename:"architecture.md",name:"architecture.md",path:".nut/context/architecture.md"}});window.dispatchEvent(t)};if(x)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(k,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading architecture documentation..."})]})})})});if(!p||!n)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Architecture Documentation Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Architecture documentation will appear here once created."})]})})})});const s=n.metadata;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Technical Architecture"}),e.jsx("p",{className:"text-muted-foreground",children:"System design, components, and technical patterns"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(l,{variant:"outline",size:"sm",onClick:f,children:[e.jsx(w,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(l,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(C,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(l,{size:"sm",asChild:!0,children:e.jsxs(b,{to:"/context/architecture/edit",children:[e.jsx(E,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),s&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e.jsxs(c,{children:[e.jsx(o,{className:"pb-3",children:e.jsx(m,{className:"text-lg font-semibold",children:"Technology Stack"})}),e.jsx(r,{className:"space-y-3",children:s.stack&&e.jsxs("div",{className:"space-y-1 text-sm",children:[s.stack.runtime&&e.jsxs("div",{children:["Runtime: ",s.stack.runtime]}),s.stack.framework&&e.jsxs("div",{children:["Framework: ",s.stack.framework]}),s.stack.language&&e.jsxs("div",{children:["Language: ",s.stack.language]}),s.stack.database&&e.jsxs("div",{children:["Database: ",s.stack.database]}),s.stack.deployment&&e.jsxs("div",{children:["Deployment: ",s.stack.deployment]}),s.stack.repository&&e.jsxs("div",{children:["Repository:"," ",e.jsx("a",{href:s.stack.repository,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:s.stack.repository})]})]})})]})}),e.jsxs(c,{children:[e.jsx(o,{children:e.jsx(m,{className:"text-lg font-semibold",children:"Architecture Documentation"})}),e.jsx(r,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(A,{children:n.content||"No content available"})})})]})]})}export{S as default};
@@ -1,4 +1,4 @@
1
- import{c as Y,t as le,r as n,bE as c,j as e,bD as O,i as ce,D as I,W as M,B as l,b as V,d as $,f as H,g as J,I as j,Y as z,z as oe,E as de,H as he,J as ue,N as xe,O as me,Q as ge,R as je,U as pe,V as ve,w as r}from"./index-BWhM9fZn.js";import{C as p,b as v,c as w,d as f,a as y}from"./card-jBf8qQSy.js";import{L as o}from"./label-CHVVHrlr.js";import{S as _,a as W,b as q,c as B,d as a}from"./select-D8HyxWyg.js";import{S as U}from"./switch-Ck0OeSLk.js";import{B as k}from"./badge-CKqDVhJv.js";import{C as we}from"./circle-alert-DqK0nUqF.js";import"./index-CdmUQF6-.js";import"./chevron-up-CcwaoTsZ.js";/**
1
+ import{c as Y,t as le,r as n,bE as c,j as e,bD as O,i as ce,D as I,W as M,B as l,b as V,d as $,f as H,g as J,I as j,Y as z,z as oe,E as de,H as he,J as ue,N as xe,O as me,Q as ge,R as je,U as pe,V as ve,w as r}from"./index-opozMhku.js";import{C as p,b as v,c as w,d as f,a as y}from"./card-Btt3HmXT.js";import{L as o}from"./label-bMzKAcdZ.js";import{S as _,a as W,b as q,c as B,d as a}from"./select-9YyUa5YH.js";import{S as U}from"./switch-D7e1drXt.js";import{B as k}from"./badge-BmHXIBBB.js";import{C as we}from"./circle-alert-CQ-Ir4mS.js";import"./index-J8MrpD0P.js";import"./chevron-up-gnoSEbf_.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,11 @@
1
+ import{c as Y,t as le,r as n,bE as c,j as e,bD as O,i as ce,D as I,W as M,B as l,b as V,d as $,f as H,g as J,I as j,Y as z,z as oe,E as de,H as he,J as ue,N as xe,O as me,Q as ge,R as je,U as pe,V as ve,w as r}from"./index-C_KCaLlP.js";import{C as p,b as v,c as w,d as f,a as y}from"./card-BpqK1BMM.js";import{L as o}from"./label-wtSCiOqT.js";import{S as _,a as W,b as q,c as B,d as a}from"./select-BKdFrV6O.js";import{S as U}from"./switch-Bhm5em7I.js";import{B as k}from"./badge-BzEwwrAP.js";import{C as we}from"./circle-alert-Coa2ulVd.js";import"./index-PBkZiuRI.js";import"./chevron-up-DaWWwb87.js";/**
2
+ * @license lucide-react v0.542.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const fe=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],ye=Y("key-round",fe);/**
7
+ * @license lucide-react v0.542.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Ne=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Se=Y("user-plus",Ne);function Re(){const{user:N,authEnabled:K,checkAuthStatus:Q}=le(),[i,d]=n.useState(null),[G,F]=n.useState(!0),[S,D]=n.useState(!1),[X,C]=n.useState(!1),[b,P]=n.useState(""),[A,R]=n.useState(""),[T,L]=n.useState("viewer"),[E,u]=n.useState(null),[x,m]=n.useState(""),Z=!K||N?.role==="admin";n.useEffect(()=>{h()},[]);const h=async()=>{try{F(!0);const s=await c("/api/v1/auth-settings");s.success?d(s.data):d(null)}catch(s){console.error("Failed to load auth settings:",s),d(null)}finally{F(!1)}},ee=async()=>{if(!i)return;const s=!i.enabled;try{const t=await c("/api/v1/auth-settings",{method:"PUT",body:JSON.stringify({enabled:s})});if(t.success)d({...i,enabled:s}),await Q(),r({title:"Success",description:`Authentication ${s?"enabled":"disabled"}`});else throw new Error(t.error||"Failed to toggle auth")}catch(t){r({title:"Error",description:t.message||"Failed to toggle authentication",variant:"destructive"})}},se=async()=>{if(!i)return;const s=!i.allowRegistration;try{const t=await c("/api/v1/auth-settings",{method:"PUT",body:JSON.stringify({allowRegistration:s})});if(t.success)d({...i,allowRegistration:s}),r({title:"Success",description:`Self-registration ${s?"enabled":"disabled"}`});else throw new Error(t.error||"Failed to update setting")}catch(t){r({title:"Error",description:t.message||"Failed to update setting",variant:"destructive"})}},te=async()=>{if(!b||!A){r({title:"Error",description:"Please provide email and name",variant:"destructive"});return}try{const s=await c("/api/v1/auth-settings/users",{method:"POST",body:JSON.stringify({email:b,name:A,role:T})});if(s.success)await h(),C(!1),P(""),R(""),L("viewer"),r({title:"Success",description:"User added to whitelist"});else throw new Error(s.error||"Failed to add user")}catch(s){r({title:"Error",description:s.message||"Failed to add user",variant:"destructive"})}},ie=async s=>{try{const t=await c(`/api/v1/auth-settings/users/${s}`,{method:"DELETE"});if(t.success)await h(),r({title:"Success",description:"User removed from whitelist"});else throw new Error(t.error||"Failed to remove user")}catch(t){r({title:"Error",description:t.message||"Failed to remove user",variant:"destructive"})}},re=async(s,t)=>{try{const g=await c(`/api/v1/auth-settings/users/${s}`,{method:"PUT",body:JSON.stringify({role:t})});if(g.success)await h(),r({title:"Success",description:"User role updated"});else throw new Error(g.error||"Failed to update role")}catch(g){r({title:"Error",description:g.message||"Failed to update role",variant:"destructive"})}},ae=async()=>{if(!(!E||!x)){if(x.length<8){r({title:"Error",description:"Password must be at least 8 characters",variant:"destructive"});return}try{const s=await c(`/api/v1/auth-settings/users/${E}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:x})});if(s.success)u(null),m(""),r({title:"Success",description:"Password reset successfully"});else throw new Error(s.error||"Failed to reset password")}catch(s){r({title:"Error",description:s.message||"Failed to reset password",variant:"destructive"})}}},ne=async()=>{if(i)try{D(!0);const s=await c("/api/v1/auth-settings",{method:"PUT",body:JSON.stringify({session:i.session})});if(s.success)r({title:"Success",description:"Session settings updated"});else throw new Error(s.error||"Failed to update settings")}catch(s){r({title:"Error",description:s.message||"Failed to update settings",variant:"destructive"})}finally{D(!1)}};return G?e.jsx("div",{children:"Loading..."}):i?Z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage authentication settings and user access."})]}),e.jsx(O,{}),e.jsxs(p,{children:[e.jsxs(v,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5"}),e.jsx(w,{children:"Authentication Status"})]}),e.jsx(f,{children:"Control whether authentication is required to access Coconut."})]}),e.jsxs(y,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"auth-enabled",children:"Require Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"When enabled, users must log in to access Coconut"})]}),e.jsx(U,{id:"auth-enabled",checked:i.enabled,onCheckedChange:ee})]}),i.enabled&&e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"allow-registration",children:"Allow Self-Registration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Whitelisted users can create their own accounts"})]}),e.jsx(U,{id:"allow-registration",checked:i.allowRegistration,onCheckedChange:se})]})]})]}),e.jsxs(p,{children:[e.jsx(v,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(w,{children:"Whitelisted Users"}),e.jsx(f,{children:"Manage users who can access this Coconut instance."})]}),e.jsxs(I,{open:X,onOpenChange:C,children:[e.jsx(M,{asChild:!0,children:e.jsxs(l,{size:"sm",children:[e.jsx(Se,{className:"h-4 w-4 mr-2"}),"Add User"]})}),e.jsxs(V,{children:[e.jsxs($,{children:[e.jsx(H,{children:"Add User to Whitelist"}),e.jsx(J,{children:"Add a user's email to allow them to register and access Coconut."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"new-email",children:"Email"}),e.jsx(j,{id:"new-email",type:"email",value:b,onChange:s=>P(s.target.value),placeholder:"user@example.com"})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:"new-name",children:"Name"}),e.jsx(j,{id:"new-name",value:A,onChange:s=>R(s.target.value),placeholder:"User Name"})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:"new-role",children:"Role"}),e.jsxs(_,{value:T,onValueChange:s=>L(s),children:[e.jsx(W,{children:e.jsx(q,{})}),e.jsxs(B,{children:[e.jsx(a,{value:"viewer",children:"Viewer"}),e.jsx(a,{value:"engineer",children:"Engineer"}),e.jsx(a,{value:"designer",children:"Designer"}),e.jsx(a,{value:"product_manager",children:"Product Manager"}),e.jsx(a,{value:"manager",children:"Manager"}),e.jsx(a,{value:"admin",children:"Admin"})]})]})]})]}),e.jsxs(z,{children:[e.jsx(l,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),e.jsx(l,{onClick:te,children:"Add User"})]})]})]})]})}),e.jsx(y,{children:e.jsx("div",{className:"space-y-4",children:i.providers.local.users.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-medium",children:s.name}),s.registered?e.jsx(k,{variant:"default",className:"text-xs",children:"Registered"}):e.jsx(k,{variant:"secondary",className:"text-xs",children:"Pending"}),s.id===N?.id&&e.jsx(k,{variant:"outline",className:"text-xs",children:"You"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.email}),s.lastLoginAt&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last login: ",new Date(s.lastLoginAt).toLocaleString()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{value:s.role,onValueChange:t=>re(s.id,t),children:[e.jsx(W,{className:"w-40",children:e.jsx(q,{})}),e.jsxs(B,{children:[e.jsx(a,{value:"viewer",children:"Viewer"}),e.jsx(a,{value:"engineer",children:"Engineer"}),e.jsx(a,{value:"designer",children:"Designer"}),e.jsx(a,{value:"product_manager",children:"Product Manager"}),e.jsx(a,{value:"manager",children:"Manager"}),e.jsx(a,{value:"admin",children:"Admin"})]})]}),e.jsxs(I,{open:E===s.id,onOpenChange:t=>{t||(u(null),m(""))},children:[e.jsx(M,{asChild:!0,children:e.jsx(l,{size:"sm",variant:"outline",onClick:()=>u(s.id),children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsxs(V,{children:[e.jsxs($,{children:[e.jsx(H,{children:"Reset Password"}),e.jsxs(J,{children:["Set a new password for ",s.name]})]}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{children:[e.jsx(o,{htmlFor:"reset-password",children:"New Password"}),e.jsx(j,{id:"reset-password",type:"password",value:x,onChange:t=>m(t.target.value),placeholder:"At least 8 characters",minLength:8})]})}),e.jsxs(z,{children:[e.jsx(l,{variant:"outline",onClick:()=>{u(null),m("")},children:"Cancel"}),e.jsx(l,{onClick:ae,children:"Reset Password"})]})]})]}),s.id!==N?.id&&e.jsxs(oe,{children:[e.jsx(de,{asChild:!0,children:e.jsx(l,{size:"sm",variant:"destructive",children:e.jsx(he,{className:"h-4 w-4"})})}),e.jsxs(ue,{children:[e.jsxs(xe,{children:[e.jsx(me,{children:"Remove User"}),e.jsxs(ge,{children:["Are you sure you want to remove ",s.name," from the whitelist? They will no longer be able to access Coconut."]})]}),e.jsxs(je,{children:[e.jsx(pe,{children:"Cancel"}),e.jsx(ve,{onClick:()=>ie(s.id),children:"Remove"})]})]})]})]})]},s.id))})})]}),e.jsxs(p,{children:[e.jsxs(v,{children:[e.jsx(w,{children:"Session Settings"}),e.jsx(f,{children:"Configure session behavior and security."})]}),e.jsxs(y,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"session-expiry",children:"Session Expiry"}),e.jsx(j,{id:"session-expiry",value:i.session.expiresIn,onChange:s=>d({...i,session:{...i.session,expiresIn:s.target.value}}),placeholder:"7d"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Format: 30s, 15m, 24h, 7d"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"secure-cookies",children:"Secure Cookies (HTTPS only)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable in production with HTTPS"})]}),e.jsx(U,{id:"secure-cookies",checked:i.session.secure||!1,onCheckedChange:s=>d({...i,session:{...i.session,secure:s}})})]})]})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(l,{variant:"outline",onClick:h,disabled:S,children:"Cancel"}),e.jsx(l,{onClick:ne,disabled:S,children:S?"Saving...":"Save Session Settings"})]})]}):e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"You don't have permission to manage authentication settings."})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Secure your Coconut instance with authentication."})]}),e.jsx(O,{}),e.jsxs(p,{children:[e.jsxs(v,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(we,{className:"h-5 w-5 text-muted-foreground"}),e.jsx(w,{children:"Authentication Not Configured"})]}),e.jsx(f,{children:"Authentication has not been initialized. Use the CLI to set up authentication."})]}),e.jsxs(y,{children:[e.jsx("div",{className:"bg-muted p-4 rounded-md",children:e.jsxs("code",{className:"text-sm",children:["$ nut auth init",e.jsx("br",{}),"$ nut auth toggle"]})}),e.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:"This will create an admin user and enable authentication for your Coconut instance."})]})]})]})}export{Re as default};
@@ -1 +1 @@
1
- import{r as m,j as e,v as x,A as f}from"./index-BWhM9fZn.js";import{C as w}from"./circle-check-qo4cPVA1.js";import{C as b}from"./circle-x-Bd57ohC5.js";const r="coconut/github-auth-state";function j(s){try{window.opener&&window.opener.postMessage({type:"github-auth",...s},window.location.origin)}catch{}}const y=()=>{const[s,d]=m.useState("pending"),[h,p]=m.useState("Authorizing GitHub…");return m.useEffect(()=>{const a=new URLSearchParams(window.location.search),u=a.get("error"),l=a.get("token"),n=a.get("expires_at")||a.get("expiresAt"),c=a.get("state"),o=t=>{j(t),d(t.success?"success":"error"),p(t.message),setTimeout(()=>{try{window.close()}catch{}},1200)};if(u){localStorage.removeItem(r),o({success:!1,message:decodeURIComponent(u)});return}if(!l||!n||!c){localStorage.removeItem(r),o({success:!1,message:"Missing authorization parameters. Please try again."});return}const g=localStorage.getItem(r);if(!g||g!==c){localStorage.removeItem(r),o({success:!1,message:"Authorization state mismatch. Please start again."});return}(async()=>{try{const t=await fetch(`${f}/api/v1/git/providers/github/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:l,expiresAt:n,state:c})}),i=await t.json();if(!t.ok||!i.success)throw new Error(i?.error?.message||"Failed to store GitHub token");localStorage.removeItem(r),o({success:!0,message:"GitHub connected successfully!",expiresAt:i.data?.expiresAt||n})}catch(t){localStorage.removeItem(r),o({success:!1,message:t?.message||"Failed to store GitHub token. Please try again."})}})()},[]),e.jsx("div",{className:"flex h-screen items-center justify-center bg-background px-6",children:e.jsxs("div",{className:"max-w-sm rounded-lg border bg-card p-6 text-center shadow-sm",children:[e.jsxs("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:[s==="pending"&&e.jsx(x,{className:"h-6 w-6 animate-spin text-muted-foreground"}),s==="success"&&e.jsx(w,{className:"h-6 w-6 text-green-600"}),s==="error"&&e.jsx(b,{className:"h-6 w-6 text-red-600"})]}),e.jsx("h1",{className:"text-lg font-semibold",children:"GitHub Authorization"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:h}),s!=="pending"&&e.jsx("p",{className:"mt-4 text-xs text-muted-foreground",children:"You can close this window and return to Coconut."})]})})};export{y as default};
1
+ import{r as m,j as e,v as x,A as f}from"./index-C_KCaLlP.js";import{C as w}from"./circle-check-C9wy7OAO.js";import{C as b}from"./circle-x-Du7Cp5MD.js";const r="coconut/github-auth-state";function j(s){try{window.opener&&window.opener.postMessage({type:"github-auth",...s},window.location.origin)}catch{}}const y=()=>{const[s,d]=m.useState("pending"),[h,p]=m.useState("Authorizing GitHub…");return m.useEffect(()=>{const a=new URLSearchParams(window.location.search),u=a.get("error"),l=a.get("token"),n=a.get("expires_at")||a.get("expiresAt"),c=a.get("state"),o=t=>{j(t),d(t.success?"success":"error"),p(t.message),setTimeout(()=>{try{window.close()}catch{}},1200)};if(u){localStorage.removeItem(r),o({success:!1,message:decodeURIComponent(u)});return}if(!l||!n||!c){localStorage.removeItem(r),o({success:!1,message:"Missing authorization parameters. Please try again."});return}const g=localStorage.getItem(r);if(!g||g!==c){localStorage.removeItem(r),o({success:!1,message:"Authorization state mismatch. Please start again."});return}(async()=>{try{const t=await fetch(`${f}/api/v1/git/providers/github/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:l,expiresAt:n,state:c})}),i=await t.json();if(!t.ok||!i.success)throw new Error(i?.error?.message||"Failed to store GitHub token");localStorage.removeItem(r),o({success:!0,message:"GitHub connected successfully!",expiresAt:i.data?.expiresAt||n})}catch(t){localStorage.removeItem(r),o({success:!1,message:t?.message||"Failed to store GitHub token. Please try again."})}})()},[]),e.jsx("div",{className:"flex h-screen items-center justify-center bg-background px-6",children:e.jsxs("div",{className:"max-w-sm rounded-lg border bg-card p-6 text-center shadow-sm",children:[e.jsxs("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:[s==="pending"&&e.jsx(x,{className:"h-6 w-6 animate-spin text-muted-foreground"}),s==="success"&&e.jsx(w,{className:"h-6 w-6 text-green-600"}),s==="error"&&e.jsx(b,{className:"h-6 w-6 text-red-600"})]}),e.jsx("h1",{className:"text-lg font-semibold",children:"GitHub Authorization"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:h}),s!=="pending"&&e.jsx("p",{className:"mt-4 text-xs text-muted-foreground",children:"You can close this window and return to Coconut."})]})})};export{y as default};
@@ -0,0 +1 @@
1
+ import{r as m,j as e,v as x,A as f}from"./index-opozMhku.js";import{C as w}from"./circle-check-01UufaGN.js";import{C as b}from"./circle-x-Cs5S3HID.js";const r="coconut/github-auth-state";function j(s){try{window.opener&&window.opener.postMessage({type:"github-auth",...s},window.location.origin)}catch{}}const y=()=>{const[s,d]=m.useState("pending"),[h,p]=m.useState("Authorizing GitHub…");return m.useEffect(()=>{const a=new URLSearchParams(window.location.search),u=a.get("error"),l=a.get("token"),n=a.get("expires_at")||a.get("expiresAt"),c=a.get("state"),o=t=>{j(t),d(t.success?"success":"error"),p(t.message),setTimeout(()=>{try{window.close()}catch{}},1200)};if(u){localStorage.removeItem(r),o({success:!1,message:decodeURIComponent(u)});return}if(!l||!n||!c){localStorage.removeItem(r),o({success:!1,message:"Missing authorization parameters. Please try again."});return}const g=localStorage.getItem(r);if(!g||g!==c){localStorage.removeItem(r),o({success:!1,message:"Authorization state mismatch. Please start again."});return}(async()=>{try{const t=await fetch(`${f}/api/v1/git/providers/github/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:l,expiresAt:n,state:c})}),i=await t.json();if(!t.ok||!i.success)throw new Error(i?.error?.message||"Failed to store GitHub token");localStorage.removeItem(r),o({success:!0,message:"GitHub connected successfully!",expiresAt:i.data?.expiresAt||n})}catch(t){localStorage.removeItem(r),o({success:!1,message:t?.message||"Failed to store GitHub token. Please try again."})}})()},[]),e.jsx("div",{className:"flex h-screen items-center justify-center bg-background px-6",children:e.jsxs("div",{className:"max-w-sm rounded-lg border bg-card p-6 text-center shadow-sm",children:[e.jsxs("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:[s==="pending"&&e.jsx(x,{className:"h-6 w-6 animate-spin text-muted-foreground"}),s==="success"&&e.jsx(w,{className:"h-6 w-6 text-green-600"}),s==="error"&&e.jsx(b,{className:"h-6 w-6 text-red-600"})]}),e.jsx("h1",{className:"text-lg font-semibold",children:"GitHub Authorization"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:h}),s!=="pending"&&e.jsx("p",{className:"mt-4 text-xs text-muted-foreground",children:"You can close this window and return to Coconut."})]})})};export{y as default};