@hienlh/ppm 0.9.84 → 0.9.85

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 (199) hide show
  1. package/260413-1354-new-file-editor-tab/reports/code-reviewer-260413-1420-new-file-tab-review.md +210 -0
  2. package/CHANGELOG.md +13 -0
  3. package/bun.lock +259 -9
  4. package/dist/web/assets/{_basePickBy-5PGDJbfF.js → _basePickBy-D-bUmjma.js} +1 -1
  5. package/dist/web/assets/{_baseUniq-BT4Ow4Kk.js → _baseUniq-BnXXIfRB.js} +1 -1
  6. package/dist/web/assets/ai-settings-section-D6d-RmR6.js +1 -0
  7. package/dist/web/assets/{api-settings-Bn-bIxD1.js → api-settings-Qi2xRiHa.js} +1 -1
  8. package/dist/web/assets/{arc-BAOivWpI.js → arc-DB9vXGzd.js} +1 -1
  9. package/dist/web/assets/architecture-PBZL5I3N-DpVzOETR.js +1 -0
  10. package/dist/web/assets/{architectureDiagram-2XIMDMQ5-Z-4eN4za.js → architectureDiagram-2XIMDMQ5-BBV25747.js} +1 -1
  11. package/dist/web/assets/{blockDiagram-WCTKOSBZ-BCLqzhuZ.js → blockDiagram-WCTKOSBZ-BOTnY2Lq.js} +1 -1
  12. package/dist/web/assets/{c4Diagram-IC4MRINW-0Vp0Jeas.js → c4Diagram-IC4MRINW-D7QAUdHD.js} +1 -1
  13. package/dist/web/assets/channel-Cgy1thYT.js +1 -0
  14. package/dist/web/assets/chat-tab-DXBb9Y3U.js +10 -0
  15. package/dist/web/assets/check-ePA3ZvK4.js +1 -0
  16. package/dist/web/assets/chevron-down-EQA06nR-.js +1 -0
  17. package/dist/web/assets/{chunk-4BX2VUAB-D4tOov49.js → chunk-4BX2VUAB-BnOVw77D.js} +1 -1
  18. package/dist/web/assets/{chunk-55IACEB6-DJ6BynZ4.js → chunk-55IACEB6-BftA8DxR.js} +1 -1
  19. package/dist/web/assets/{chunk-7E7YKBS2-CiyUJxNI.js → chunk-7E7YKBS2-B0vnP8v3.js} +1 -1
  20. package/dist/web/assets/{chunk-7R4GIKGN-Dv-4cAYn.js → chunk-7R4GIKGN-Czlaj26D.js} +2 -2
  21. package/dist/web/assets/{chunk-C72U2L5F-D21mS_6G.js → chunk-C72U2L5F-DpEbDtMo.js} +1 -1
  22. package/dist/web/assets/{chunk-EGIJ26TM-DzqmU2Z7.js → chunk-EGIJ26TM-BWXe6lkx.js} +1 -1
  23. package/dist/web/assets/{chunk-FMBD7UC4-DXncblvW.js → chunk-FMBD7UC4-DspqhPfk.js} +1 -1
  24. package/dist/web/assets/{chunk-GEFDOKGD-D-pKjlVd.js → chunk-GEFDOKGD-D6HHRbYk.js} +1 -1
  25. package/dist/web/assets/chunk-GLR3WWYH-CxUl1sdz.js +2 -0
  26. package/dist/web/assets/chunk-HHEYEP7N-DN7ebS2Y.js +1 -0
  27. package/dist/web/assets/{chunk-JSJVCQXG-99JzIdPr.js → chunk-JSJVCQXG-BC8wnMwf.js} +1 -1
  28. package/dist/web/assets/{chunk-KX2RTZJC-CRq1OBZv.js → chunk-KX2RTZJC-D3VDtyvX.js} +1 -1
  29. package/dist/web/assets/{chunk-KYZI473N-Bb0MCaIO.js → chunk-KYZI473N-Z-NBw_HS.js} +1 -1
  30. package/dist/web/assets/{chunk-L3YUKLVL-C7qGJrfV.js → chunk-L3YUKLVL--RGkEh__.js} +1 -1
  31. package/dist/web/assets/{chunk-MX3YWQON-BpS_PtKp.js → chunk-MX3YWQON-2B76t_Kx.js} +1 -1
  32. package/dist/web/assets/{chunk-NQ4KR5QH-z_blpjxi.js → chunk-NQ4KR5QH-BekY3tEi.js} +1 -1
  33. package/dist/web/assets/{chunk-O4XLMI2P-nDhi_cVu.js → chunk-O4XLMI2P-2CJLfx_1.js} +1 -1
  34. package/dist/web/assets/{chunk-OZEHJAEY-BXhYx3nO.js → chunk-OZEHJAEY-sug_L09P.js} +1 -1
  35. package/dist/web/assets/{chunk-PQ6SQG4A-TF58UVMU.js → chunk-PQ6SQG4A-_fwPRLQy.js} +1 -1
  36. package/dist/web/assets/{chunk-PU5JKC2W-ek7k4QVB.js → chunk-PU5JKC2W-BUaTFJVQ.js} +1 -1
  37. package/dist/web/assets/chunk-QZHKN3VN-C4La7oLj.js +1 -0
  38. package/dist/web/assets/{chunk-R5LLSJPH-CFwSJijQ.js → chunk-R5LLSJPH-C37xW0vj.js} +1 -1
  39. package/dist/web/assets/{chunk-WL4C6EOR-ByUrSRin.js → chunk-WL4C6EOR-CCkt_MT6.js} +1 -1
  40. package/dist/web/assets/{chunk-XIRO2GV7-Djlmrely.js → chunk-XIRO2GV7-Dz2LBq7Y.js} +1 -1
  41. package/dist/web/assets/{chunk-XPW4576I-BPQQBakK.js → chunk-XPW4576I-DenTbBuj.js} +1 -1
  42. package/dist/web/assets/{chunk-XZSTWKYB-DxAOx4hG.js → chunk-XZSTWKYB-Dbp1nUSQ.js} +1 -1
  43. package/dist/web/assets/{chunk-YBOYWFTD-rQG3QH5s.js → chunk-YBOYWFTD-3OTKowjE.js} +1 -1
  44. package/dist/web/assets/classDiagram-VBA2DB6C-C3IyfqG-.js +1 -0
  45. package/dist/web/assets/classDiagram-v2-RAHNMMFH-Dcvhz2pb.js +1 -0
  46. package/dist/web/assets/clone--C7Tby8z.js +1 -0
  47. package/dist/web/assets/code-editor-Cr7JrBKC.js +8 -0
  48. package/dist/web/assets/{cose-bilkent-S5V4N54A-B_AWZsOP.js → cose-bilkent-S5V4N54A-MbmGZnt0.js} +1 -1
  49. package/dist/web/assets/{csv-preview-D2pJJj3K.js → csv-preview-uZ_7b8I7.js} +1 -1
  50. package/dist/web/assets/{dagre-DHq9bhnd.js → dagre-CPhI6v-K.js} +1 -1
  51. package/dist/web/assets/{dagre-KLK3FWXG-BdJr7Byp.js → dagre-KLK3FWXG-CmSE-oNj.js} +1 -1
  52. package/dist/web/assets/database-D1ToEV9d.js +1 -0
  53. package/dist/web/assets/{database-viewer-Camu01H4.js → database-viewer-5xljX0JI.js} +2 -2
  54. package/dist/web/assets/{diagram-E7M64L7V-_db4pBVA.js → diagram-E7M64L7V-B5XG3ZT7.js} +1 -1
  55. package/dist/web/assets/{diagram-IFDJBPK2-xKoeuiJx.js → diagram-IFDJBPK2-BsP248aX.js} +1 -1
  56. package/dist/web/assets/{diagram-P4PSJMXO-C8tjJsev.js → diagram-P4PSJMXO-Cna3408N.js} +1 -1
  57. package/dist/web/assets/diff-viewer-BBr6e_gb.js +4 -0
  58. package/dist/web/assets/dist-KUoHa6tg.js +1 -0
  59. package/dist/web/assets/{erDiagram-INFDFZHY-BSh2z9Df.js → erDiagram-INFDFZHY-B7SgktiR.js} +1 -1
  60. package/dist/web/assets/{extension-webview-pU1xJyoc.js → extension-webview-B0klBip8.js} +1 -1
  61. package/dist/web/assets/eye-CNcBU6Tx.js +1 -0
  62. package/dist/web/assets/{flowDiagram-PKNHOUZH-oYaovqyp.js → flowDiagram-PKNHOUZH-FOYZZ1OB.js} +1 -1
  63. package/dist/web/assets/{ganttDiagram-A5KZAMGK-DmL26q2P.js → ganttDiagram-A5KZAMGK-CnHVYh9v.js} +1 -1
  64. package/dist/web/assets/git-graph-CDiwGa0g.js +1 -0
  65. package/dist/web/assets/gitGraph-HDMCJU4V-DcPyMEIJ.js +1 -0
  66. package/dist/web/assets/{gitGraphDiagram-K3NZZRJ6-CMoukSrY.js → gitGraphDiagram-K3NZZRJ6-0G9XxZay.js} +1 -1
  67. package/dist/web/assets/{graphlib-BcsNnGcW.js → graphlib-CNiBwlg_.js} +1 -1
  68. package/dist/web/assets/index-CkaCzNgO.css +2 -0
  69. package/dist/web/assets/index-Ic5uTu20.js +26 -0
  70. package/dist/web/assets/info-3K5VOQVL-Dw4O15cw.js +1 -0
  71. package/dist/web/assets/infoDiagram-LFFYTUFH-DFhmsucr.js +2 -0
  72. package/dist/web/assets/input-CcbTF6ih.js +45 -0
  73. package/dist/web/assets/{isEmpty-bnrF3Qbc.js → isEmpty-CcCb5n2-.js} +1 -1
  74. package/dist/web/assets/{ishikawaDiagram-PHBUUO56-D05_LyL7.js → ishikawaDiagram-PHBUUO56-D4QCzh5J.js} +1 -1
  75. package/dist/web/assets/{journeyDiagram-4ABVD52K-B_L20qMe.js → journeyDiagram-4ABVD52K-CnHYNfKW.js} +1 -1
  76. package/dist/web/assets/{kanban-definition-K7BYSVSG-CZ535BbZ.js → kanban-definition-K7BYSVSG-Bh_g3EVu.js} +1 -1
  77. package/dist/web/assets/keybindings-store-CxE6BlG2.js +1 -0
  78. package/dist/web/assets/{line-CVvo3dRu.js → line-6d3eBADm.js} +1 -1
  79. package/dist/web/assets/{linear-DP4mkX3m.js → linear-cA_2lQy7.js} +1 -1
  80. package/dist/web/assets/markdown-renderer-CZ07F7T6.js +306 -0
  81. package/dist/web/assets/{mermaid-parser.core-C7UwoIh6.js → mermaid-parser.core-C3kd7JXM.js} +2 -2
  82. package/dist/web/assets/{mindmap-definition-YRQLILUH-x0MTutJp.js → mindmap-definition-YRQLILUH-CYiUwhr_.js} +1 -1
  83. package/dist/web/assets/{ordinal-_K3x1fkz.js → ordinal-XHK5vIzZ.js} +1 -1
  84. package/dist/web/assets/packet-RMMSAZCW-o3LmdL8H.js +1 -0
  85. package/dist/web/assets/pie-UPGHQEXC-BjNP0M3B.js +1 -0
  86. package/dist/web/assets/{pieDiagram-SKSYHLDU-C1Gjrtzy.js → pieDiagram-SKSYHLDU-D0S7jeZA.js} +1 -1
  87. package/dist/web/assets/plus-Iso5r9vD.js +1 -0
  88. package/dist/web/assets/port-forwarding-tab-BPuSc6pI.js +1 -0
  89. package/dist/web/assets/{postgres-viewer-BQdPMowm.js → postgres-viewer-RldlAO_m.js} +3 -3
  90. package/dist/web/assets/{quadrantDiagram-337W2JSQ-C8bzJCjQ.js → quadrantDiagram-337W2JSQ-0hNP63hW.js} +1 -1
  91. package/dist/web/assets/radar-KQ55EAFF-gDgOiaME.js +1 -0
  92. package/dist/web/assets/refresh-cw-BgQzFNaG.js +1 -0
  93. package/dist/web/assets/{requirementDiagram-Z7DCOOCP-pQyah6WB.js → requirementDiagram-Z7DCOOCP-BVnmqFbL.js} +1 -1
  94. package/dist/web/assets/{sankeyDiagram-WA2Y5GQK-T6RgG-N8.js → sankeyDiagram-WA2Y5GQK-DVkYdCJb.js} +1 -1
  95. package/dist/web/assets/scroll-area-i4EZlOl_.js +1 -0
  96. package/dist/web/assets/{sequenceDiagram-2WXFIKYE-BQDJ4CVs.js → sequenceDiagram-2WXFIKYE-B80s7sOg.js} +1 -1
  97. package/dist/web/assets/settings-tab-BzSSN2BQ.js +1 -0
  98. package/dist/web/assets/{sql-query-editor-CY61vWBg.js → sql-query-editor-CjZ7Z6XL.js} +1 -1
  99. package/dist/web/assets/sqlite-viewer-CoyZOM_Y.js +1 -0
  100. package/dist/web/assets/{stateDiagram-RAJIS63D-66vhiIuk.js → stateDiagram-RAJIS63D-BPLXgXRR.js} +1 -1
  101. package/dist/web/assets/stateDiagram-v2-FVOUBMTO-DksQJ7es.js +1 -0
  102. package/dist/web/assets/{terminal-tab-TIJmxHl6.js → terminal-tab-DjzD8GLn.js} +2 -2
  103. package/dist/web/assets/{timeline-definition-YZTLITO2-DwZqB3nn.js → timeline-definition-YZTLITO2-fa_51u1X.js} +1 -1
  104. package/dist/web/assets/trash-2-DYCa06CV.js +1 -0
  105. package/dist/web/assets/treemap-KZPCXAKY-DwFqAvnj.js +1 -0
  106. package/dist/web/assets/{use-monaco-theme-BHn-LEm7.js → use-monaco-theme-D9XFxQuU.js} +1 -1
  107. package/dist/web/assets/{vennDiagram-LZ73GAT5-s9Z71fz-.js → vennDiagram-LZ73GAT5-kX4jJn6W.js} +1 -1
  108. package/dist/web/assets/x-BXecj-16.js +1 -0
  109. package/dist/web/assets/{xychartDiagram-JWTSCODW-DRa_TH4B.js → xychartDiagram-JWTSCODW-Bzm5lZBs.js} +1 -1
  110. package/dist/web/index.html +22 -12
  111. package/dist/web/sw.js +1 -1
  112. package/package.json +9 -3
  113. package/src/server/index.ts +1 -1
  114. package/src/web/components/editor/code-editor.tsx +67 -4
  115. package/src/web/components/editor/save-as-dialog.tsx +75 -0
  116. package/src/web/components/layout/command-palette.tsx +2 -0
  117. package/src/web/components/layout/draggable-tab.tsx +120 -67
  118. package/src/web/components/layout/mobile-nav.tsx +69 -2
  119. package/src/web/components/layout/tab-bar.tsx +74 -1
  120. package/src/web/components/layout/upgrade-banner.tsx +3 -0
  121. package/src/web/components/shared/markdown-code-block.tsx +142 -0
  122. package/src/web/components/shared/markdown-context.ts +20 -0
  123. package/src/web/components/shared/markdown-renderer.tsx +113 -288
  124. package/src/web/hooks/use-global-keybindings.ts +7 -0
  125. package/src/web/main.tsx +1 -0
  126. package/src/web/stores/keybindings-store.ts +1 -0
  127. package/src/web/stores/panel-utils.ts +13 -0
  128. package/src/web/stores/tab-store.ts +16 -0
  129. package/src/web/styles/globals.css +6 -0
  130. package/.opencode/.env.example +0 -98
  131. package/.opencode/skills/ads-management/scripts/.env.example +0 -13
  132. package/.opencode/skills/ai-multimodal/.env.example +0 -230
  133. package/.opencode/skills/cip-design/.env.example +0 -6
  134. package/.opencode/skills/devops/.env.example +0 -76
  135. package/.opencode/skills/docs-seeker/.env.example +0 -15
  136. package/.opencode/skills/elevenlabs/.env.example +0 -3
  137. package/.opencode/skills/marketing-dashboard/.env.example +0 -15
  138. package/.opencode/skills/marketing-dashboard/app/.env.example +0 -2
  139. package/.opencode/skills/marketing-dashboard/server/.env.example +0 -2
  140. package/.opencode/skills/mcp-management/scripts/dist/analyze-tools.js +0 -70
  141. package/.opencode/skills/mcp-management/scripts/dist/cli.js +0 -160
  142. package/.opencode/skills/mcp-management/scripts/dist/mcp-client.js +0 -183
  143. package/.opencode/skills/payment-integration/scripts/.env.example +0 -20
  144. package/.opencode/skills/sequential-thinking/.env.example +0 -8
  145. package/dist/web/assets/architecture-PBZL5I3N-DEO2f3VD.js +0 -1
  146. package/dist/web/assets/channel-By7bn0Yq.js +0 -1
  147. package/dist/web/assets/chat-tab-CT2XUgsc.js +0 -10
  148. package/dist/web/assets/chunk-GLR3WWYH-DKikpoJM.js +0 -2
  149. package/dist/web/assets/chunk-HHEYEP7N-C7vxA5i9.js +0 -1
  150. package/dist/web/assets/chunk-QZHKN3VN-CYaTbeZf.js +0 -1
  151. package/dist/web/assets/classDiagram-VBA2DB6C-BA8Nj-_C.js +0 -1
  152. package/dist/web/assets/classDiagram-v2-RAHNMMFH-DjYu-6mn.js +0 -1
  153. package/dist/web/assets/clone-LRxlvnMj.js +0 -1
  154. package/dist/web/assets/code-editor-DQiPtcNd.js +0 -8
  155. package/dist/web/assets/diff-viewer-CTwcVIP_.js +0 -4
  156. package/dist/web/assets/dist-DIV6WgAG.js +0 -41
  157. package/dist/web/assets/git-graph-BnFbmpom.js +0 -1
  158. package/dist/web/assets/gitGraph-HDMCJU4V-Bwna3and.js +0 -1
  159. package/dist/web/assets/index-CP9KnaGh.js +0 -30
  160. package/dist/web/assets/index-Cxz7oGXY.css +0 -2
  161. package/dist/web/assets/info-3K5VOQVL-_vRxVNUm.js +0 -1
  162. package/dist/web/assets/infoDiagram-LFFYTUFH-DWwumDkq.js +0 -2
  163. package/dist/web/assets/keybindings-store-DdhEeehv.js +0 -1
  164. package/dist/web/assets/markdown-renderer-BjYurPV4.js +0 -326
  165. package/dist/web/assets/packet-RMMSAZCW-DY5PNnZU.js +0 -1
  166. package/dist/web/assets/pie-UPGHQEXC-BHncZutv.js +0 -1
  167. package/dist/web/assets/port-forwarding-tab-Bgr8dmsw.js +0 -1
  168. package/dist/web/assets/radar-KQ55EAFF-DH0AOkUy.js +0 -1
  169. package/dist/web/assets/settings-tab-BNoboN6E.js +0 -1
  170. package/dist/web/assets/sqlite-viewer-srSbGg1D.js +0 -1
  171. package/dist/web/assets/stateDiagram-v2-FVOUBMTO-BGVqj_g9.js +0 -1
  172. package/dist/web/assets/treemap-KZPCXAKY-B2Xkyv-K.js +0 -1
  173. package/dist/web/assets/x-D2_KzIET.js +0 -1
  174. /package/dist/web/assets/{api-client-BfBM3I7n.js → api-client-wQbeUyeh.js} +0 -0
  175. /package/dist/web/assets/{array-B9UHiPd-.js → array-X0JlPOfd.js} +0 -0
  176. /package/dist/web/assets/{arrow-up-BYhx9ckd.js → arrow-up-BigIMx-e.js} +0 -0
  177. /package/dist/web/assets/{chevron-right-4zq1jPv6.js → chevron-right-CXzzT44u.js} +0 -0
  178. /package/dist/web/assets/{columns-2-BoZAN-iw.js → columns-2-BZ9uqssV.js} +0 -0
  179. /package/dist/web/assets/{csv-parser-CNNw2RVA.js → csv-parser-CElqio6o.js} +0 -0
  180. /package/dist/web/assets/{cytoscape.esm-BW-DbntU.js → cytoscape.esm-BfIOPvwt.js} +0 -0
  181. /package/dist/web/assets/{defaultLocale-5eAKkKJC.js → defaultLocale-B6RGN4id.js} +0 -0
  182. /package/dist/web/assets/{dist-CSJdAyA9.js → dist-CK1enexV.js} +0 -0
  183. /package/dist/web/assets/{init-DlZdxViB.js → init-BmUWJJHz.js} +0 -0
  184. /package/dist/web/assets/{isArrayLikeObject-B_v2FtYn.js → isArrayLikeObject-BrCM-iA1.js} +0 -0
  185. /package/dist/web/assets/{jsx-runtime-kMwlnEGE.js → jsx-runtime-R_NjdZtX.js} +0 -0
  186. /package/dist/web/assets/{katex-Bqvo_ZG0.js → katex-xQS_6bNb.js} +0 -0
  187. /package/dist/web/assets/{lib-DurwGtQO.js → lib-CfWBrYll.js} +0 -0
  188. /package/dist/web/assets/{math-069Z4SuC.js → math-CpLFzrfV.js} +0 -0
  189. /package/dist/web/assets/{path-6uRLdFF7.js → path-CoPyR7c2.js} +0 -0
  190. /package/dist/web/assets/{preload-helper-Bf_JiD2A.js → preload-helper-CH6UZRzu.js} +0 -0
  191. /package/dist/web/assets/{react-SKk5z-bm.js → react-j5zqhEum.js} +0 -0
  192. /package/dist/web/assets/{rough.esm-JX0wREDd.js → rough.esm-D5NinLFK.js} +0 -0
  193. /package/dist/web/assets/{sql-completion-provider-DM9Qov6L.js → sql-completion-provider-D0xutVaK.js} +0 -0
  194. /package/dist/web/assets/{square-oPKIkJiw.js → square-pfn_LYYy.js} +0 -0
  195. /package/dist/web/assets/{src-BqX54PbV.js → src-j04igtQ5.js} +0 -0
  196. /package/dist/web/assets/{table-DFevCOMd.js → table-CHv2x_qg.js} +0 -0
  197. /package/dist/web/assets/{tag-CXMT0QB6.js → tag-Bb_UFXt0.js} +0 -0
  198. /package/dist/web/assets/{text-wrap-BWNOVswA.js → text-wrap-D8BbQYTx.js} +0 -0
  199. /package/dist/web/assets/{utils-BNytJOb1.js → utils-CSCvNZxE.js} +0 -0
