wiki-viewer 1.14.1 → 2.0.0

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 (559) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  4. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  5. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  12. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  13. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  14. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  16. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  19. package/.next/standalone/.next/server/app/api/agent/activity/route.js +6 -6
  20. package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js +8 -8
  22. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js +9 -9
  24. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js +8 -8
  26. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js +8 -8
  28. package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js +8 -8
  30. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js +9 -9
  32. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/agent/internal/span/route.js +8 -8
  34. package/.next/standalone/.next/server/app/api/agent/internal/span/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/agent/settings/route.js +7 -7
  36. package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js +6 -6
  38. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/assets/[...path]/route.js +5 -5
  41. package/.next/standalone/.next/server/app/api/assets/[...path]/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/share/[token]/route.js +6 -5
  43. package/.next/standalone/.next/server/app/api/share/[token]/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/share/route.js +4 -4
  45. package/.next/standalone/.next/server/app/api/share/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/api/system/browse/route.js.nft.json +1 -1
  47. package/.next/standalone/.next/server/app/api/system/clear-root/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/system/reveal/route.js +6 -6
  49. package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/api/system/root-status/route.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/api/system/set-root/route.js +6 -5
  52. package/.next/standalone/.next/server/app/api/system/set-root/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js +5 -4
  54. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js +6 -5
  56. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js +5 -4
  58. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/api/system/workspaces/route.js +7 -6
  60. package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -1
  61. package/.next/standalone/.next/server/app/api/upload/[...path]/route.js +5 -5
  62. package/.next/standalone/.next/server/app/api/upload/[...path]/route.js.nft.json +1 -1
  63. package/.next/standalone/.next/server/app/api/wiki/app/route.js +7 -7
  64. package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
  65. package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js +7 -7
  66. package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js.nft.json +1 -1
  67. package/.next/standalone/.next/server/app/api/wiki/content/route.js +7 -7
  68. package/.next/standalone/.next/server/app/api/wiki/content/route.js.nft.json +1 -1
  69. package/.next/standalone/.next/server/app/api/wiki/download/route.js +6 -6
  70. package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
  71. package/.next/standalone/.next/server/app/api/wiki/file/route.js +5 -5
  72. package/.next/standalone/.next/server/app/api/wiki/file/route.js.nft.json +1 -1
  73. package/.next/standalone/.next/server/app/api/wiki/folder/route.js +5 -5
  74. package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
  75. package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js +4 -4
  76. package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js +6 -6
  78. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js +4 -4
  80. package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js.nft.json +1 -1
  81. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js +4 -4
  82. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/api/wiki/git-history/route.js +4 -4
  84. package/.next/standalone/.next/server/app/api/wiki/git-history/route.js.nft.json +1 -1
  85. package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js +8 -8
  86. package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js.nft.json +1 -1
  87. package/.next/standalone/.next/server/app/api/wiki/move/route.js +6 -6
  88. package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
  89. package/.next/standalone/.next/server/app/api/wiki/new-file/route.js +5 -5
  90. package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
  91. package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js +7 -7
  92. package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js.nft.json +1 -1
  93. package/.next/standalone/.next/server/app/api/wiki/page/route.js +5 -5
  94. package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
  95. package/.next/standalone/.next/server/app/api/wiki/presence/route.js +6 -6
  96. package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/wiki/route.js +5 -5
  98. package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/wiki/search/route.js +5 -5
  100. package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/wiki/slugs/route.js +5 -5
  102. package/.next/standalone/.next/server/app/api/wiki/slugs/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/wiki/upload/route.js +5 -5
  104. package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
  105. package/.next/standalone/.next/server/app/api/wiki/watch/route.js +5 -5
  106. package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
  107. package/.next/standalone/.next/server/app/index.html +1 -1
  108. package/.next/standalone/.next/server/app/index.rsc +3 -3
  109. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  110. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  111. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  112. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  113. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  114. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  115. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  116. package/.next/standalone/.next/server/app/s/[token]/page_client-reference-manifest.js +1 -1
  117. package/.next/standalone/.next/server/app/signin/page_client-reference-manifest.js +1 -1
  118. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-jzw2_._.js +3 -0
  119. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.-oq-7._.js +3 -0
  120. package/.next/standalone/.next/server/chunks/[root-of-the-server]__000spch._.js +3 -0
  121. package/.next/standalone/.next/server/chunks/[root-of-the-server]__01oin-a._.js +3 -0
  122. package/.next/standalone/.next/server/chunks/[root-of-the-server]__01qcera._.js +16 -0
  123. package/.next/standalone/.next/server/chunks/[root-of-the-server]__02.uul~._.js +3 -0
  124. package/.next/standalone/.next/server/chunks/[root-of-the-server]__024967n._.js +3 -0
  125. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06booxp._.js +3 -0
  126. package/.next/standalone/.next/server/chunks/[root-of-the-server]__071_pmz._.js +3 -0
  127. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_0bqpg._.js +3 -0
  128. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_1f2cw._.js +3 -0
  129. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0a6j6r4._.js +3 -0
  130. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0aoqat-._.js +3 -0
  131. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0as-u6z._.js +3 -0
  132. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0bvtbax._.js +3 -0
  133. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0c-ee48._.js +5 -0
  134. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0e_9pc5._.js +3 -0
  135. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0esmskc._.js +3 -0
  136. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fshk._._.js +20 -0
  137. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fu72o7._.js +3 -0
  138. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0k9mili._.js +3 -0
  139. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0l-wu5u._.js +3 -0
  140. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0lvz22t._.js +20 -0
  141. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0n-chxk._.js +16 -0
  142. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0n9zdf0._.js +3 -0
  143. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0nmx3k2._.js +12 -0
  144. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0nzlmkb._.js +3 -0
  145. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o0v6hf._.js +3 -0
  146. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s38pid._.js +3 -0
  147. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s_8poz._.js +3 -0
  148. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0sfrx~.._.js +3 -0
  149. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0sggstu._.js +3 -0
  150. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0u81k~2._.js +3 -0
  151. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0uibxf_._.js +3 -0
  152. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wfv_by._.js +3 -0
  153. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wlj-yw._.js +3 -0
  154. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0w~__xz._.js +3 -0
  155. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0yat~ul._.js +3 -0
  156. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0yxauu6._.js +3 -0
  157. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zbkgnr._.js +3 -0
  158. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zv_j05._.js +3 -0
  159. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~rntxj._.js +3 -0
  160. package/.next/standalone/.next/server/chunks/src_lib_search_0d-_j3u._.js +4 -4
  161. package/.next/standalone/.next/server/chunks/src_lib_search_0ymmp0c._.js +3 -3
  162. package/.next/standalone/.next/server/chunks/src_lib_workspaces_ts_0qon40u._.js +4 -0
  163. package/.next/standalone/.next/server/chunks/ssr/{0~w0_katex_dist_katex_mjs_029cdbg._.js → 0~w0_katex_dist_katex_mjs_0s4yb1t._.js} +1 -1
  164. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0z41nrr._.js → [root-of-the-server]__10te1ye._.js} +2 -2
  165. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_13p348f._.js → node_modules__pnpm_0-a_zjq._.js} +1 -1
  166. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0gos._c._.js → node_modules__pnpm_02l_1_8._.js} +1 -1
  167. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0ru1i2-._.js → node_modules__pnpm_03rzttw._.js} +2 -2
  168. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_08xpp3w._.js → node_modules__pnpm_04frxp9._.js} +1 -1
  169. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0b8odbc._.js → node_modules__pnpm_057-t6m._.js} +1 -1
  170. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0f_n_zp._.js → node_modules__pnpm_05_oahi._.js} +1 -1
  171. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0~i3a.i._.js → node_modules__pnpm_05ans~m._.js} +1 -1
  172. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0i2m0b.._.js → node_modules__pnpm_06-2ia.._.js} +2 -2
  173. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0aha1~u._.js → node_modules__pnpm_086.ow4._.js} +1 -1
  174. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0w.kwue._.js → node_modules__pnpm_0cahog3._.js} +1 -1
  175. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0e0r_qk._.js → node_modules__pnpm_0cxanql._.js} +2 -2
  176. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0ajqqlq._.js → node_modules__pnpm_0e09gmf._.js} +1 -1
  177. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0hzzx9d._.js → node_modules__pnpm_0eqjo2f._.js} +1 -1
  178. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_02bje_g._.js → node_modules__pnpm_0f-yazg._.js} +1 -1
  179. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0xk042~._.js → node_modules__pnpm_0iu44jv._.js} +1 -1
  180. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_11ede0p._.js → node_modules__pnpm_0jh8q66._.js} +2 -2
  181. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0k-7uzm._.js → node_modules__pnpm_0m39f~t._.js} +1 -1
  182. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0xr.ztu._.js → node_modules__pnpm_0ma-8l.._.js} +1 -1
  183. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0i6_kfe._.js → node_modules__pnpm_0met6sx._.js} +2 -2
  184. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_04v1_ty._.js → node_modules__pnpm_0mtrsi0._.js} +2 -2
  185. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0607~kg._.js → node_modules__pnpm_0n_swwn._.js} +2 -2
  186. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0t4l89_._.js → node_modules__pnpm_0ndyy93._.js} +1 -1
  187. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0-_58b8._.js → node_modules__pnpm_0s-cj7c._.js} +1 -1
  188. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0y2h_cz._.js → node_modules__pnpm_0tr41-t._.js} +1 -1
  189. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_08edl1n._.js → node_modules__pnpm_0u.uija._.js} +1 -1
  190. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0026mgr._.js → node_modules__pnpm_0wiyn6d._.js} +1 -1
  191. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09o_spj._.js → node_modules__pnpm_0ygzt82._.js} +1 -1
  192. package/.next/standalone/.next/server/chunks/ssr/src_app_page_tsx_0ss2.w7._.js +2 -2
  193. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  194. package/.next/standalone/.next/server/middleware-manifest.json +1 -1
  195. package/.next/standalone/.next/server/pages/404.html +1 -1
  196. package/.next/standalone/.next/server/pages/500.html +1 -1
  197. package/.next/standalone/.next/static/chunks/0ci7khnv7i~7_.js +17 -0
  198. package/.next/standalone/.next/static/chunks/0sx~65~lg4mgl.css +5 -0
  199. package/.next/standalone/package.json +1 -1
  200. package/README.md +88 -17
  201. package/bin/postbuild.js +21 -0
  202. package/bin/wiki-viewer.js +198 -6
  203. package/package.json +1 -1
  204. package/.next/standalone/.github/workflows/publish.yml +0 -37
  205. package/.next/standalone/.handoffs/archive/handoff-20260612-113332.md +0 -98
  206. package/.next/standalone/.handoffs/archive/handoff-20260612-141032.md +0 -73
  207. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-.y6im._.js +0 -3
  208. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-3_t2y._.js +0 -3
  209. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-kjkzt._.js +0 -3
  210. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-puax4._.js +0 -4
  211. package/.next/standalone/.next/server/chunks/[root-of-the-server]__01h996g._.js +0 -3
  212. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0329ktu._.js +0 -3
  213. package/.next/standalone/.next/server/chunks/[root-of-the-server]__03_xj4r._.js +0 -3
  214. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05398dt._.js +0 -4
  215. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06lfvxh._.js +0 -3
  216. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06w0aet._.js +0 -3
  217. package/.next/standalone/.next/server/chunks/[root-of-the-server]__070_p2a._.js +0 -4
  218. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0905hi1._.js +0 -21
  219. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0aa63~j._.js +0 -5
  220. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0avcplk._.js +0 -4
  221. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0b8_kyo._.js +0 -16
  222. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0bticq1._.js +0 -3
  223. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0bwevvu._.js +0 -3
  224. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0c__k3q._.js +0 -4
  225. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0cp~z4x._.js +0 -3
  226. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fmdv9h._.js +0 -20
  227. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0h0qbwr._.js +0 -3
  228. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0jk~oyi._.js +0 -3
  229. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ndq77b._.js +0 -3
  230. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0nvgpuk._.js +0 -3
  231. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ocvng2._.js +0 -3
  232. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ps4h~.._.js +0 -3
  233. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q7jqwp._.js +0 -12
  234. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qew~6p._.js +0 -3
  235. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s_9f-a._.js +0 -3
  236. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0uv7b8u._.js +0 -3
  237. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0uv8.9i._.js +0 -3
  238. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0vfe2io._.js +0 -4
  239. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0w11kjy._.js +0 -3
  240. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wc-.e4._.js +0 -3
  241. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ymovmp._.js +0 -3
  242. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~c6ouv._.js +0 -3
  243. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~rhs0u._.js +0 -16
  244. package/.next/standalone/.next/server/chunks/[root-of-the-server]__10h9tid._.js +0 -3
  245. package/.next/standalone/.next/server/chunks/[root-of-the-server]__10yk-u1._.js +0 -3
  246. package/.next/standalone/.next/server/chunks/[root-of-the-server]__11105ew._.js +0 -3
  247. package/.next/standalone/.next/server/chunks/[root-of-the-server]__11a3dhw._.js +0 -3
  248. package/.next/standalone/.next/server/chunks/[root-of-the-server]__13420tt._.js +0 -3
  249. package/.next/standalone/.next/server/chunks/[root-of-the-server]__13h~pdf._.js +0 -3
  250. package/.next/standalone/.next/static/chunks/02kg.lbkfi1yc.css +0 -5
  251. package/.next/standalone/.next/static/chunks/0rcwd6-.iu~nd.js +0 -17
  252. package/.next/standalone/.pi/ownership.json +0 -3
  253. package/.next/standalone/AGENTS.md +0 -114
  254. package/.next/standalone/DESIGN.md +0 -521
  255. package/.next/standalone/README.md +0 -821
  256. package/.next/standalone/TODO.md +0 -20
  257. package/.next/standalone/agents/bootstrap-prompt.md +0 -14
  258. package/.next/standalone/agents/wiki-viewer-skill/SKILL.md +0 -456
  259. package/.next/standalone/bin/postbuild.js +0 -78
  260. package/.next/standalone/bin/wiki-viewer.js +0 -922
  261. package/.next/standalone/certificates/localhost-key.pem +0 -28
  262. package/.next/standalone/certificates/localhost.pem +0 -24
  263. package/.next/standalone/docs/agent-collab-plan.md +0 -1615
  264. package/.next/standalone/docs/agent-collab-v2-plan.md +0 -771
  265. package/.next/standalone/docs/agent-fs-plan.md +0 -232
  266. package/.next/standalone/docs/editorial-skin-spec.md +0 -242
  267. package/.next/standalone/docs/file-vs-collab-authority.md +0 -124
  268. package/.next/standalone/docs/mobile-readiness-spec.md +0 -229
  269. package/.next/standalone/docs/workspacing-plan.md +0 -364
  270. package/.next/standalone/packages/wiki-viewer-mcp/README.md +0 -195
  271. package/.next/standalone/packages/wiki-viewer-mcp/bench-e2e.mjs +0 -166
  272. package/.next/standalone/packages/wiki-viewer-mcp/bench-latency.mjs +0 -87
  273. package/.next/standalone/packages/wiki-viewer-mcp/bench-payload.mjs +0 -45
  274. package/.next/standalone/packages/wiki-viewer-mcp/dist/http-client.js +0 -331
  275. package/.next/standalone/packages/wiki-viewer-mcp/dist/index.js +0 -531
  276. package/.next/standalone/packages/wiki-viewer-mcp/dist/register.js +0 -94
  277. package/.next/standalone/packages/wiki-viewer-mcp/dist/state-cache.js +0 -28
  278. package/.next/standalone/packages/wiki-viewer-mcp/package-lock.json +0 -1716
  279. package/.next/standalone/packages/wiki-viewer-mcp/package.json +0 -41
  280. package/.next/standalone/packages/wiki-viewer-mcp/src/http-client.ts +0 -459
  281. package/.next/standalone/packages/wiki-viewer-mcp/src/index.ts +0 -638
  282. package/.next/standalone/packages/wiki-viewer-mcp/src/register.ts +0 -144
  283. package/.next/standalone/packages/wiki-viewer-mcp/src/state-cache.ts +0 -55
  284. package/.next/standalone/packages/wiki-viewer-mcp/tsconfig.json +0 -19
  285. package/.next/standalone/pnpm-lock.yaml +0 -6697
  286. package/.next/standalone/pnpm-workspace.yaml +0 -8
  287. package/.next/standalone/postcss.config.mjs +0 -2
  288. package/.next/standalone/src/app/api/agent/activity/route.ts +0 -59
  289. package/.next/standalone/src/app/api/agent/admin/agents/[agentId]/revoke/route.ts +0 -40
  290. package/.next/standalone/src/app/api/agent/admin/agents/route.ts +0 -33
  291. package/.next/standalone/src/app/api/agent/admin/registrations/[regId]/approve/route.ts +0 -83
  292. package/.next/standalone/src/app/api/agent/admin/registrations/[regId]/deny/route.ts +0 -36
  293. package/.next/standalone/src/app/api/agent/admin/registrations/route.ts +0 -27
  294. package/.next/standalone/src/app/api/agent/events/[...path]/route.ts +0 -148
  295. package/.next/standalone/src/app/api/agent/files/[...path]/route.ts +0 -219
  296. package/.next/standalone/src/app/api/agent/fs/file/[...path]/route.ts +0 -446
  297. package/.next/standalone/src/app/api/agent/fs/ls/[[...path]]/route.ts +0 -152
  298. package/.next/standalone/src/app/api/agent/fs/move/route.ts +0 -130
  299. package/.next/standalone/src/app/api/agent/fs/search/route.ts +0 -272
  300. package/.next/standalone/src/app/api/agent/internal/span/route.ts +0 -121
  301. package/.next/standalone/src/app/api/agent/register/[regId]/route.ts +0 -50
  302. package/.next/standalone/src/app/api/agent/register/route.ts +0 -118
  303. package/.next/standalone/src/app/api/agent/settings/route.ts +0 -34
  304. package/.next/standalone/src/app/api/agent/settings/token/regenerate/route.ts +0 -20
  305. package/.next/standalone/src/app/api/agent/sidecar/[...path]/route.ts +0 -53
  306. package/.next/standalone/src/app/api/agents/install/route.ts +0 -143
  307. package/.next/standalone/src/app/api/agents/skill/route.ts +0 -20
  308. package/.next/standalone/src/app/api/agents/skill.tar.gz/route.ts +0 -87
  309. package/.next/standalone/src/app/api/app-proxy/[...path]/route.ts +0 -247
  310. package/.next/standalone/src/app/api/assets/[...path]/route.ts +0 -75
  311. package/.next/standalone/src/app/api/auth/[...all]/route.ts +0 -7
  312. package/.next/standalone/src/app/api/owner/init/route.ts +0 -14
  313. package/.next/standalone/src/app/api/share/[token]/route.ts +0 -269
  314. package/.next/standalone/src/app/api/share/route.ts +0 -127
  315. package/.next/standalone/src/app/api/system/admins/route.ts +0 -103
  316. package/.next/standalone/src/app/api/system/auth-config/route.ts +0 -22
  317. package/.next/standalone/src/app/api/system/auth-settings/route.ts +0 -86
  318. package/.next/standalone/src/app/api/system/browse/route.ts +0 -82
  319. package/.next/standalone/src/app/api/system/clear-root/route.ts +0 -16
  320. package/.next/standalone/src/app/api/system/config/route.ts +0 -14
  321. package/.next/standalone/src/app/api/system/pins/route.ts +0 -38
  322. package/.next/standalone/src/app/api/system/reveal/route.ts +0 -36
  323. package/.next/standalone/src/app/api/system/root-status/route.ts +0 -13
  324. package/.next/standalone/src/app/api/system/set-root/route.ts +0 -53
  325. package/.next/standalone/src/app/api/system/users/route.ts +0 -120
  326. package/.next/standalone/src/app/api/system/workspaces/[id]/open/route.ts +0 -34
  327. package/.next/standalone/src/app/api/system/workspaces/[id]/refresh/route.ts +0 -32
  328. package/.next/standalone/src/app/api/system/workspaces/[id]/route.ts +0 -78
  329. package/.next/standalone/src/app/api/system/workspaces/route.ts +0 -128
  330. package/.next/standalone/src/app/api/upload/[...path]/route.ts +0 -85
  331. package/.next/standalone/src/app/api/wiki/app/route.ts +0 -60
  332. package/.next/standalone/src/app/api/wiki/backlinks/route.ts +0 -29
  333. package/.next/standalone/src/app/api/wiki/content/route.ts +0 -159
  334. package/.next/standalone/src/app/api/wiki/download/route.ts +0 -100
  335. package/.next/standalone/src/app/api/wiki/file/route.ts +0 -57
  336. package/.next/standalone/src/app/api/wiki/folder/route.ts +0 -34
  337. package/.next/standalone/src/app/api/wiki/git-branches/route.ts +0 -32
  338. package/.next/standalone/src/app/api/wiki/git-checkout/route.ts +0 -45
  339. package/.next/standalone/src/app/api/wiki/git-diff/route.ts +0 -33
  340. package/.next/standalone/src/app/api/wiki/git-file-info/route.ts +0 -27
  341. package/.next/standalone/src/app/api/wiki/git-history/route.ts +0 -27
  342. package/.next/standalone/src/app/api/wiki/git-pull/route.ts +0 -48
  343. package/.next/standalone/src/app/api/wiki/move/route.ts +0 -61
  344. package/.next/standalone/src/app/api/wiki/new-file/route.ts +0 -56
  345. package/.next/standalone/src/app/api/wiki/outlinks/route.ts +0 -76
  346. package/.next/standalone/src/app/api/wiki/page/route.ts +0 -92
  347. package/.next/standalone/src/app/api/wiki/presence/route.ts +0 -56
  348. package/.next/standalone/src/app/api/wiki/route.ts +0 -116
  349. package/.next/standalone/src/app/api/wiki/search/route.ts +0 -44
  350. package/.next/standalone/src/app/api/wiki/slugs/route.ts +0 -54
  351. package/.next/standalone/src/app/api/wiki/upload/route.ts +0 -95
  352. package/.next/standalone/src/app/api/wiki/watch/route.ts +0 -67
  353. package/.next/standalone/src/app/globals.css +0 -1249
  354. package/.next/standalone/src/app/icon.svg +0 -11
  355. package/.next/standalone/src/app/layout.tsx +0 -78
  356. package/.next/standalone/src/app/manifest.ts +0 -30
  357. package/.next/standalone/src/app/page.tsx +0 -3260
  358. package/.next/standalone/src/app/s/[token]/page.tsx +0 -357
  359. package/.next/standalone/src/app/signin/page.tsx +0 -16
  360. package/.next/standalone/src/app/signin/signin-form.tsx +0 -238
  361. package/.next/standalone/src/components/ai-panel/activity-row.tsx +0 -284
  362. package/.next/standalone/src/components/ai-panel/ai-panel.tsx +0 -311
  363. package/.next/standalone/src/components/ai-panel/token-section.tsx +0 -313
  364. package/.next/standalone/src/components/auth-settings-sheet.tsx +0 -474
  365. package/.next/standalone/src/components/confirm-dialog.tsx +0 -56
  366. package/.next/standalone/src/components/dir-picker.tsx +0 -606
  367. package/.next/standalone/src/components/editor/backlinks-panel.tsx +0 -139
  368. package/.next/standalone/src/components/editor/bubble-menu.tsx +0 -346
  369. package/.next/standalone/src/components/editor/callout-extension.ts +0 -36
  370. package/.next/standalone/src/components/editor/comment-pip.tsx +0 -56
  371. package/.next/standalone/src/components/editor/comment-thread.tsx +0 -254
  372. package/.next/standalone/src/components/editor/csv-viewer.tsx +0 -379
  373. package/.next/standalone/src/components/editor/document-outline.tsx +0 -230
  374. package/.next/standalone/src/components/editor/editor-toolbar.tsx +0 -564
  375. package/.next/standalone/src/components/editor/editor.tsx +0 -1327
  376. package/.next/standalone/src/components/editor/extensions/drag-handle.ts +0 -325
  377. package/.next/standalone/src/components/editor/extensions/heading-anchors.ts +0 -55
  378. package/.next/standalone/src/components/editor/extensions/proof-span.ts +0 -60
  379. package/.next/standalone/src/components/editor/extensions/resizable-image.tsx +0 -159
  380. package/.next/standalone/src/components/editor/extensions.ts +0 -150
  381. package/.next/standalone/src/components/editor/file-fallback-viewer.tsx +0 -75
  382. package/.next/standalone/src/components/editor/folder-index.tsx +0 -236
  383. package/.next/standalone/src/components/editor/google-doc-viewer.tsx +0 -73
  384. package/.next/standalone/src/components/editor/image-viewer.tsx +0 -57
  385. package/.next/standalone/src/components/editor/large-file-gate.tsx +0 -108
  386. package/.next/standalone/src/components/editor/link-popover.tsx +0 -111
  387. package/.next/standalone/src/components/editor/media-popover.tsx +0 -212
  388. package/.next/standalone/src/components/editor/media-viewer.tsx +0 -70
  389. package/.next/standalone/src/components/editor/mermaid-viewer.tsx +0 -286
  390. package/.next/standalone/src/components/editor/node-app-viewer.tsx +0 -328
  391. package/.next/standalone/src/components/editor/notebook-viewer.tsx +0 -371
  392. package/.next/standalone/src/components/editor/office/docx-viewer.tsx +0 -93
  393. package/.next/standalone/src/components/editor/office/office-chrome.tsx +0 -83
  394. package/.next/standalone/src/components/editor/office/pptx-viewer.tsx +0 -104
  395. package/.next/standalone/src/components/editor/office/xlsx-viewer.tsx +0 -192
  396. package/.next/standalone/src/components/editor/pdf-viewer.tsx +0 -32
  397. package/.next/standalone/src/components/editor/proof-span-popover.tsx +0 -162
  398. package/.next/standalone/src/components/editor/slash-commands.tsx +0 -629
  399. package/.next/standalone/src/components/editor/source-viewer.tsx +0 -289
  400. package/.next/standalone/src/components/editor/suggest-edit-popover.tsx +0 -229
  401. package/.next/standalone/src/components/editor/suggestion-card.tsx +0 -206
  402. package/.next/standalone/src/components/editor/table-menu.tsx +0 -232
  403. package/.next/standalone/src/components/editor/view-mode-comment-button.tsx +0 -77
  404. package/.next/standalone/src/components/editor/website-viewer.tsx +0 -75
  405. package/.next/standalone/src/components/editor/wiki-link-create-dialog.tsx +0 -189
  406. package/.next/standalone/src/components/editor/wiki-link-decorator.ts +0 -79
  407. package/.next/standalone/src/components/editor/wiki-link-extension.ts +0 -120
  408. package/.next/standalone/src/components/editor/wiki-link-picker.tsx +0 -250
  409. package/.next/standalone/src/components/layout/viewer-toolbar.tsx +0 -54
  410. package/.next/standalone/src/components/search/search-command-dialog.tsx +0 -246
  411. package/.next/standalone/src/components/search/sidebar-search-box.tsx +0 -121
  412. package/.next/standalone/src/components/search/snippet-text.tsx +0 -48
  413. package/.next/standalone/src/components/share-dialog.tsx +0 -307
  414. package/.next/standalone/src/components/theme-provider.tsx +0 -16
  415. package/.next/standalone/src/components/theme-toggle.tsx +0 -24
  416. package/.next/standalone/src/components/ui/badge.tsx +0 -35
  417. package/.next/standalone/src/components/ui/button.tsx +0 -56
  418. package/.next/standalone/src/components/ui/card.tsx +0 -63
  419. package/.next/standalone/src/components/ui/collapsible.tsx +0 -9
  420. package/.next/standalone/src/components/ui/command.tsx +0 -151
  421. package/.next/standalone/src/components/ui/context-menu.tsx +0 -191
  422. package/.next/standalone/src/components/ui/dialog.tsx +0 -119
  423. package/.next/standalone/src/components/ui/dropdown-menu.tsx +0 -194
  424. package/.next/standalone/src/components/ui/input.tsx +0 -22
  425. package/.next/standalone/src/components/ui/label.tsx +0 -25
  426. package/.next/standalone/src/components/ui/popover.tsx +0 -33
  427. package/.next/standalone/src/components/ui/scroll-area.tsx +0 -47
  428. package/.next/standalone/src/components/ui/select.tsx +0 -156
  429. package/.next/standalone/src/components/ui/separator.tsx +0 -30
  430. package/.next/standalone/src/components/ui/sheet.tsx +0 -140
  431. package/.next/standalone/src/components/ui/skeleton.tsx +0 -15
  432. package/.next/standalone/src/components/ui/switch.tsx +0 -28
  433. package/.next/standalone/src/components/ui/tabs.tsx +0 -54
  434. package/.next/standalone/src/components/ui/textarea.tsx +0 -21
  435. package/.next/standalone/src/components/ui/tip.tsx +0 -23
  436. package/.next/standalone/src/components/ui/toggle-group.tsx +0 -41
  437. package/.next/standalone/src/components/ui/tooltip.tsx +0 -27
  438. package/.next/standalone/src/components/view-width-toggle.tsx +0 -70
  439. package/.next/standalone/src/components/wiki/frontmatter-header.tsx +0 -164
  440. package/.next/standalone/src/hooks/use-is-mobile.ts +0 -14
  441. package/.next/standalone/src/lib/app-runner.ts +0 -272
  442. package/.next/standalone/src/lib/auth/admin.ts +0 -120
  443. package/.next/standalone/src/lib/auth/allowlist.ts +0 -50
  444. package/.next/standalone/src/lib/auth/client.ts +0 -4
  445. package/.next/standalone/src/lib/auth/csrf.ts +0 -68
  446. package/.next/standalone/src/lib/auth/server.ts +0 -215
  447. package/.next/standalone/src/lib/cabinets/tree.ts +0 -75
  448. package/.next/standalone/src/lib/config.ts +0 -114
  449. package/.next/standalone/src/lib/embeds/detect.ts +0 -142
  450. package/.next/standalone/src/lib/git-secrets.ts +0 -65
  451. package/.next/standalone/src/lib/git.ts +0 -503
  452. package/.next/standalone/src/lib/google/detect.ts +0 -107
  453. package/.next/standalone/src/lib/markdown/parse-frontmatter.ts +0 -104
  454. package/.next/standalone/src/lib/markdown/remark-wikilinks.ts +0 -100
  455. package/.next/standalone/src/lib/markdown/sanitize-schema.ts +0 -106
  456. package/.next/standalone/src/lib/markdown/to-html.ts +0 -282
  457. package/.next/standalone/src/lib/markdown/to-markdown.ts +0 -252
  458. package/.next/standalone/src/lib/proof/activity-shared.ts +0 -31
  459. package/.next/standalone/src/lib/proof/activity.ts +0 -74
  460. package/.next/standalone/src/lib/proof/audit.ts +0 -88
  461. package/.next/standalone/src/lib/proof/auth.ts +0 -143
  462. package/.next/standalone/src/lib/proof/block-refs.ts +0 -133
  463. package/.next/standalone/src/lib/proof/blocks.ts +0 -73
  464. package/.next/standalone/src/lib/proof/client-auth.ts +0 -23
  465. package/.next/standalone/src/lib/proof/collab-state.ts +0 -81
  466. package/.next/standalone/src/lib/proof/event-bus.ts +0 -47
  467. package/.next/standalone/src/lib/proof/file-lock.ts +0 -43
  468. package/.next/standalone/src/lib/proof/glob.ts +0 -51
  469. package/.next/standalone/src/lib/proof/idempotency.ts +0 -37
  470. package/.next/standalone/src/lib/proof/lease.ts +0 -117
  471. package/.next/standalone/src/lib/proof/mutex.ts +0 -36
  472. package/.next/standalone/src/lib/proof/ops-applier.ts +0 -727
  473. package/.next/standalone/src/lib/proof/owner-auth.ts +0 -2
  474. package/.next/standalone/src/lib/proof/pending.ts +0 -97
  475. package/.next/standalone/src/lib/proof/proof-span.ts +0 -141
  476. package/.next/standalone/src/lib/proof/rate-limit.ts +0 -53
  477. package/.next/standalone/src/lib/proof/raw-fs.ts +0 -197
  478. package/.next/standalone/src/lib/proof/register-rate-limit.ts +0 -53
  479. package/.next/standalone/src/lib/proof/registry.ts +0 -195
  480. package/.next/standalone/src/lib/proof/sidecar.ts +0 -103
  481. package/.next/standalone/src/lib/proof/suggest-capture.ts +0 -69
  482. package/.next/standalone/src/lib/proof/types.ts +0 -182
  483. package/.next/standalone/src/lib/proof-config.ts +0 -14
  484. package/.next/standalone/src/lib/root-dir.ts +0 -35
  485. package/.next/standalone/src/lib/search/indexable-exts.ts +0 -25
  486. package/.next/standalone/src/lib/search/indexer.ts +0 -634
  487. package/.next/standalone/src/lib/search/sanitize.ts +0 -35
  488. package/.next/standalone/src/lib/search/search-db.ts +0 -57
  489. package/.next/standalone/src/lib/search/watcher-pool.ts +0 -79
  490. package/.next/standalone/src/lib/shared-docs/db.ts +0 -177
  491. package/.next/standalone/src/lib/toast.ts +0 -9
  492. package/.next/standalone/src/lib/utils.ts +0 -6
  493. package/.next/standalone/src/lib/wiki-helpers.ts +0 -36
  494. package/.next/standalone/src/lib/workspace-client.ts +0 -82
  495. package/.next/standalone/src/lib/workspace-context.ts +0 -173
  496. package/.next/standalone/src/lib/workspaces.ts +0 -400
  497. package/.next/standalone/src/middleware.ts +0 -44
  498. package/.next/standalone/src/stores/ai-panel-store.ts +0 -79
  499. package/.next/standalone/src/stores/editor-store.ts +0 -439
  500. package/.next/standalone/src/stores/pin-store.ts +0 -56
  501. package/.next/standalone/src/stores/proof-store.ts +0 -124
  502. package/.next/standalone/src/stores/recent-store.ts +0 -51
  503. package/.next/standalone/src/stores/search-store.ts +0 -104
  504. package/.next/standalone/src/stores/show-hidden-store.ts +0 -26
  505. package/.next/standalone/src/stores/sidebar-width-store.ts +0 -39
  506. package/.next/standalone/src/stores/skin-store.ts +0 -42
  507. package/.next/standalone/src/stores/tree-store.ts +0 -52
  508. package/.next/standalone/src/stores/view-width-store.ts +0 -101
  509. package/.next/standalone/src/stores/wiki-slugs-store.ts +0 -75
  510. package/.next/standalone/src/tests/proof/activity-aggregator.test.ts +0 -146
  511. package/.next/standalone/src/tests/proof/admin-create-user.test.ts +0 -43
  512. package/.next/standalone/src/tests/proof/agent-fs.test.ts +0 -973
  513. package/.next/standalone/src/tests/proof/agent-ownership.test.ts +0 -140
  514. package/.next/standalone/src/tests/proof/agent-workspace-scope.test.ts +0 -134
  515. package/.next/standalone/src/tests/proof/agents-install.test.ts +0 -110
  516. package/.next/standalone/src/tests/proof/bench-write.ts +0 -179
  517. package/.next/standalone/src/tests/proof/better-auth.test.ts +0 -68
  518. package/.next/standalone/src/tests/proof/block-refs.test.ts +0 -108
  519. package/.next/standalone/src/tests/proof/blocks.test.ts +0 -92
  520. package/.next/standalone/src/tests/proof/collab-state.test.ts +0 -501
  521. package/.next/standalone/src/tests/proof/comments-ops.test.ts +0 -177
  522. package/.next/standalone/src/tests/proof/editor-roundtrip.test.ts +0 -85
  523. package/.next/standalone/src/tests/proof/external-edit.test.ts +0 -58
  524. package/.next/standalone/src/tests/proof/file-lock.test.ts +0 -80
  525. package/.next/standalone/src/tests/proof/git-branches-checkout.test.ts +0 -136
  526. package/.next/standalone/src/tests/proof/git-read-features.test.ts +0 -473
  527. package/.next/standalone/src/tests/proof/git-secrets.test.ts +0 -138
  528. package/.next/standalone/src/tests/proof/git-sparse.test.ts +0 -257
  529. package/.next/standalone/src/tests/proof/git-workspace.test.ts +0 -135
  530. package/.next/standalone/src/tests/proof/git.test.ts +0 -243
  531. package/.next/standalone/src/tests/proof/glob.test.ts +0 -82
  532. package/.next/standalone/src/tests/proof/helpers/auth-session.ts +0 -27
  533. package/.next/standalone/src/tests/proof/markdown-to-html.test.ts +0 -46
  534. package/.next/standalone/src/tests/proof/ops-applier.test.ts +0 -368
  535. package/.next/standalone/src/tests/proof/owner-init.test.ts +0 -2
  536. package/.next/standalone/src/tests/proof/parse-frontmatter.test.ts +0 -60
  537. package/.next/standalone/src/tests/proof/preload.ts +0 -21
  538. package/.next/standalone/src/tests/proof/proof-span.test.ts +0 -98
  539. package/.next/standalone/src/tests/proof/rate-limit.test.ts +0 -54
  540. package/.next/standalone/src/tests/proof/readonly-enforcement.test.ts +0 -161
  541. package/.next/standalone/src/tests/proof/reconcile-sidecar.test.ts +0 -195
  542. package/.next/standalone/src/tests/proof/registration-flow.test.ts +0 -330
  543. package/.next/standalone/src/tests/proof/registry.test.ts +0 -169
  544. package/.next/standalone/src/tests/proof/routes.test.ts +0 -516
  545. package/.next/standalone/src/tests/proof/search-index.test.ts +0 -376
  546. package/.next/standalone/src/tests/proof/sidecar-lifecycle.test.ts +0 -177
  547. package/.next/standalone/src/tests/proof/sidecar-trim.test.ts +0 -58
  548. package/.next/standalone/src/tests/proof/suggestion-ops.test.ts +0 -280
  549. package/.next/standalone/src/tests/proof/wiki-content-put.test.ts +0 -140
  550. package/.next/standalone/src/tests/proof/wiki-routes-auth.test.ts +0 -208
  551. package/.next/standalone/src/tests/proof/workspace-isolation.test.ts +0 -87
  552. package/.next/standalone/src/tests/proof/workspaces-api.test.ts +0 -227
  553. package/.next/standalone/src/types/index.ts +0 -47
  554. package/.next/standalone/tailwind.config.ts +0 -191
  555. package/.next/standalone/tsconfig.json +0 -41
  556. package/.next/standalone/tsconfig.tsbuildinfo +0 -1
  557. /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → ecpoWt_SP3WkUTh0NsnuT}/_buildManifest.js +0 -0
  558. /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → ecpoWt_SP3WkUTh0NsnuT}/_clientMiddlewareManifest.js +0 -0
  559. /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → ecpoWt_SP3WkUTh0NsnuT}/_ssgManifest.js +0 -0