@@ -1,6 +1,11 @@
1
- import { useMemo, useRef, useEffect } from "react";
2
- import { marked } from "marked";
3
- import markedKatex from "marked-katex-extension";
1
+ import { useMemo, useCallback, useState, useEffect } from "react";
2
+ import ReactMarkdown from "react-markdown";
3
+ import remarkGfm from "remark-gfm";
4
+ import remarkMath from "remark-math";
5
+ import remarkBreaks from "remark-breaks";
6
+ import rehypeRaw from "rehype-raw";
7
+ import rehypeKatex from "rehype-katex";
8
+ import rehypeHighlight from "rehype-highlight";
4
9
  import { useTabStore } from "@/stores/tab-store";
5
10
  import { useFileStore, type FileNode } from "@/stores/file-store";
6
11
  import { useImageOverlay } from "@/stores/image-overlay-store";
@@ -8,35 +13,8 @@ import { useDiagramOverlay } from "@/stores/diagram-overlay-store";
8
13
  import { openCommandPalette } from "@/hooks/use-global-keybindings";
9
14
  import { api, projectUrl, getAuthToken } from "@/lib/api-client";
10
15
  import { basename } from "@/lib/utils";
11
- import mermaid from "mermaid";
12
-
13
- /** Mermaid keywords that start a diagram definition */
14
- const MERMAID_KEYWORDS = /^(sequenceDiagram|flowchart|graph\s|classDiagram|stateDiagram|erDiagram|journey|gantt|pie|quadrantChart|requirementDiagram|gitGraph|mindmap|timeline|sankey|xychart|block-beta|packet-beta|architecture-beta|kanban)\b/;
15
-
16
- let mermaidInitialized = false;
17
- function ensureMermaidInit() {
18
- if (mermaidInitialized) return;
19
- mermaid.initialize({
20
- startOnLoad: false,
21
- theme: "default",
22
- securityLevel: "loose",
23
- fontFamily: "ui-sans-serif, system-ui, sans-serif",
24
- });
25
- mermaidInitialized = true;
26
- }
27
-
28
- /** Detect local absolute file paths (Unix or Windows) */
29
- const LOCAL_PATH_RE = /^(\/|[A-Za-z]:[/\\])/;
30
-
31
- // Configure marked globally
32
- marked.use({ gfm: true, breaks: true });
33
- marked.use(markedKatex({ throwOnError: false }));
34
-
35
- /** Common text file extensions that PPM can open as editor tabs */
36
- const FILE_EXTS = "ts|tsx|js|jsx|mjs|cjs|py|json|md|mdx|yaml|yml|toml|css|scss|less|html|htm|sh|bash|zsh|go|rs|sql|rb|java|kt|swift|c|cpp|h|hpp|cs|vue|svelte|txt|env|cfg|conf|ini|xml|csv|log|dockerfile|makefile|gradle";
37
- const FILE_EXT_RE = new RegExp(`\\.(${FILE_EXTS})$`, "i");
38
- /** Glob/regex chars that indicate a pattern, not a real file */
39
- const GLOB_CHARS_RE = /[*?{}\[\]]/;
16
+ import { MdContext, useMdContext, FILE_EXT_RE, GLOB_CHARS_RE, LOCAL_PATH_RE } from "./markdown-context";
17
+ import { MdPre, MdCode } from "./markdown-code-block";
40
18
 
41
19
  interface MarkdownRendererProps {
42
20
  content: string;
@@ -46,286 +24,133 @@ interface MarkdownRendererProps {
46
24
  isStreaming?: boolean;
47
25
  }
48
26
 
49
- /**
50
- * Transform HTML string:
51
- * - Wrap tables in scrollable container
52
- * - Add target=_blank to external links
53
- * - Mark <a> file paths with data-file-path
54
- * - Make inline <code> with file names clickable (via HTML transform, not DOM)
55
- */
56
- function transformHtml(raw: string): string {
57
- let html = raw;
27
+ /** Plugin arrays — stable references to avoid re-creating on each render */
28
+ const remarkPlugins = [remarkGfm, remarkMath, remarkBreaks] as any;
29
+ const rehypePlugins = [rehypeRaw, rehypeKatex, rehypeHighlight] as any;
58
30
 
59
- // Wrap <table> in scroll container
60
- html = html.replace(/<table/g, '<div class="table-scroll-wrapper overflow-x-auto"><table');
61
- html = html.replace(/<\/table>/g, "</table></div>");
31
+ /** Component map stable references; dynamic state flows through MdContext */
32
+ const mdComponents = { a: MdLink, img: MdImage, pre: MdPre, code: MdCode, table: MdTable };
62
33
 
63
- // External links target=_blank
64
- html = html.replace(
65
- /<a\s+href="(https?:\/\/[^"]+)"/g,
66
- '<a href="$1" target="_blank" rel="noopener noreferrer"',
67
- );
68
-
69
- // <a> with file paths → add data-file-path (only files, not folders or glob patterns)
70
- html = html.replace(/<a\s+href="([^"]+)"/g, (match, href: string) => {
71
- if (/^https?:\/\//.test(href)) return match; // already handled
72
- if (GLOB_CHARS_RE.test(href)) return match; // skip glob/regex patterns
73
- if (!FILE_EXT_RE.test(href)) return match; // must have a file extension
74
- return `<a href="${href}" data-file-path="${href}"`;
75
- });
76
-
77
- // Inline <code> with file-like names → make clickable
78
- // Split by <pre>...</pre> blocks to avoid transforming code inside them
79
- const parts = html.split(/(<pre[\s\S]*?<\/pre>)/g);
80
- html = parts.map((part) => {
81
- // Skip <pre> blocks
82
- if (part.startsWith("<pre")) return part;
83
- // Transform inline <code> in non-pre content
84
- return part.replace(
85
- /<code>([^<]+)<\/code>/g,
86
- (match, text: string) => {
87
- const trimmed = text.trim();
88
- if (!trimmed || trimmed.includes(" ")) return match;
89
- if (GLOB_CHARS_RE.test(trimmed)) return match; // skip glob/regex patterns
90
- if (!FILE_EXT_RE.test(trimmed)) return match; // must have a file extension
91
- return `<code data-file-clickable="${trimmed}" style="cursor:pointer;text-decoration:underline;text-decoration-style:dotted">${text}</code>`;
92
- },
93
- );
94
- }).join("");
95
-
96
- return html;
34
+ function findInTree(nodes: FileNode[], name: string): string[] {
35
+ const results: string[] = [];
36
+ for (const n of nodes) {
37
+ if (n.type === "file" && n.name === name) results.push(n.path);
38
+ if (n.children) results.push(...findInTree(n.children, name));
39
+ }
40
+ return results;
97
41
  }