@@ -1,922 +0,0 @@
1
- #!/usr/bin/env node
2
- import { spawn, execSync, execFileSync } from "node:child_process";
3
- import { createServer as createHttpsServer } from "node:https";
4
- import { createServer as createHttpServer, request as httpRequest } from "node:http";
5
- import { createServer as createNetServer } from "node:net";
6
- import { readFileSync, writeFileSync, mkdirSync, existsSync, rmSync } from "node:fs";
7
- import path from "node:path";
8
- import os from "node:os";
9
- import { fileURLToPath } from "node:url";
10
- import { createInterface } from "node:readline";
11
- import { stdin, stdout } from "node:process";
12
-
13
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
14
- const appRoot = path.resolve(__dirname, "..");
15
- const serverJs = path.join(appRoot, ".next", "standalone", "server.js");
16
- const selfScript = fileURLToPath(import.meta.url);
17
-
18
- const configDir = path.join(os.homedir(), ".wiki-viewer");
19
- const configPath = path.join(configDir, "config.json");
20
- const logDir = path.join(configDir, "logs");
21
-
22
- const SERVICE_NAME = "wiki-viewer";
23
- const LAUNCHD_LABEL = "com.wiki-viewer";
24
-
25
- function printUsage() {
26
- console.error("Usage: wiki-viewer [directory] [options]");
27
- console.error(" wiki-viewer <command> [args]");
28
- console.error("");
29
- console.error(" directory Directory to serve (optional — pick in browser if omitted)");
30
- console.error("");
31
- console.error("Options:");
32
- console.error(" -p, --port <port> Port to listen on (default: 3000)");
33
- console.error(" -H, --host <host> Host to bind to (default: localhost)");
34
- console.error(" --https Enable HTTPS (self-signed cert, enables service workers)");
35
- console.error(" --no-auth Run without authentication — no sign-in, no session check");
36
- console.error(" -v, --version Print version");
37
- console.error("");
38
- console.error(" -e, --env <KEY=VALUE> Set an app env var (repeatable; persisted with service install)");
39
- console.error("");
40
- console.error("Commands:");
41
- console.error(" init Interactive setup wizard (dir, host/port, https, env, service)");
42
- console.error(" service install [dir] [options] Install as a user service (persists across reboot)");
43
- console.error(" service uninstall Remove the user service");
44
- console.error(" service status Show service status");
45
- console.error(" service logs Tail service logs");
46
- console.error(" service restart Restart the service");
47
- console.error(" service run Run from saved config (used internally by the service)");
48
- console.error(" config show Print the saved config");
49
- console.error(" config set KEY=VALUE Set an app env var in the config");
50
- console.error(" config unset KEY Remove an app env var from the config");
51
- console.error(" update Update wiki-viewer to the latest version and restart");
52
- console.error("");
53
- console.error("Examples:");
54
- console.error(" wiki-viewer init");
55
- console.error(" wiki-viewer ~/notes");
56
- console.error(" wiki-viewer ~/notes --https");
57
- console.error(" wiki-viewer ~/notes -p 8080 -H 0.0.0.0");
58
- console.error(" wiki-viewer service install ~/notes -H 0.0.0.0 -p 3003 --https");
59
- console.error(" wiki-viewer service install ~/notes --env GOOGLE_CLIENT_ID=... --env GOOGLE_CLIENT_SECRET=...");
60
- console.error(" wiki-viewer config set AUTH_ALLOWED_DOMAIN=example.com");
61
- console.error(" wiki-viewer update");
62
- }
63
-
64
- // ── arg parsing ──────────────────────────────────────────────────────────────
65
-
66
- function parseServeArgs(args) {
67
- let port = process.env.PORT;
68
- let host = process.env.HOSTNAME;
69
- let useHttps;
70
- let userSpecifiedPort = false;
71
- let rootDir;
72
- let noAuth;
73
-
74
- for (let i = 0; i < args.length; i++) {
75
- const a = args[i];
76
- if (a === "-p" || a === "--port") { port = args[++i] ?? port; userSpecifiedPort = true; }
77
- else if (a === "-H" || a === "--host") host = args[++i] ?? host;
78
- else if (a === "-e" || a === "--env") { i++; } // consumed by parseEnvFlags
79
- else if (a === "--https") useHttps = true;
80
- else if (a === "--no-auth") noAuth = true;
81
- else if (!a.startsWith("-") && rootDir === undefined) rootDir = a;
82
- }
83
-
84
- return { rootDir, port, host, useHttps, userSpecifiedPort, noAuth: Boolean(noAuth) };
85
- }
86
-
87
- // ── config file ────────────────────────────────────────────────────────────
88
-
89
- function loadConfig() {
90
- if (!existsSync(configPath)) return {};
91
- try {
92
- return JSON.parse(readFileSync(configPath, "utf8"));
93
- } catch {
94
- console.error(`Warning: could not parse ${configPath}, ignoring it`);
95
- return {};
96
- }
97
- }
98
-
99
- function saveConfig(cfg) {
100
- mkdirSync(configDir, { recursive: true });
101
- writeFileSync(configPath, JSON.stringify(cfg, null, 2) + "\n");
102
- }
103
-
104
- // Ad-hoc serve: CLI flags + built-in defaults. The run *shape* (dir/host/port)
105
- // does NOT read the config file, so an installed service never silently alters
106
- // a one-off invocation. App-level env (config.env) is still read, because those
107
- // are settings about the app itself (allowlists, OAuth) rather than the bind.
108
- function resolveServeOptions(args) {
109
- const cli = parseServeArgs(args);
110
- const cfg = loadConfig();
111
- return {
112
- rootDir: cli.rootDir ? path.resolve(cli.rootDir) : null,
113
- port: String(cli.port ?? "3000"),
114
- host: cli.host ?? "localhost",
115
- useHttps: Boolean(cli.useHttps),
116
- userSpecifiedPort: cli.userSpecifiedPort,
117
- // App env: config.env as base, ad-hoc --env flags override per run.
118
- configEnv: { ...(cfg.env ?? {}), ...(cli.noAuth ? { WIKI_NO_AUTH: "1" } : {}), ...parseEnvFlags(args) },
119
- };
120
- }
121
-
122
- // Service run: config file is the source of truth. CLI flags (if any) still win
123
- // so the unit/plist could pass overrides, but normally there are none.
124
- // Precedence: explicit CLI flags > config file > built-in defaults.
125
- function resolveRunOptions(args) {
126
- const cli = parseServeArgs(args);
127
- const cfg = loadConfig();
128
-
129
- const rootDir = cli.rootDir ?? cfg.rootDir ?? null;
130
- const port = cli.port ?? cfg.port ?? "3000";
131
- const host = cli.host ?? cfg.host ?? "localhost";
132
- const useHttps = cli.useHttps ?? cfg.https ?? false;
133
- // A config-pinned port is explicit too (don't auto-bump to next free port).
134
- const userSpecifiedPort = cli.userSpecifiedPort || cfg.port != null;
135
-
136
- return {
137
- rootDir: rootDir ? path.resolve(rootDir) : null,
138
- port: String(port),
139
- host,
140
- useHttps: Boolean(useHttps),
141
- userSpecifiedPort,
142
- configEnv: { ...(cfg.env ?? {}), ...(cli.noAuth ? { WIKI_NO_AUTH: "1" } : {}), ...parseEnvFlags(args) },
143
- };
144
- }
145
-
146
- // ── environment resolution ───────────────────────────────────────────────────
147
-
148
- // Env vars the app reads that the bin can derive or manage on the user's behalf.
149
- // Everything else in config.env is passed through verbatim.
150
- const LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", ""]);
151
-
152
- function isLocalHost(h) {
153
- return LOCAL_HOSTS.has(h);
154
- }
155
-
156
- // Build the env for the spawned server.
157
- // Precedence (highest first):
158
- // 1. the shell environment the user launched us with (explicit override)
159
- // 2. config.env from ~/.wiki-viewer/config.json
160
- // 3. values derived by the bin from the run options (e.g. BETTER_AUTH_URL)
161
- //
162
- // Returns { env, warnings } where warnings are human-readable strings to print
163
- // before the server starts.
164
- function computeServerEnv({ host, port, useHttps, configEnv }) {
165
- const warnings = [];
166
- const derived = {};
167
-
168
- const scheme = useHttps ? "https" : "http";
169
- const urlHost = isLocalHost(host) || host === "0.0.0.0" ? "localhost" : host;
170
- const isSecureContext = useHttps || isLocalHost(host);
171
-
172
- // BETTER_AUTH_URL: the app requires this in production so cookies and OAuth
173
- // callbacks resolve. Derive it from the bind so the common case needs no
174
- // config at all.
175
- derived.BETTER_AUTH_URL = `${scheme}://${urlHost}:${port}`;
176
-
177
- // The app refuses to boot in production over an insecure context unless
178
- // WIKI_ALLOW_INSECURE=1. localhost http is fine (browsers treat it as secure).
179
- // Remote http is not: auth cookies and service workers will silently break.
180
- if (!isSecureContext) {
181
- derived.WIKI_ALLOW_INSECURE = "1";
182
- warnings.push(
183
- `Serving plain HTTP on a non-local host (${host}). Browsers treat this as\n` +
184
- ` an insecure context: login cookies, service workers and PDF.js will not\n` +
185
- ` work reliably, and OAuth callbacks will fail.\n` +
186
- ` Fix: re-run with --https, or put a TLS-terminating proxy in front and set\n` +
187
- ` BETTER_AUTH_URL to its public https:// URL (see "env" in ${configPath}).`,
188
- );
189
- } else if (isLocalHost(host) && !useHttps) {
190
- // localhost http is a secure context for the browser, but the app's prod
191
- // guard still wants the bypass flag set explicitly. Do it for the user.
192
- derived.WIKI_ALLOW_INSECURE = "1";
193
- }
194
-
195
- // Layer: derived < config.env < shell env.
196
- const env = { ...derived, ...configEnv };
197
-
198
- // Note when the shell or config overrode a derived value so the user isn't
199
- // surprised that --host/--port didn't change the auth URL.
200
- if (configEnv.BETTER_AUTH_URL && configEnv.BETTER_AUTH_URL !== derived.BETTER_AUTH_URL) {
201
- // config wins over derived; that's intentional, no warning needed.
202
- }
203
- if (process.env.BETTER_AUTH_URL && process.env.BETTER_AUTH_URL !== env.BETTER_AUTH_URL) {
204
- warnings.push(
205
- `BETTER_AUTH_URL is set in your shell (${process.env.BETTER_AUTH_URL}) and\n` +
206
- ` overrides the derived/config value.`,
207
- );
208
- }
209
-
210
- return { env, warnings };
211
- }
212
-
213
- // ── HTTPS cert generation ──────────────────────────────────────────────────
214
-
215
- function ensureCerts(host) {
216
- const dir = path.join(configDir, "certs");
217
- mkdirSync(dir, { recursive: true });
218
- const keyPath = path.join(dir, "key.pem");
219
- const certPath = path.join(dir, "cert.pem");
220
- if (existsSync(keyPath) && existsSync(certPath)) {
221
- return { key: readFileSync(keyPath), cert: readFileSync(certPath) };
222
- }
223
- // Try mkcert (trusted), fall back to openssl (self-signed)
224
- try {
225
- execSync("mkcert -version", { stdio: "ignore" });
226
- execSync(`mkcert -install 2>/dev/null; mkcert -key-file "${keyPath}" -cert-file "${certPath}" localhost 127.0.0.1 "${host}"`, { stdio: "pipe" });
227
- console.log("�� Trusted cert via mkcert");
228
- } catch {
229
- try {
230
- execSync(
231
- `openssl req -x509 -newkey rsa:2048 -keyout "${keyPath}" -out "${certPath}" -days 825 -nodes -subj "/CN=localhost"`,
232
- { stdio: "ignore" },
233
- );
234
- console.log("�� Self-signed cert (browser will warn once — click through)");
235
- } catch {
236
- console.error("Error: --https requires mkcert or openssl");
237
- process.exit(1);
238
- }
239
- }
240
- return { key: readFileSync(keyPath), cert: readFileSync(certPath) };
241
- }
242
-
243
- // ── port availability helpers ──────────────────────────────────────────────
244
-
245
- function isPortAvailable(p, h) {
246
- return new Promise((resolve) => {
247
- const s = createNetServer();
248
- s.once("error", () => resolve(false));
249
- s.once("listening", () => s.close(() => resolve(true)));
250
- s.listen(Number(p), h);
251
- });
252
- }
253
-
254
- async function findNextAvailablePort(startPort, h) {
255
- let p = Number(startPort);
256
- while (!(await isPortAvailable(p, h))) p++;
257
- return String(p);
258
- }
259
-
260
- function freePort() {
261
- return new Promise((resolve) => {
262
- const s = createNetServer();
263
- s.listen(0, "127.0.0.1", () => {
264
- const { port: p } = s.address();
265
- s.close(() => resolve(p));
266
- });
267
- });
268
- }
269
-
270
- function getNetworkAddress() {
271
- for (const ifaces of Object.values(os.networkInterfaces())) {
272
- for (const iface of ifaces ?? []) {
273
- if (iface.family === "IPv4" && !iface.internal) return iface.address;
274
- }
275
- }
276
- return null;
277
- }
278
-
279
- // ── start ──────────────────────────────────────────────────────────────────
280
-
281
- async function start(opts) {
282
- const { rootDir: resolvedRoot, useHttps, configEnv = {} } = opts;
283
- let { port, host, userSpecifiedPort } = opts;
284
-
285
- if (!existsSync(serverJs)) {
286
- console.error("Error: pre-built server not found at", serverJs);
287
- console.error("This is a bug – please report it at https://github.com/anh-chu/wiki-viewer/issues");
288
- process.exit(1);
289
- }
290
-
291
- if (resolvedRoot) {
292
- console.log(`�� ${resolvedRoot}`);
293
- } else {
294
- console.log("�� No directory specified — open the browser to choose one");
295
- }
296
-
297
- // Auto-select next free port when user didn't specify one
298
- if (!userSpecifiedPort) {
299
- const available = await isPortAvailable(Number(port), host);
300
- if (!available) {
301
- const original = port;
302
- port = await findNextAvailablePort(Number(port) + 1, host);
303
- console.log(`⚠️ Port ${original} in use → using ${port} (pass -p <port> to override)`);
304
- }
305
- }
306
-
307
- // When HTTPS is requested, run the standalone server on a random internal
308
- // HTTP port and stand up an HTTPS reverse-proxy on the user-facing port.
309
- const internalPort = useHttps ? String(await freePort()) : port;
310
- // In HTTPS mode the standalone server sits behind the proxy on loopback.
311
- // Otherwise it must bind to the user-requested host directly.
312
- const internalHost = useHttps ? "127.0.0.1" : host;
313
-
314
- // Resolve the app environment (config.env + shell overrides + derived
315
- // BETTER_AUTH_URL etc.) against the user-facing host/port, then print any
316
- // guidance before the server boots.
317
- const { env: appEnv, warnings } = computeServerEnv({ host, port, useHttps, configEnv });
318
- for (const w of warnings) console.log(`\n⚠️ ${w}`);
319
-
320
- const child = spawn(process.execPath, [serverJs], {
321
- cwd: path.join(appRoot, ".next", "standalone"),
322
- stdio: "inherit",
323
- env: {
324
- ...appEnv, // derived defaults + config.env
325
- ...process.env, // shell env always wins over derived/config
326
- ...(resolvedRoot ? { ROOT_DIR: resolvedRoot } : {}),
327
- PORT: internalPort,
328
- HOSTNAME: internalHost,
329
- },
330
- });
331
-
332
- child.on("exit", (code) => process.exit(code ?? 0));
333
-
334
- if (useHttps) {
335
- const { key, cert } = ensureCerts(host);
336
-
337
- // Simple HTTPS → HTTP proxy
338
- const proxy = createHttpsServer({ key, cert }, (req, res) => {
339
- const options = {
340
- hostname: internalHost,
341
- port: Number(internalPort),
342
- path: req.url,
343
- method: req.method,
344
- headers: req.headers,
345
- };
346
- const upstream = httpRequest(options, (upRes) => {
347
- res.writeHead(upRes.statusCode, upRes.headers);
348
- upRes.pipe(res);
349
- });
350
- upstream.on("error", () => res.destroy());
351
- req.pipe(upstream);
352
- });
353
-
354
- // Wait a moment for the standalone server to bind before starting proxy
355
- setTimeout(() => {
356
- proxy.listen(Number(port), host, () => {
357
- const scheme = "https";
358
- const displayHost = host === "0.0.0.0" ? "localhost" : host;
359
- console.log(`\n ➜ Local: ${scheme}://${displayHost}:${port}`);
360
- const netAddr = getNetworkAddress();
361
- if (netAddr && host !== "localhost" && host !== "127.0.0.1") {
362
- console.log(` ➜ Network: ${scheme}://${netAddr}:${port}`);
363
- }
364
- console.log(`\n Listening on ${host}:${port} (--host / -H, --port / -p to rebind)\n`);
365
- });
366
- }, 1_000);
367
- } else {
368
- const scheme = "http";
369
- const displayHost = host === "0.0.0.0" ? "localhost" : host;
370
- console.log(`\n ➜ Local: ${scheme}://${displayHost}:${port}`);
371
- const netAddr = getNetworkAddress();
372
- if (netAddr && host !== "localhost" && host !== "127.0.0.1") {
373
- console.log(` ➜ Network: ${scheme}://${netAddr}:${port}`);
374
- }
375
- console.log(`\n Listening on ${host}:${port} (--host / -H, --port / -p to rebind)\n`);
376
- }
377
- }
378
-
379
- // ── service: shared ──────────────────────────────────────────────────────────
380
-
381
- function platform() {
382
- if (process.platform === "linux") return "linux";
383
- if (process.platform === "darwin") return "macos";
384
- return null;
385
- }
386
-
387
- function requireSupportedPlatform() {
388
- const p = platform();
389
- if (!p) {
390
- console.error(`Error: service management is only supported on Linux (systemd) and macOS (launchd), not ${process.platform}.`);
391
- process.exit(1);
392
- }
393
- return p;
394
- }
395
-
396
- function run(cmd, args, opts = {}) {
397
- return execFileSync(cmd, args, { stdio: "inherit", ...opts });
398
- }
399
-
400
- function runQuiet(cmd, args) {
401
- try {
402
- return execFileSync(cmd, args, { stdio: ["ignore", "pipe", "pipe"] }).toString();
403
- } catch (e) {
404
- return null;
405
- }
406
- }
407
-
408
- // ── service: install ──────────────────────────────────────────────────────────
409
-
410
- // Pull repeatable `--env KEY=VALUE` (or `-e KEY=VALUE`) pairs out of an argv
411
- // list. Returns the collected map; the caller has already parsed the rest.
412
- function parseEnvFlags(args) {
413
- const env = {};
414
- for (let i = 0; i < args.length; i++) {
415
- if (args[i] === "--env" || args[i] === "-e") {
416
- const pair = args[++i];
417
- if (!pair || !pair.includes("=")) {
418
- console.error(`Error: --env expects KEY=VALUE (got: ${pair ?? "(nothing)"})`);
419
- process.exit(1);
420
- }
421
- const idx = pair.indexOf("=");
422
- env[pair.slice(0, idx)] = pair.slice(idx + 1);
423
- }
424
- }
425
- return env;
426
- }
427
-
428
- function serviceInstall(args) {
429
- const p = requireSupportedPlatform();
430
-
431
- // Capture the run config from flags (falling back to existing config), persist it.
432
- const cli = parseServeArgs(args);
433
- const envFlags = parseEnvFlags(args);
434
- const existing = loadConfig();
435
- const mergedEnv = { ...(existing.env ?? {}), ...envFlags };
436
- const cfg = {
437
- rootDir: cli.rootDir != null ? path.resolve(cli.rootDir) : existing.rootDir ?? null,
438
- host: cli.host ?? existing.host ?? "localhost",
439
- port: cli.port ?? existing.port ?? "3000",
440
- https: cli.useHttps ?? existing.https ?? false,
441
- ...(Object.keys(mergedEnv).length ? { env: mergedEnv } : {}),
442
- };
443
- saveConfig(cfg);
444
- console.log(`Saved config to ${configPath}`);
445
- console.log(` dir: ${cfg.rootDir ?? "(choose in browser)"}`);
446
- console.log(` host: ${cfg.host}`);
447
- console.log(` port: ${cfg.port}`);
448
- console.log(` https: ${cfg.https}`);
449
- if (cfg.env) {
450
- console.log(` env: ${Object.keys(cfg.env).join(", ")}`);
451
- }
452
- console.log("");
453
-
454
- // Surface the same secure-context guidance the server would, at install time.
455
- const { warnings } = computeServerEnv({
456
- host: cfg.host, port: String(cfg.port), useHttps: Boolean(cfg.https), configEnv: cfg.env ?? {},
457
- });
458
- for (const w of warnings) console.log(`⚠️ ${w}\n`);
459
-
460
- if (p === "linux") installSystemd();
461
- else installLaunchd();
462
- }
463
-
464
- // `wiki-viewer config` — show or edit the saved config (incl. env).
465
- function configCommand(args) {
466
- const cfg = loadConfig();
467
-
468
- if (args.length === 0 || args[0] === "show" || args[0] === "list") {
469
- if (!existsSync(configPath)) {
470
- console.log(`No config yet at ${configPath}`);
471
- console.log(`Create one with: wiki-viewer service install [dir] [options] [--env KEY=VALUE]`);
472
- return;
473
- }
474
- console.log(configPath);
475
- console.log(JSON.stringify(cfg, null, 2));
476
- return;
477
- }
478
-
479
- if (args[0] === "set") {
480
- const pairs = args.slice(1);
481
- if (pairs.length === 0) {
482
- console.error("Usage: wiki-viewer config set KEY=VALUE [KEY=VALUE ...]");
483
- process.exit(1);
484
- }
485
- cfg.env = cfg.env ?? {};
486
- for (const pair of pairs) {
487
- const idx = pair.indexOf("=");
488
- if (idx < 0) { console.error(`Error: expected KEY=VALUE (got: ${pair})`); process.exit(1); }
489
- cfg.env[pair.slice(0, idx)] = pair.slice(idx + 1);
490
- }
491
- saveConfig(cfg);
492
- console.log(`Updated env in ${configPath}: ${pairs.map((p) => p.split("=")[0]).join(", ")}`);
493
- if (serviceIsInstalled()) console.log("Run `wiki-viewer service restart` to apply.");
494
- return;
495
- }
496
-
497
- if (args[0] === "unset") {
498
- const keys = args.slice(1);
499
- if (keys.length === 0) { console.error("Usage: wiki-viewer config unset KEY [KEY ...]"); process.exit(1); }
500
- cfg.env = cfg.env ?? {};
501
- for (const k of keys) delete cfg.env[k];
502
- saveConfig(cfg);
503
- console.log(`Removed from env: ${keys.join(", ")}`);
504
- if (serviceIsInstalled()) console.log("Run `wiki-viewer service restart` to apply.");
505
- return;
506
- }
507
-
508
- if (args[0] === "path") { console.log(configPath); return; }
509
-
510
- console.error(`Unknown config command: ${args[0]}`);
511
- console.error("Try: show | set KEY=VALUE | unset KEY | path");
512
- process.exit(1);
513
- }
514
-
515
- function installSystemd() {
516
- const unitDir = path.join(os.homedir(), ".config", "systemd", "user");
517
- mkdirSync(unitDir, { recursive: true });
518
- const unitPath = path.join(unitDir, `${SERVICE_NAME}.service`);
519
-
520
- const unit = `[Unit]
521
- Description=wiki-viewer local file viewer
522
- After=network.target
523
-
524
- [Service]
525
- Type=simple
526
- ExecStart=${process.execPath} ${selfScript} service run
527
- Restart=on-failure
528
- RestartSec=3
529
- Environment=NODE_ENV=production
530
-
531
- [Install]
532
- WantedBy=default.target
533
- `;
534
- writeFileSync(unitPath, unit);
535
- console.log(`Wrote unit ${unitPath}`);
536
-
537
- // Enable lingering so the service survives logout and starts at boot.
538
- const user = os.userInfo().username;
539
- try {
540
- execFileSync("loginctl", ["enable-linger", user], { stdio: "ignore" });
541
- console.log(`Enabled linger for ${user} (starts at boot)`);
542
- } catch {
543
- console.log(`Note: could not enable linger automatically. For boot persistence run:`);
544
- console.log(` sudo loginctl enable-linger ${user}`);
545
- }
546
-
547
- run("systemctl", ["--user", "daemon-reload"]);
548
- run("systemctl", ["--user", "enable", "--now", `${SERVICE_NAME}.service`]);
549
- console.log("\nService installed and started.");
550
- console.log(" Status: wiki-viewer service status");
551
- console.log(" Logs: wiki-viewer service logs");
552
- }
553
-
554
- function installLaunchd() {
555
- const agentsDir = path.join(os.homedir(), "Library", "LaunchAgents");
556
- mkdirSync(agentsDir, { recursive: true });
557
- mkdirSync(logDir, { recursive: true });
558
- const plistPath = path.join(agentsDir, `${LAUNCHD_LABEL}.plist`);
559
- const outLog = path.join(logDir, "out.log");
560
- const errLog = path.join(logDir, "err.log");
561
-
562
- const plist = `<?xml version="1.0" encoding="UTF-8"?>
563
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
564
- <plist version="1.0">
565
- <dict>
566
- <key>Label</key>
567
- <string>${LAUNCHD_LABEL}</string>
568
- <key>ProgramArguments</key>
569
- <array>
570
- <string>${process.execPath}</string>
571
- <string>${selfScript}</string>
572
- <string>service</string>
573
- <string>run</string>
574
- </array>
575
- <key>RunAtLoad</key>
576
- <true/>
577
- <key>KeepAlive</key>
578
- <true/>
579
- <key>StandardOutPath</key>
580
- <string>${outLog}</string>
581
- <key>StandardErrorPath</key>
582
- <string>${errLog}</string>
583
- </dict>
584
- </plist>
585
- `;
586
- writeFileSync(plistPath, plist);
587
- console.log(`Wrote plist ${plistPath}`);
588
-
589
- // Reload if already loaded, then load with -w to persist across reboot.
590
- runQuiet("launchctl", ["unload", plistPath]);
591
- run("launchctl", ["load", "-w", plistPath]);
592
- console.log("\nService installed and started.");
593
- console.log(" Status: wiki-viewer service status");
594
- console.log(" Logs: wiki-viewer service logs");
595
- }
596
-
597
- // ── service: uninstall ──────────────────────────────────────────────────────
598
-
599
- function serviceUninstall() {
600
- const p = requireSupportedPlatform();
601
- if (p === "linux") {
602
- runQuiet("systemctl", ["--user", "disable", "--now", `${SERVICE_NAME}.service`]);
603
- const unitPath = path.join(os.homedir(), ".config", "systemd", "user", `${SERVICE_NAME}.service`);
604
- if (existsSync(unitPath)) { rmSync(unitPath); console.log(`Removed ${unitPath}`); }
605
- runQuiet("systemctl", ["--user", "daemon-reload"]);
606
- } else {
607
- const plistPath = path.join(os.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
608
- runQuiet("launchctl", ["unload", "-w", plistPath]);
609
- if (existsSync(plistPath)) { rmSync(plistPath); console.log(`Removed ${plistPath}`); }
610
- }
611
- console.log("Service uninstalled.");
612
- }
613
-
614
- // ── service: status / logs ──────────────────────────────────────────────────
615
-
616
- function serviceStatus() {
617
- const p = requireSupportedPlatform();
618
- if (p === "linux") {
619
- try { run("systemctl", ["--user", "status", `${SERVICE_NAME}.service`, "--no-pager"]); }
620
- catch { /* systemctl exits non-zero when inactive; output already shown */ }
621
- } else {
622
- const out = runQuiet("launchctl", ["list"]);
623
- if (out) {
624
- const line = out.split("\n").find((l) => l.includes(LAUNCHD_LABEL));
625
- console.log(line ? line.trim() : `${LAUNCHD_LABEL}: not loaded`);
626
- }
627
- }
628
- }
629
-
630
- function serviceLogs() {
631
- const p = requireSupportedPlatform();
632
- if (p === "linux") {
633
- run("journalctl", ["--user", "-u", `${SERVICE_NAME}.service`, "-n", "100", "-f"]);
634
- } else {
635
- const outLog = path.join(logDir, "out.log");
636
- const errLog = path.join(logDir, "err.log");
637
- run("tail", ["-n", "100", "-f", outLog, errLog]);
638
- }
639
- }
640
-
641
- function serviceIsInstalled() {
642
- const p = platform();
643
- if (p === "linux") {
644
- return existsSync(path.join(os.homedir(), ".config", "systemd", "user", `${SERVICE_NAME}.service`));
645
- }
646
- if (p === "macos") {
647
- return existsSync(path.join(os.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`));
648
- }
649
- return false;
650
- }
651
-
652
- function serviceRestart() {
653
- const p = platform();
654
- if (p === "linux") {
655
- run("systemctl", ["--user", "restart", `${SERVICE_NAME}.service`]);
656
- } else if (p === "macos") {
657
- const plistPath = path.join(os.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
658
- runQuiet("launchctl", ["unload", plistPath]);
659
- run("launchctl", ["load", "-w", plistPath]);
660
- }
661
- }
662
-
663
- // ── update ────────────────────────────────────────────────────────────────
664
-
665
- function detectPackageManager() {
666
- // Prefer the manager whose global root contains this install.
667
- const ua = process.env.npm_config_user_agent ?? "";
668
- if (ua.startsWith("pnpm")) return "pnpm";
669
- if (ua.startsWith("yarn")) return "yarn";
670
- if (selfScript.includes(`${path.sep}pnpm${path.sep}`)) return "pnpm";
671
- return "npm";
672
- }
673
-
674
- function update() {
675
- const pkg = JSON.parse(readFileSync(path.join(appRoot, "package.json"), "utf8"));
676
- const name = pkg.name;
677
- console.log(`Current ${name}: v${pkg.version}`);
678
-
679
- const pm = detectPackageManager();
680
- const cmd = pm === "pnpm" ? ["pnpm", ["add", "-g", `${name}@latest`]]
681
- : pm === "yarn" ? ["yarn", ["global", "add", `${name}@latest`]]
682
- : ["npm", ["install", "-g", `${name}@latest`]];
683
-
684
- console.log(`Updating via ${pm}…`);
685
- try {
686
- run(cmd[0], cmd[1]);
687
- } catch {
688
- console.error(`Error: update failed. Try manually: ${cmd[0]} ${cmd[1].join(" ")}`);
689
- process.exit(1);
690
- }
691
-
692
- if (serviceIsInstalled()) {
693
- console.log("Restarting service…");
694
- try { serviceRestart(); console.log("Service restarted."); }
695
- catch { console.log("Note: could not restart service automatically. Run: wiki-viewer service restart"); }
696
- }
697
- console.log("Update complete.");
698
- }
699
-
700
- // ── interactive setup wizard ──────────────────────────────────────────────
701
-
702
- // Common app env vars worth offering during setup. Anything not listed can
703
- // still be added later with `wiki-viewer config set KEY=VALUE`.
704
- const WIZARD_ENV_VARS = [
705
- { key: "AUTH_ALLOWED_DOMAIN", hint: "Restrict signup to an email domain, e.g. example.com" },
706
- { key: "AUTH_ALLOWED_EMAILS", hint: "Restrict signup to specific emails (comma-separated)" },
707
- { key: "GOOGLE_CLIENT_ID", hint: "Google OAuth client ID (enables Google sign-in)" },
708
- { key: "GOOGLE_CLIENT_SECRET", hint: "Google OAuth client secret" },
709
- { key: "AUTH_DISABLE_PASSWORD", hint: "Set to 1 to allow Google sign-in only (requires Google keys)" },
710
- { key: "AUTH_TRUSTED_PROVIDERS", hint: "Auto-link these providers to existing accounts, e.g. google" },
711
- { key: "WIKI_OWNER_HOSTS", hint: "Extra hostnames trusted for the AI panel owner cookie" },
712
- { key: "AGENT_RATE_LIMIT", hint: "Per-minute agent API rate limit (default 60)" },
713
- ];
714
-
715
- // A prompt helper that survives piped (non-TTY) stdin. node:readline/promises
716
- // closes the stream between awaited questions when input is piped, so we buffer
717
- // every line via the 'line' event and hand them out one at a time instead.
718
- function makePrompter() {
719
- const rl = createInterface({ input: stdin, output: stdout });
720
- const queue = [];
721
- const waiters = [];
722
- let closed = false;
723
-
724
- rl.on("line", (line) => {
725
- if (waiters.length) waiters.shift()(line);
726
- else queue.push(line);
727
- });
728
- rl.on("close", () => {
729
- closed = true;
730
- while (waiters.length) waiters.shift()(null);
731
- });
732
-
733
- const nextLine = () =>
734
- new Promise((resolve) => {
735
- if (queue.length) resolve(queue.shift());
736
- else if (closed) resolve(null);
737
- else waiters.push(resolve);
738
- });
739
-
740
- const prompt = async (text) => {
741
- stdout.write(text);
742
- const line = await nextLine();
743
- return line == null ? "" : line;
744
- };
745
-
746
- return { prompt, close: () => rl.close() };
747
- }
748
-
749
- async function runWizard() {
750
- const io = makePrompter();
751
- const existing = loadConfig();
752
-
753
- const ask = async (label, def) => {
754
- const suffix = def ? ` [${def}]` : "";
755
- const answer = (await io.prompt(`${label}${suffix}: `)).trim();
756
- return answer || def || "";
757
- };
758
- const askYesNo = async (label, defYes) => {
759
- const def = defYes ? "Y/n" : "y/N";
760
- const answer = (await io.prompt(`${label} [${def}]: `)).trim().toLowerCase();
761
- if (!answer) return defYes;
762
- return answer === "y" || answer === "yes";
763
- };
764
-
765
- try {
766
- console.log("\nwiki-viewer setup\n");
767
- console.log("Answer a few questions. Press Enter to accept the [default].\n");
768
-
769
- // 1. directory
770
- const dirInput = await ask(
771
- "Directory to serve (blank = choose later in the browser)",
772
- existing.rootDir ?? process.cwd(),
773
- );
774
- const rootDir = dirInput ? path.resolve(dirInput) : null;
775
- if (rootDir && !existsSync(rootDir)) {
776
- console.log(` Note: ${rootDir} does not exist yet; it will be served once created.`);
777
- }
778
-
779
- // 2. host
780
- const host = await ask(
781
- "Host to bind (localhost for this machine only, 0.0.0.0 for the network)",
782
- existing.host ?? "localhost",
783
- );
784
-
785
- // 3. port
786
- const port = await ask("Port", String(existing.port ?? "3000"));
787
-
788
- // 4. https
789
- const httpsDefault = existing.https ?? (!isLocalHost(host) && host !== "0.0.0.0");
790
- const useHttps = await askYesNo(
791
- "Enable HTTPS? (recommended for any non-localhost access)",
792
- Boolean(httpsDefault),
793
- );
794
-
795
- // 5. app env vars
796
- const env = { ...(existing.env ?? {}) };
797
- const wantEnv = await askYesNo(
798
- "\nConfigure app settings now? (OAuth, signup allowlist, rate limit)",
799
- false,
800
- );
801
- if (wantEnv) {
802
- console.log("Leave blank to skip a setting.\n");
803
- for (const { key, hint } of WIZARD_ENV_VARS) {
804
- const cur = env[key];
805
- const val = await ask(` ${key} — ${hint}`, cur);
806
- if (val) env[key] = val;
807
- else delete env[key];
808
- }
809
- }
810
-
811
- // Build and preview the config.
812
- const cfg = {
813
- rootDir,
814
- host,
815
- port,
816
- https: useHttps,
817
- ...(Object.keys(env).length ? { env } : {}),
818
- };
819
-
820
- console.log("\nConfiguration:");
821
- console.log(` directory : ${rootDir ?? "(choose in browser)"}`);
822
- console.log(` host : ${host}`);
823
- console.log(` port : ${port}`);
824
- console.log(` https : ${useHttps}`);
825
- if (cfg.env) console.log(` app env : ${Object.keys(cfg.env).join(", ")}`);
826
-
827
- // Secure-context guidance before committing.
828
- const { warnings } = computeServerEnv({ host, port: String(port), useHttps, configEnv: cfg.env ?? {} });
829
- for (const w of warnings) console.log(`\n⚠️ ${w}`);
830
-
831
- // 6. what to do now
832
- console.log("");
833
- console.log("What next?");
834
- console.log(" 1) Install as a service (starts now and on every reboot)");
835
- console.log(" 2) Run once now (foreground)");
836
- console.log(" 3) Save config only");
837
- const choice = (await io.prompt("Choose [1/2/3]: ")).trim() || "1";
838
-
839
- saveConfig(cfg);
840
- console.log(`\nSaved ${configPath}`);
841
-
842
- io.close();
843
-
844
- if (choice === "1") {
845
- const p = platform();
846
- if (!p) {
847
- console.log("Service install is only supported on Linux and macOS.");
848
- console.log("Run it yourself with: wiki-viewer service run");
849
- return;
850
- }
851
- if (p === "linux") installSystemd();
852
- else installLaunchd();
853
- } else if (choice === "2") {
854
- start(resolveRunOptions([]));
855
- } else {
856
- console.log("\nStart it any time with:");
857
- console.log(" wiki-viewer service install # persistent service");
858
- console.log(" wiki-viewer service run # run from this config");
859
- }
860
- } finally {
861
- // io may already be closed; closing twice is a no-op.
862
- io.close();
863
- }
864
- }
865
-
866
- // ── dispatch ──────────────────────────────────────────────────────────────
867
-
868
- const argv = process.argv.slice(2);
869
-
870
- if (argv.includes("--help") || argv.includes("-h")) {
871
- printUsage();
872
- process.exit(0);
873
- }
874
-
875
- if (argv.includes("--version") || argv.includes("-v")) {
876
- const pkg = JSON.parse(readFileSync(path.join(appRoot, "package.json"), "utf8"));
877
- console.log(pkg.version);
878
- process.exit(0);
879
- }
880
-
881
- const [cmd, ...rest] = argv;
882
-
883
- switch (cmd) {
884
- case "service": {
885
- const [sub, ...subArgs] = rest;
886
- switch (sub) {
887
- case "install": serviceInstall(subArgs); break;
888
- case "uninstall": serviceUninstall(); break;
889
- case "status": serviceStatus(); break;
890
- case "logs": serviceLogs(); break;
891
- case "restart": serviceRestart(); break;
892
- case "run": start(resolveRunOptions(subArgs)); break;
893
- default:
894
- console.error(`Unknown service command: ${sub ?? "(none)"}`);
895
- console.error("Try: install | uninstall | status | logs | restart | run");
896
- process.exit(1);
897
- }
898
- break;
899
- }
900
- case "config":
901
- configCommand(rest);
902
- break;
903
- case "init":
904
- case "setup":
905
- runWizard();
906
- break;
907
- case "update":
908
- update();
909
- break;
910
- default:
911
- if (argv.includes("--setup") || argv.includes("--init")) {
912
- runWizard();
913
- break;
914
- }
915
- // No recognized command → ad-hoc serve (directory + flags only).
916
- // On a bare interactive run, point users at the guided setup first.
917
- if (argv.length === 0 && stdin.isTTY) {
918
- console.log("Tip: run `wiki-viewer init` for guided setup (directory, host/port, HTTPS,");
919
- console.log(" app settings, and optional install as a reboot-persistent service).\n");
920
- }
921
- start(resolveServeOptions(argv));
922
- }