98
42
 
99
43
  export function MarkdownRenderer({ content, projectName, className = "", codeActions = false, isStreaming = false }: MarkdownRendererProps) {
100
- const html = useMemo(() => {
101
- try {
102
- const raw = marked.parse(content) as string;
103
- return transformHtml(raw);
104
- } catch {
105
- return content;
106
- }
107
- }, [content]);
108
-
109
- const containerRef = useRef<HTMLDivElement>(null);
110
44
  const openTab = useTabStore((s) => s.openTab);
111
45
  const fileTree = useFileStore((s) => s.tree);
112
- const openImageOverlay = useImageOverlay((s) => s.open);
113
- const openDiagramOverlay = useDiagramOverlay((s) => s.open);
46
+ const openImageOverlayFn = useImageOverlay((s) => s.open);
47
+ const openDiagramOverlayFn = useDiagramOverlay((s) => s.open);
114
48
 
115
- useEffect(() => {
116
- const container = containerRef.current;
117
- if (!container) return;
118
-
119
- // --- Render mermaid diagrams ---
120
- const renderMermaid = async () => {
121
- ensureMermaidInit();
122
- const pres = container.querySelectorAll("pre");
123
- for (const pre of pres) {
124
- const code = pre.querySelector("code");
125
- if (!code) continue;
126
- const langClass = code.className ?? "";
127
- const text = (code.textContent ?? "").trim();
128
- const isMermaid = langClass.includes("language-mermaid") || MERMAID_KEYWORDS.test(text);
129
- if (!isMermaid) continue;
130
-
131
- try {
132
- const id = `mermaid-${Math.random().toString(36).slice(2, 9)}`;
133
- const { svg } = await mermaid.render(id, text);
134
- const wrapper = document.createElement("div");
135
- wrapper.className = "mermaid-diagram group relative cursor-pointer rounded-lg border border-border bg-white dark:bg-zinc-50 p-3 overflow-x-auto my-2";
136
- wrapper.innerHTML = svg;
137
- // Expand icon hint
138
- const hint = document.createElement("div");
139
- hint.className = "absolute top-2 right-2 flex items-center gap-1 px-2 py-1 rounded bg-black/60 text-white text-xs can-hover:opacity-0 can-hover:group-hover:opacity-100 transition-opacity pointer-events-none";
140
- hint.textContent = "Click to expand";
141
- wrapper.appendChild(hint);
142
- // Click to open overlay
143
- wrapper.addEventListener("click", () => openDiagramOverlay(svg));
144
- pre.replaceWith(wrapper);
145
- } catch {
146
- // Render failed — leave as code block
147
- }
148
- }
149
- };
150
- renderMermaid();
151
-
152
- // --- Click handler for file links and clickable code ---
153
- const handleClick = (e: MouseEvent) => {
154
- const target = e.target as HTMLElement;
49
+ const openFileOrSearch = useCallback((filePath: string) => {
50
+ if (!filePath) return;
51
+ const isAbsolute = /^(\/|[A-Za-z]:[/\\])/.test(filePath);
52
+ const isRelative = /^(\.\/|\.\.\/)/.test(filePath);
53
+ const fileName = basename(filePath);
155
54
 
156
- // Check <a data-file-path>
157
- const link = target.closest("a[data-file-path]") as HTMLAnchorElement | null;
158
- if (link && container.contains(link)) {
159
- e.preventDefault();
160
- openFileOrSearch(link.getAttribute("data-file-path") ?? "");
161
- return;
162
- }
163
-
164
- // Check clickable <code>
165
- const code = target.closest("code[data-file-clickable]") as HTMLElement | null;
166
- if (code && container.contains(code)) {
167
- openFileOrSearch(code.getAttribute("data-file-clickable") ?? "");
168
- return;
55
+ const searchAndOpen = (fp: string) => {
56
+ const matches = findInTree(fileTree, basename(fp));
57
+ if (matches.length === 1) {
58
+ openTab({ type: "editor", title: basename(fp), metadata: { filePath: matches[0], projectName }, projectId: projectName ?? null, closable: true });
59
+ } else {
60
+ openCommandPalette(fp);
169
61
  }
170
62
  };
171
63
 
172
- /** Search file tree for matches by filename */
173
- function findInTree(nodes: FileNode[], name: string): string[] {
174
- const results: string[] = [];
175
- for (const node of nodes) {
176
- if (node.type === "file" && node.name === name) results.push(node.path);
177
- if (node.children) results.push(...findInTree(node.children, name));
178
- }
179
- return results;
180
- }
181
-
182
- function openFileOrSearch(filePath: string) {
183
- if (!filePath) return;
184
- const isAbsolute = /^(\/|[A-Za-z]:[/\\])/.test(filePath);
185
- const isRelative = /^(\.\/|\.\.\/)/.test(filePath);
186
- const fileName = basename(filePath);
187
-
188
- // Absolute path → verify then open
189
- if (isAbsolute) {
190
- const meta: Record<string, unknown> = { filePath };
191
- if (projectName) meta.projectName = projectName;
192
- api.get(`/api/fs/read?path=${encodeURIComponent(filePath)}`).then(() => {
193
- openTab({ type: "editor", title: fileName, metadata: meta, projectId: null, closable: true });
194
- }).catch(() => openCommandPalette(filePath));
195
- return;
196
- }
197
-
198
- // Relative path with ./ or ../ → try exact path in project
199
- if (isRelative && projectName) {
200
- const meta: Record<string, unknown> = { filePath, projectName };
201
- api.get(`${projectUrl(projectName)}/files/read?path=${encodeURIComponent(filePath)}`)
202
- .then(() => {
203
- openTab({ type: "editor", title: fileName, metadata: meta, projectId: projectName, closable: true });
204
- })
205
- .catch(() => searchAndOpen(filePath));
206
- return;
207
- }
208
-
209
- // Just a filename → search in project tree
210
- searchAndOpen(filePath);
64
+ if (isAbsolute) {
65
+ const meta: Record<string, unknown> = { filePath };
66
+ if (projectName) meta.projectName = projectName;
67
+ api.get(`/api/fs/read?path=${encodeURIComponent(filePath)}`).then(() => {
68
+ openTab({ type: "editor", title: fileName, metadata: meta, projectId: null, closable: true });
69
+ }).catch(() => openCommandPalette(filePath));
70
+ return;
211
71
  }
212
72
 
213
- /** Search project file tree; if 1 match open directly, else → command palette with full path */
214
- function searchAndOpen(filePath: string) {
215
- const fileName = basename(filePath);
216
- const matches = findInTree(fileTree, fileName);
217
- if (matches.length === 1) {
218
- const match = matches[0]!;
219
- openTab({
220
- type: "editor",
221
- title: fileName,
222
- metadata: { filePath: match, projectName },
223
- projectId: projectName ?? null,
224
- closable: true,
225
- });
226
- } else {
227
- openCommandPalette(filePath);
228
- }
73
+ if (isRelative && projectName) {
74
+ api.get(`${projectUrl(projectName)}/files/read?path=${encodeURIComponent(filePath)}`)
75
+ .then(() => openTab({ type: "editor", title: fileName, metadata: { filePath, projectName }, projectId: projectName, closable: true }))
76
+ .catch(() => searchAndOpen(filePath));
77
+ return;
229
78
  }
230
79
 
231
- container.addEventListener("click", handleClick);
232
-
233
- // --- Auth-load images with local file paths ---
234
- const blobUrls: string[] = [];
235
- container.querySelectorAll("img").forEach((img) => {
236
- const src = img.getAttribute("src") ?? "";
237
- // Only intercept local file paths, not http/data/blob URLs
238
- if (!LOCAL_PATH_RE.test(src)) return;
239
- // Mark as loading
240
- img.style.opacity = "0.3";
241
- img.style.minHeight = "48px";
242
- img.style.minWidth = "48px";
243
- const token = getAuthToken();
244
- fetch(`/api/fs/raw?path=${encodeURIComponent(src)}`, {
245
- headers: token ? { Authorization: `Bearer ${token}` } : {},
246
- })
247
- .then((r) => {
248
- if (!r.ok) throw new Error("Failed to load");
249
- return r.blob();
250
- })
251
- .then((blob) => {
252
- const url = URL.createObjectURL(blob);
253
- blobUrls.push(url);
254
- img.src = url;
255
- img.style.opacity = "";
256
- img.style.minHeight = "";
257
- img.style.minWidth = "";
258
- // Style: constrain size, add border like AuthImage
259
- img.style.maxHeight = "400px";
260
- img.style.maxWidth = "100%";
261
- img.style.objectFit = "contain";
262
- img.style.borderRadius = "0.375rem";
263
- img.style.border = "1px solid var(--color-border)";
264
- img.style.cursor = "pointer";
265
- img.onclick = () => openImageOverlay(url, img.alt || basename(src));
266
- })
267
- .catch(() => {
268
- img.style.opacity = "0.5";
269
- img.alt = `[Image not found: ${basename(src)}]`;
270
- });
271
- });
80
+ searchAndOpen(filePath);
81
+ }, [openTab, fileTree, projectName]);
272
82
 
273
- // --- Code block copy/run buttons ---
274
- if (codeActions) {
275
- container.querySelectorAll("pre").forEach((pre) => {
276
- if (pre.querySelector(".code-actions")) return;
277
- const code = pre.querySelector("code");
278
- const text = code?.textContent ?? pre.textContent ?? "";
279
- const langClass = code?.className ?? "";
280
- const isBash = /language-(bash|sh|shell|zsh)/.test(langClass)
281
- || (!langClass.includes("language-") && text.startsWith("$"));
83
+ const ctx = useMemo(() => ({
84
+ projectName, codeActions, openFileOrSearch,
85
+ openImageOverlay: openImageOverlayFn,
86
+ openDiagramOverlay: openDiagramOverlayFn,
87
+ }), [projectName, codeActions, openFileOrSearch, openImageOverlayFn, openDiagramOverlayFn]);
282
88
 
283
- pre.style.position = "relative";
284
- pre.classList.add("group");
285
-
286
- const actions = document.createElement("div");
287
- actions.className = "code-actions absolute top-1 right-1 flex gap-1";
89
+ return (
90
+ <MdContext.Provider value={ctx}>
91
+ <div className={`markdown-content prose-sm ${isStreaming ? "is-streaming" : ""} ${className}`}>
92
+ <ReactMarkdown remarkPlugins={remarkPlugins} rehypePlugins={rehypePlugins} components={mdComponents}>
93
+ {content}
94
+ </ReactMarkdown>
95
+ </div>
96
+ </MdContext.Provider>
97
+ );
98
+ }
288
99
 
289
- const copyBtn = document.createElement("button");
290
- copyBtn.className = "flex items-center justify-center size-6 rounded bg-surface-elevated/80 hover:bg-surface-elevated text-text-secondary hover:text-text-primary transition-colors border border-border/50";
291
- copyBtn.title = "Copy";
292
- copyBtn.innerHTML = `<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`;
293
- copyBtn.addEventListener("click", () => {
294
- navigator.clipboard.writeText(text);
295
- copyBtn.innerHTML = `<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>`;
296
- setTimeout(() => {
297
- copyBtn.innerHTML = `<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`;
298
- }, 2000);
299
- });
300
- actions.appendChild(copyBtn);
100
+ /** Link external links open in new tab; file paths open in editor */
101
+ function MdLink({ href, children, node, ...props }: any) {
102
+ const { openFileOrSearch } = useMdContext();
103
+ if (href?.match(/^https?:\/\//)) {
104
+ return <a href={href} target="_blank" rel="noopener noreferrer" {...props}>{children}</a>;
105
+ }
106
+ if (href && !GLOB_CHARS_RE.test(href) && FILE_EXT_RE.test(href)) {
107
+ return <a href={href} onClick={(e: React.MouseEvent) => { e.preventDefault(); openFileOrSearch(href); }} {...props}>{children}</a>;
108
+ }
109
+ return <a href={href} {...props}>{children}</a>;
110
+ }
301
111
 
302
- if (isBash && projectName) {
303
- const runBtn = document.createElement("button");
304
- runBtn.className = "flex items-center justify-center size-6 rounded bg-surface-elevated/80 hover:bg-surface-elevated text-text-secondary hover:text-text-primary transition-colors border border-border/50";
305
- runBtn.title = "Run in terminal";
306
- runBtn.innerHTML = `<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg>`;
307
- runBtn.addEventListener("click", () => {
308
- navigator.clipboard.writeText(text.replace(/^\$\s*/gm, ""));
309
- openTab({ type: "terminal", title: "Terminal", metadata: { projectName }, projectId: projectName, closable: true });
310
- });
311
- actions.appendChild(runBtn);
312
- }
112
+ /** Image auth-loads local file paths via API, click to open overlay */
113
+ function MdImage({ src, alt, node, ...props }: any) {
114
+ const { openImageOverlay } = useMdContext();
115
+ const [blobUrl, setBlobUrl] = useState<string | null>(null);
116
+ const [loading, setLoading] = useState(false);
313
117
 
314
- pre.appendChild(actions);
315
- });
316
- }
118
+ useEffect(() => {
119
+ if (!src || !LOCAL_PATH_RE.test(src)) return;
120
+ setLoading(true);
121
+ let cancelled = false;
122
+ let url: string | null = null;
123
+ const token = getAuthToken();
124
+ fetch(`/api/fs/raw?path=${encodeURIComponent(src)}`, {
125
+ headers: token ? { Authorization: `Bearer ${token}` } : {},
126
+ })
127
+ .then((r) => { if (!r.ok) throw new Error(); return r.blob(); })
128
+ .then((blob) => {
129
+ if (cancelled) return;
130
+ url = URL.createObjectURL(blob);
131
+ setBlobUrl(url);
132
+ setLoading(false);
133
+ })
134
+ .catch(() => { if (!cancelled) setLoading(false); });
135
+ return () => { cancelled = true; if (url) URL.revokeObjectURL(url); };
136
+ }, [src]);
317
137
 
318
- return () => {
319
- container.removeEventListener("click", handleClick);
320
- blobUrls.forEach((u) => URL.revokeObjectURL(u));
321
- };
322
- }, [html, projectName, openTab, codeActions, openImageOverlay, openDiagramOverlay]);
138
+ const displaySrc = blobUrl || src || "";
139
+ const name = alt || (src ? basename(src) : "");
323
140
 
324
141
  return (
325
- <div
326
- ref={containerRef}
327
- className={`markdown-content prose-sm ${isStreaming ? "is-streaming" : ""} ${className}`}
328
- dangerouslySetInnerHTML={{ __html: html }}
142
+ <img
143
+ src={displaySrc}
144
+ alt={name}
145
+ onClick={() => displaySrc && openImageOverlay(displaySrc, name)}
146
+ className="max-h-[400px] max-w-full object-contain rounded-md border border-border cursor-pointer"
147
+ style={{ opacity: loading ? 0.3 : 1, minHeight: loading ? 48 : undefined, minWidth: loading ? 48 : undefined }}
148
+ {...props}
329
149
  />
330
150
  );
331
151
  }
152
+
153
+ /** Table — wrap in scrollable container */
154
+ function MdTable({ children, node, ...props }: any) {
155
+ return <div className="table-scroll-wrapper overflow-x-auto"><table {...props}>{children}</table></div>;
156
+ }
@@ -101,6 +101,13 @@ export function useGlobalKeybindings() {
101
101
  return;
102
102
  }
103
103
 
104
+ // New file
105
+ if (match(e, "new-file")) {
106
+ e.preventDefault();
107
+ useTabStore.getState().openNewFile();
108
+ return;
109
+ }
110
+
104
111
  // Open tab shortcuts
105
112
  const tabShortcuts: { action: string; type: string; title: string }[] = [
106
113
  { action: "open-chat", type: "chat", title: "AI Chat" },
package/src/web/main.tsx CHANGED
@@ -3,6 +3,7 @@ import { createRoot } from "react-dom/client";
3
3
  import { App } from "./app.tsx";
4
4
  import "./styles/globals.css";
5
5
  import "katex/dist/katex.min.css";
6
+ import "highlight.js/styles/github-dark-dimmed.min.css";
6
7
 
7
8
  createRoot(document.getElementById("root")!).render(
8
9
  <StrictMode>
@@ -30,6 +30,7 @@ export const KEY_ACTIONS: KeyAction[] = [
30
30
  // Tabs
31
31
  { id: "next-tab", label: "Next Tab", category: "tabs", defaultKey: "Alt+]" },
32
32
  { id: "prev-tab", label: "Previous Tab", category: "tabs", defaultKey: "Alt+[" },
33
+ { id: "new-file", label: "New File", category: "tabs", defaultKey: "Mod+N" },
33
34
  { id: "open-chat", label: "Open Chat", category: "tabs", defaultKey: "Mod+L" },
34
35
  { id: "open-terminal", label: "Open Terminal", category: "tabs", defaultKey: "Mod+'" },
35
36
  { id: "open-settings", label: "Open Settings", category: "tabs", defaultKey: "Mod+," },
@@ -73,10 +73,23 @@ export function findPanelPosition(grid: string[][], panelId: string): { row: num
73
73
  // Deterministic tab IDs
74
74
  // ---------------------------------------------------------------------------
75
75
 
76
+ /** Get next untitled number by scanning all panels */
77
+ export function getNextUntitledNumber(panels: Record<string, Panel>): number {
78
+ let max = 0;
79
+ for (const panel of Object.values(panels)) {
80
+ for (const tab of panel.tabs) {
81
+ const match = tab.id.match(/^editor:untitled-(\d+)$/);
82
+ if (match) max = Math.max(max, Number(match[1]));
83
+ }
84
+ }
85
+ return max + 1;
86
+ }
87
+
76
88
  /** Derive deterministic tab ID from type + metadata */
77
89
  export function deriveTabId(type: TabType, metadata?: Record<string, unknown>): string {
78
90
  switch (type) {
79
91
  case "editor":
92
+ if (metadata?.isUntitled) return `editor:untitled-${metadata.untitledNumber ?? 1}`;
80
93
  return `editor:${metadata?.filePath ?? "untitled"}`;
81
94
  case "chat": {
82
95
  const provider = metadata?.providerId ?? "default";
@@ -1,5 +1,6 @@
1
1
  import { create } from "zustand";
2
2
  import { usePanelStore } from "./panel-store";
3
+ import { getNextUntitledNumber } from "./panel-utils";
3
4
 
4
5
  export type TabType =
5
6
  | "terminal"
@@ -38,6 +39,7 @@ interface TabStore {
38
39
  closeTab: (id: string) => void;
39
40
  setActiveTab: (id: string) => void;
40
41
  updateTab: (id: string, updates: Partial<Omit<Tab, "id">>) => void;
42
+ openNewFile: () => string;
41
43
  }
42
44
 
43
45
  export const useTabStore = create<TabStore>()(() => ({
@@ -71,6 +73,20 @@ export const useTabStore = create<TabStore>()(() => ({
71
73
  usePanelStore.getState().updateTab(id, updates);
72
74
  syncFromPanelStore();
73
75
  },
76
+
77
+ openNewFile: () => {
78
+ const ps = usePanelStore.getState();
79
+ const num = getNextUntitledNumber(ps.panels);
80
+ const id = ps.openTab({
81
+ type: "editor",
82
+ title: `Untitled-${num}`,
83
+ projectId: null,
84
+ metadata: { isUntitled: true, untitledNumber: num },
85
+ closable: true,
86
+ });
87
+ syncFromPanelStore();
88
+ return id;
89
+ },
74
90
  }));
75
91
 
76
92
  // ---------------------------------------------------------------------------
@@ -186,6 +186,12 @@ html, body {
186
186
  font-size: 0.75rem;
187
187
  }
188
188
 
189
+ /* Override highlight.js background so pre's background takes precedence */
190
+ .markdown-content pre code.hljs {
191
+ background: transparent;
192
+ padding: 0;
193
+ }
194
+
189
195
  .markdown-content :not(pre) > code {
190
196
  background: var(--color-background);
191
197
  padding: 0.125rem 0.25rem;
@@ -1,98 +0,0 @@
1
- # Claude Code - Global Environment Variables
2
- # Location: .claude/.env
3
- # Priority: LOWEST (overridden by skills/.env and skill-specific .env)
4
- # Scope: Project-wide configuration, global defaults
5
- # Setup: Copy to .claude/.env and configure
6
-
7
- # ============================================
8
- # Environment Variable Hierarchy
9
- # ============================================
10
- # Priority order (highest to lowest):
11
- # 1. process.env - Runtime environment (HIGHEST)
12
- # 2. .claude/skills/<skill>/.env - Skill-specific overrides
13
- # 3. .claude/skills/.env - Shared across all skills
14
- # 4. .claude/.env - Global defaults (this file, LOWEST)
15
- #
16
- # All skills use centralized resolver: ~/.claude/scripts/resolve_env.py
17
- # Debug hierarchy: python ~/.claude/scripts/resolve_env.py --show-hierarchy
18
-
19
- # ============================================
20
- # ClaudeKit API Key (for VidCap, ReviewWeb services)
21
- # ============================================
22
- # Get your API key from https://claudekit.cc/api-keys
23
- # Required for accessing ClaudeKit services via skills
24
- CLAUDEKIT_API_KEY=
25
-
26
- # ============================================
27
- # Claude Code Notification Hooks
28
- # ============================================
29
- # Discord Webhook URL (for Discord notifications)
30
- # Get from: Server Settings → Integrations → Webhooks → New Webhook
31
- DISCORD_WEBHOOK_URL=
32
-
33
- # Telegram Bot Token (for Telegram notifications)
34
- # Get from: @BotFather in Telegram
35
- TELEGRAM_BOT_TOKEN=
36
-
37
- # Telegram Chat ID (your chat ID or group ID)
38
- # Get from: https://api.telegram.org/bot<BOT_TOKEN>/getUpdates
39
- TELEGRAM_CHAT_ID=
40
-
41
- # ============================================
42
- # AI/ML API Keys (Global Defaults)
43
- # ============================================
44
- # Google Gemini API (for ai-multimodal, docs-seeker skills)
45
- # Get from: https://aistudio.google.com/apikey
46
- GEMINI_API_KEY=
47
-
48
- # Vertex AI Configuration (Optional alternative to AI Studio)
49
- # GEMINI_USE_VERTEX=true
50
- # VERTEX_PROJECT_ID=
51
- # VERTEX_LOCATION=us-central1
52
-
53
- # OpenAI API Key (if using OpenAI-based skills)
54
- # OPENAI_API_KEY=
55
-
56
- # Anthropic API Key (if using Claude API directly)
57
- # ANTHROPIC_API_KEY=
58
-
59
- # ElevenLabs API Key
60
- # Get your key at: https://elevenlabs.io/app/settings/api-keys
61
- # ELEVENLABS_API_KEY=
62
-
63
- # ============================================
64
- # Development & CI/CD
65
- # ============================================
66
- # NODE_ENV=development
67
- # DEBUG=false
68
- # LOG_LEVEL=info
69
-
70
- # ============================================
71
- # Project Configuration
72
- # ============================================
73
- # PROJECT_NAME=claudekit-engineer
74
- # ENVIRONMENT=local
75
-
76
- # ============================================
77
- # Example Usage Scenarios
78
- # ============================================
79
- # Scenario 1: Global default for all skills
80
- # .claude/.env (this file): GEMINI_API_KEY=global-dev-key
81
- # Result: All skills use global-dev-key
82
- #
83
- # Scenario 2: Override for all skills
84
- # .claude/.env (this file): GEMINI_API_KEY=global-dev-key
85
- # .claude/skills/.env: GEMINI_API_KEY=skills-prod-key
86
- # Result: All skills use skills-prod-key
87
- #
88
- # Scenario 3: Skill-specific override
89
- # .claude/.env (this file): GEMINI_API_KEY=global-key
90
- # .claude/skills/.env: GEMINI_API_KEY=shared-key
91
- # .claude/skills/ai-multimodal/.env: GEMINI_API_KEY=high-quota-key
92
- # Result: ai-multimodal uses high-quota-key, other skills use shared-key
93
- #
94
- # Scenario 4: Runtime testing
95
- # export GEMINI_API_KEY=test-key
96
- # Result: All skills use test-key regardless of config files
97
- #
98
- # Priority: runtime > skill-specific > shared > global (this file)