wiki-viewer 1.14.1 → 1.14.2

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 (384) 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.html +1 -1
  11. package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  16. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/agent/internal/span/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/assets/[...path]/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/share/[token]/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/share/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/system/set-root/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/upload/[...path]/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/wiki/content/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/wiki/file/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js.nft.json +1 -1
  47. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/wiki/git-history/route.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/wiki/slugs/route.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/index.html +1 -1
  61. package/.next/standalone/.next/server/app/index.rsc +1 -1
  62. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  63. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  64. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  65. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  66. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  67. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  68. package/.next/standalone/.next/server/middleware-manifest.json +1 -1
  69. package/.next/standalone/.next/server/pages/404.html +1 -1
  70. package/.next/standalone/.next/server/pages/500.html +1 -1
  71. package/.next/standalone/package.json +1 -1
  72. package/bin/postbuild.js +21 -0
  73. package/package.json +1 -1
  74. package/.next/standalone/.github/workflows/publish.yml +0 -37
  75. package/.next/standalone/.handoffs/archive/handoff-20260612-113332.md +0 -98
  76. package/.next/standalone/.handoffs/archive/handoff-20260612-141032.md +0 -73
  77. package/.next/standalone/.pi/ownership.json +0 -3
  78. package/.next/standalone/AGENTS.md +0 -114
  79. package/.next/standalone/DESIGN.md +0 -521
  80. package/.next/standalone/README.md +0 -821
  81. package/.next/standalone/TODO.md +0 -20
  82. package/.next/standalone/agents/bootstrap-prompt.md +0 -14
  83. package/.next/standalone/agents/wiki-viewer-skill/SKILL.md +0 -456
  84. package/.next/standalone/bin/postbuild.js +0 -78
  85. package/.next/standalone/bin/wiki-viewer.js +0 -922
  86. package/.next/standalone/certificates/localhost-key.pem +0 -28
  87. package/.next/standalone/certificates/localhost.pem +0 -24
  88. package/.next/standalone/docs/agent-collab-plan.md +0 -1615
  89. package/.next/standalone/docs/agent-collab-v2-plan.md +0 -771
  90. package/.next/standalone/docs/agent-fs-plan.md +0 -232
  91. package/.next/standalone/docs/editorial-skin-spec.md +0 -242
  92. package/.next/standalone/docs/file-vs-collab-authority.md +0 -124
  93. package/.next/standalone/docs/mobile-readiness-spec.md +0 -229
  94. package/.next/standalone/docs/workspacing-plan.md +0 -364
  95. package/.next/standalone/packages/wiki-viewer-mcp/README.md +0 -195
  96. package/.next/standalone/packages/wiki-viewer-mcp/bench-e2e.mjs +0 -166
  97. package/.next/standalone/packages/wiki-viewer-mcp/bench-latency.mjs +0 -87
  98. package/.next/standalone/packages/wiki-viewer-mcp/bench-payload.mjs +0 -45
  99. package/.next/standalone/packages/wiki-viewer-mcp/dist/http-client.js +0 -331
  100. package/.next/standalone/packages/wiki-viewer-mcp/dist/index.js +0 -531
  101. package/.next/standalone/packages/wiki-viewer-mcp/dist/register.js +0 -94
  102. package/.next/standalone/packages/wiki-viewer-mcp/dist/state-cache.js +0 -28
  103. package/.next/standalone/packages/wiki-viewer-mcp/package-lock.json +0 -1716
  104. package/.next/standalone/packages/wiki-viewer-mcp/package.json +0 -41
  105. package/.next/standalone/packages/wiki-viewer-mcp/src/http-client.ts +0 -459
  106. package/.next/standalone/packages/wiki-viewer-mcp/src/index.ts +0 -638
  107. package/.next/standalone/packages/wiki-viewer-mcp/src/register.ts +0 -144
  108. package/.next/standalone/packages/wiki-viewer-mcp/src/state-cache.ts +0 -55
  109. package/.next/standalone/packages/wiki-viewer-mcp/tsconfig.json +0 -19
  110. package/.next/standalone/pnpm-lock.yaml +0 -6697
  111. package/.next/standalone/pnpm-workspace.yaml +0 -8
  112. package/.next/standalone/postcss.config.mjs +0 -2
  113. package/.next/standalone/src/app/api/agent/activity/route.ts +0 -59
  114. package/.next/standalone/src/app/api/agent/admin/agents/[agentId]/revoke/route.ts +0 -40
  115. package/.next/standalone/src/app/api/agent/admin/agents/route.ts +0 -33
  116. package/.next/standalone/src/app/api/agent/admin/registrations/[regId]/approve/route.ts +0 -83
  117. package/.next/standalone/src/app/api/agent/admin/registrations/[regId]/deny/route.ts +0 -36
  118. package/.next/standalone/src/app/api/agent/admin/registrations/route.ts +0 -27
  119. package/.next/standalone/src/app/api/agent/events/[...path]/route.ts +0 -148
  120. package/.next/standalone/src/app/api/agent/files/[...path]/route.ts +0 -219
  121. package/.next/standalone/src/app/api/agent/fs/file/[...path]/route.ts +0 -446
  122. package/.next/standalone/src/app/api/agent/fs/ls/[[...path]]/route.ts +0 -152
  123. package/.next/standalone/src/app/api/agent/fs/move/route.ts +0 -130
  124. package/.next/standalone/src/app/api/agent/fs/search/route.ts +0 -272
  125. package/.next/standalone/src/app/api/agent/internal/span/route.ts +0 -121
  126. package/.next/standalone/src/app/api/agent/register/[regId]/route.ts +0 -50
  127. package/.next/standalone/src/app/api/agent/register/route.ts +0 -118
  128. package/.next/standalone/src/app/api/agent/settings/route.ts +0 -34
  129. package/.next/standalone/src/app/api/agent/settings/token/regenerate/route.ts +0 -20
  130. package/.next/standalone/src/app/api/agent/sidecar/[...path]/route.ts +0 -53
  131. package/.next/standalone/src/app/api/agents/install/route.ts +0 -143
  132. package/.next/standalone/src/app/api/agents/skill/route.ts +0 -20
  133. package/.next/standalone/src/app/api/agents/skill.tar.gz/route.ts +0 -87
  134. package/.next/standalone/src/app/api/app-proxy/[...path]/route.ts +0 -247
  135. package/.next/standalone/src/app/api/assets/[...path]/route.ts +0 -75
  136. package/.next/standalone/src/app/api/auth/[...all]/route.ts +0 -7
  137. package/.next/standalone/src/app/api/owner/init/route.ts +0 -14
  138. package/.next/standalone/src/app/api/share/[token]/route.ts +0 -269
  139. package/.next/standalone/src/app/api/share/route.ts +0 -127
  140. package/.next/standalone/src/app/api/system/admins/route.ts +0 -103
  141. package/.next/standalone/src/app/api/system/auth-config/route.ts +0 -22
  142. package/.next/standalone/src/app/api/system/auth-settings/route.ts +0 -86
  143. package/.next/standalone/src/app/api/system/browse/route.ts +0 -82
  144. package/.next/standalone/src/app/api/system/clear-root/route.ts +0 -16
  145. package/.next/standalone/src/app/api/system/config/route.ts +0 -14
  146. package/.next/standalone/src/app/api/system/pins/route.ts +0 -38
  147. package/.next/standalone/src/app/api/system/reveal/route.ts +0 -36
  148. package/.next/standalone/src/app/api/system/root-status/route.ts +0 -13
  149. package/.next/standalone/src/app/api/system/set-root/route.ts +0 -53
  150. package/.next/standalone/src/app/api/system/users/route.ts +0 -120
  151. package/.next/standalone/src/app/api/system/workspaces/[id]/open/route.ts +0 -34
  152. package/.next/standalone/src/app/api/system/workspaces/[id]/refresh/route.ts +0 -32
  153. package/.next/standalone/src/app/api/system/workspaces/[id]/route.ts +0 -78
  154. package/.next/standalone/src/app/api/system/workspaces/route.ts +0 -128
  155. package/.next/standalone/src/app/api/upload/[...path]/route.ts +0 -85
  156. package/.next/standalone/src/app/api/wiki/app/route.ts +0 -60
  157. package/.next/standalone/src/app/api/wiki/backlinks/route.ts +0 -29
  158. package/.next/standalone/src/app/api/wiki/content/route.ts +0 -159
  159. package/.next/standalone/src/app/api/wiki/download/route.ts +0 -100
  160. package/.next/standalone/src/app/api/wiki/file/route.ts +0 -57
  161. package/.next/standalone/src/app/api/wiki/folder/route.ts +0 -34
  162. package/.next/standalone/src/app/api/wiki/git-branches/route.ts +0 -32
  163. package/.next/standalone/src/app/api/wiki/git-checkout/route.ts +0 -45
  164. package/.next/standalone/src/app/api/wiki/git-diff/route.ts +0 -33
  165. package/.next/standalone/src/app/api/wiki/git-file-info/route.ts +0 -27
  166. package/.next/standalone/src/app/api/wiki/git-history/route.ts +0 -27
  167. package/.next/standalone/src/app/api/wiki/git-pull/route.ts +0 -48
  168. package/.next/standalone/src/app/api/wiki/move/route.ts +0 -61
  169. package/.next/standalone/src/app/api/wiki/new-file/route.ts +0 -56
  170. package/.next/standalone/src/app/api/wiki/outlinks/route.ts +0 -76
  171. package/.next/standalone/src/app/api/wiki/page/route.ts +0 -92
  172. package/.next/standalone/src/app/api/wiki/presence/route.ts +0 -56
  173. package/.next/standalone/src/app/api/wiki/route.ts +0 -116
  174. package/.next/standalone/src/app/api/wiki/search/route.ts +0 -44
  175. package/.next/standalone/src/app/api/wiki/slugs/route.ts +0 -54
  176. package/.next/standalone/src/app/api/wiki/upload/route.ts +0 -95
  177. package/.next/standalone/src/app/api/wiki/watch/route.ts +0 -67
  178. package/.next/standalone/src/app/globals.css +0 -1249
  179. package/.next/standalone/src/app/icon.svg +0 -11
  180. package/.next/standalone/src/app/layout.tsx +0 -78
  181. package/.next/standalone/src/app/manifest.ts +0 -30
  182. package/.next/standalone/src/app/page.tsx +0 -3260
  183. package/.next/standalone/src/app/s/[token]/page.tsx +0 -357
  184. package/.next/standalone/src/app/signin/page.tsx +0 -16
  185. package/.next/standalone/src/app/signin/signin-form.tsx +0 -238
  186. package/.next/standalone/src/components/ai-panel/activity-row.tsx +0 -284
  187. package/.next/standalone/src/components/ai-panel/ai-panel.tsx +0 -311
  188. package/.next/standalone/src/components/ai-panel/token-section.tsx +0 -313
  189. package/.next/standalone/src/components/auth-settings-sheet.tsx +0 -474
  190. package/.next/standalone/src/components/confirm-dialog.tsx +0 -56
  191. package/.next/standalone/src/components/dir-picker.tsx +0 -606
  192. package/.next/standalone/src/components/editor/backlinks-panel.tsx +0 -139
  193. package/.next/standalone/src/components/editor/bubble-menu.tsx +0 -346
  194. package/.next/standalone/src/components/editor/callout-extension.ts +0 -36
  195. package/.next/standalone/src/components/editor/comment-pip.tsx +0 -56
  196. package/.next/standalone/src/components/editor/comment-thread.tsx +0 -254
  197. package/.next/standalone/src/components/editor/csv-viewer.tsx +0 -379
  198. package/.next/standalone/src/components/editor/document-outline.tsx +0 -230
  199. package/.next/standalone/src/components/editor/editor-toolbar.tsx +0 -564
  200. package/.next/standalone/src/components/editor/editor.tsx +0 -1327
  201. package/.next/standalone/src/components/editor/extensions/drag-handle.ts +0 -325
  202. package/.next/standalone/src/components/editor/extensions/heading-anchors.ts +0 -55
  203. package/.next/standalone/src/components/editor/extensions/proof-span.ts +0 -60
  204. package/.next/standalone/src/components/editor/extensions/resizable-image.tsx +0 -159
  205. package/.next/standalone/src/components/editor/extensions.ts +0 -150
  206. package/.next/standalone/src/components/editor/file-fallback-viewer.tsx +0 -75
  207. package/.next/standalone/src/components/editor/folder-index.tsx +0 -236
  208. package/.next/standalone/src/components/editor/google-doc-viewer.tsx +0 -73
  209. package/.next/standalone/src/components/editor/image-viewer.tsx +0 -57
  210. package/.next/standalone/src/components/editor/large-file-gate.tsx +0 -108
  211. package/.next/standalone/src/components/editor/link-popover.tsx +0 -111
  212. package/.next/standalone/src/components/editor/media-popover.tsx +0 -212
  213. package/.next/standalone/src/components/editor/media-viewer.tsx +0 -70
  214. package/.next/standalone/src/components/editor/mermaid-viewer.tsx +0 -286
  215. package/.next/standalone/src/components/editor/node-app-viewer.tsx +0 -328
  216. package/.next/standalone/src/components/editor/notebook-viewer.tsx +0 -371
  217. package/.next/standalone/src/components/editor/office/docx-viewer.tsx +0 -93
  218. package/.next/standalone/src/components/editor/office/office-chrome.tsx +0 -83
  219. package/.next/standalone/src/components/editor/office/pptx-viewer.tsx +0 -104
  220. package/.next/standalone/src/components/editor/office/xlsx-viewer.tsx +0 -192
  221. package/.next/standalone/src/components/editor/pdf-viewer.tsx +0 -32
  222. package/.next/standalone/src/components/editor/proof-span-popover.tsx +0 -162
  223. package/.next/standalone/src/components/editor/slash-commands.tsx +0 -629
  224. package/.next/standalone/src/components/editor/source-viewer.tsx +0 -289
  225. package/.next/standalone/src/components/editor/suggest-edit-popover.tsx +0 -229
  226. package/.next/standalone/src/components/editor/suggestion-card.tsx +0 -206
  227. package/.next/standalone/src/components/editor/table-menu.tsx +0 -232
  228. package/.next/standalone/src/components/editor/view-mode-comment-button.tsx +0 -77
  229. package/.next/standalone/src/components/editor/website-viewer.tsx +0 -75
  230. package/.next/standalone/src/components/editor/wiki-link-create-dialog.tsx +0 -189
  231. package/.next/standalone/src/components/editor/wiki-link-decorator.ts +0 -79
  232. package/.next/standalone/src/components/editor/wiki-link-extension.ts +0 -120
  233. package/.next/standalone/src/components/editor/wiki-link-picker.tsx +0 -250
  234. package/.next/standalone/src/components/layout/viewer-toolbar.tsx +0 -54
  235. package/.next/standalone/src/components/search/search-command-dialog.tsx +0 -246
  236. package/.next/standalone/src/components/search/sidebar-search-box.tsx +0 -121
  237. package/.next/standalone/src/components/search/snippet-text.tsx +0 -48
  238. package/.next/standalone/src/components/share-dialog.tsx +0 -307
  239. package/.next/standalone/src/components/theme-provider.tsx +0 -16
  240. package/.next/standalone/src/components/theme-toggle.tsx +0 -24
  241. package/.next/standalone/src/components/ui/badge.tsx +0 -35
  242. package/.next/standalone/src/components/ui/button.tsx +0 -56
  243. package/.next/standalone/src/components/ui/card.tsx +0 -63
  244. package/.next/standalone/src/components/ui/collapsible.tsx +0 -9
  245. package/.next/standalone/src/components/ui/command.tsx +0 -151
  246. package/.next/standalone/src/components/ui/context-menu.tsx +0 -191
  247. package/.next/standalone/src/components/ui/dialog.tsx +0 -119
  248. package/.next/standalone/src/components/ui/dropdown-menu.tsx +0 -194
  249. package/.next/standalone/src/components/ui/input.tsx +0 -22
  250. package/.next/standalone/src/components/ui/label.tsx +0 -25
  251. package/.next/standalone/src/components/ui/popover.tsx +0 -33
  252. package/.next/standalone/src/components/ui/scroll-area.tsx +0 -47
  253. package/.next/standalone/src/components/ui/select.tsx +0 -156
  254. package/.next/standalone/src/components/ui/separator.tsx +0 -30
  255. package/.next/standalone/src/components/ui/sheet.tsx +0 -140
  256. package/.next/standalone/src/components/ui/skeleton.tsx +0 -15
  257. package/.next/standalone/src/components/ui/switch.tsx +0 -28
  258. package/.next/standalone/src/components/ui/tabs.tsx +0 -54
  259. package/.next/standalone/src/components/ui/textarea.tsx +0 -21
  260. package/.next/standalone/src/components/ui/tip.tsx +0 -23
  261. package/.next/standalone/src/components/ui/toggle-group.tsx +0 -41
  262. package/.next/standalone/src/components/ui/tooltip.tsx +0 -27
  263. package/.next/standalone/src/components/view-width-toggle.tsx +0 -70
  264. package/.next/standalone/src/components/wiki/frontmatter-header.tsx +0 -164
  265. package/.next/standalone/src/hooks/use-is-mobile.ts +0 -14
  266. package/.next/standalone/src/lib/app-runner.ts +0 -272
  267. package/.next/standalone/src/lib/auth/admin.ts +0 -120
  268. package/.next/standalone/src/lib/auth/allowlist.ts +0 -50
  269. package/.next/standalone/src/lib/auth/client.ts +0 -4
  270. package/.next/standalone/src/lib/auth/csrf.ts +0 -68
  271. package/.next/standalone/src/lib/auth/server.ts +0 -215
  272. package/.next/standalone/src/lib/cabinets/tree.ts +0 -75
  273. package/.next/standalone/src/lib/config.ts +0 -114
  274. package/.next/standalone/src/lib/embeds/detect.ts +0 -142
  275. package/.next/standalone/src/lib/git-secrets.ts +0 -65
  276. package/.next/standalone/src/lib/git.ts +0 -503
  277. package/.next/standalone/src/lib/google/detect.ts +0 -107
  278. package/.next/standalone/src/lib/markdown/parse-frontmatter.ts +0 -104
  279. package/.next/standalone/src/lib/markdown/remark-wikilinks.ts +0 -100
  280. package/.next/standalone/src/lib/markdown/sanitize-schema.ts +0 -106
  281. package/.next/standalone/src/lib/markdown/to-html.ts +0 -282
  282. package/.next/standalone/src/lib/markdown/to-markdown.ts +0 -252
  283. package/.next/standalone/src/lib/proof/activity-shared.ts +0 -31
  284. package/.next/standalone/src/lib/proof/activity.ts +0 -74
  285. package/.next/standalone/src/lib/proof/audit.ts +0 -88
  286. package/.next/standalone/src/lib/proof/auth.ts +0 -143
  287. package/.next/standalone/src/lib/proof/block-refs.ts +0 -133
  288. package/.next/standalone/src/lib/proof/blocks.ts +0 -73
  289. package/.next/standalone/src/lib/proof/client-auth.ts +0 -23
  290. package/.next/standalone/src/lib/proof/collab-state.ts +0 -81
  291. package/.next/standalone/src/lib/proof/event-bus.ts +0 -47
  292. package/.next/standalone/src/lib/proof/file-lock.ts +0 -43
  293. package/.next/standalone/src/lib/proof/glob.ts +0 -51
  294. package/.next/standalone/src/lib/proof/idempotency.ts +0 -37
  295. package/.next/standalone/src/lib/proof/lease.ts +0 -117
  296. package/.next/standalone/src/lib/proof/mutex.ts +0 -36
  297. package/.next/standalone/src/lib/proof/ops-applier.ts +0 -727
  298. package/.next/standalone/src/lib/proof/owner-auth.ts +0 -2
  299. package/.next/standalone/src/lib/proof/pending.ts +0 -97
  300. package/.next/standalone/src/lib/proof/proof-span.ts +0 -141
  301. package/.next/standalone/src/lib/proof/rate-limit.ts +0 -53
  302. package/.next/standalone/src/lib/proof/raw-fs.ts +0 -197
  303. package/.next/standalone/src/lib/proof/register-rate-limit.ts +0 -53
  304. package/.next/standalone/src/lib/proof/registry.ts +0 -195
  305. package/.next/standalone/src/lib/proof/sidecar.ts +0 -103
  306. package/.next/standalone/src/lib/proof/suggest-capture.ts +0 -69
  307. package/.next/standalone/src/lib/proof/types.ts +0 -182
  308. package/.next/standalone/src/lib/proof-config.ts +0 -14
  309. package/.next/standalone/src/lib/root-dir.ts +0 -35
  310. package/.next/standalone/src/lib/search/indexable-exts.ts +0 -25
  311. package/.next/standalone/src/lib/search/indexer.ts +0 -634
  312. package/.next/standalone/src/lib/search/sanitize.ts +0 -35
  313. package/.next/standalone/src/lib/search/search-db.ts +0 -57
  314. package/.next/standalone/src/lib/search/watcher-pool.ts +0 -79
  315. package/.next/standalone/src/lib/shared-docs/db.ts +0 -177
  316. package/.next/standalone/src/lib/toast.ts +0 -9
  317. package/.next/standalone/src/lib/utils.ts +0 -6
  318. package/.next/standalone/src/lib/wiki-helpers.ts +0 -36
  319. package/.next/standalone/src/lib/workspace-client.ts +0 -82
  320. package/.next/standalone/src/lib/workspace-context.ts +0 -173
  321. package/.next/standalone/src/lib/workspaces.ts +0 -400
  322. package/.next/standalone/src/middleware.ts +0 -44
  323. package/.next/standalone/src/stores/ai-panel-store.ts +0 -79
  324. package/.next/standalone/src/stores/editor-store.ts +0 -439
  325. package/.next/standalone/src/stores/pin-store.ts +0 -56
  326. package/.next/standalone/src/stores/proof-store.ts +0 -124
  327. package/.next/standalone/src/stores/recent-store.ts +0 -51
  328. package/.next/standalone/src/stores/search-store.ts +0 -104
  329. package/.next/standalone/src/stores/show-hidden-store.ts +0 -26
  330. package/.next/standalone/src/stores/sidebar-width-store.ts +0 -39
  331. package/.next/standalone/src/stores/skin-store.ts +0 -42
  332. package/.next/standalone/src/stores/tree-store.ts +0 -52
  333. package/.next/standalone/src/stores/view-width-store.ts +0 -101
  334. package/.next/standalone/src/stores/wiki-slugs-store.ts +0 -75
  335. package/.next/standalone/src/tests/proof/activity-aggregator.test.ts +0 -146
  336. package/.next/standalone/src/tests/proof/admin-create-user.test.ts +0 -43
  337. package/.next/standalone/src/tests/proof/agent-fs.test.ts +0 -973
  338. package/.next/standalone/src/tests/proof/agent-ownership.test.ts +0 -140
  339. package/.next/standalone/src/tests/proof/agent-workspace-scope.test.ts +0 -134
  340. package/.next/standalone/src/tests/proof/agents-install.test.ts +0 -110
  341. package/.next/standalone/src/tests/proof/bench-write.ts +0 -179
  342. package/.next/standalone/src/tests/proof/better-auth.test.ts +0 -68
  343. package/.next/standalone/src/tests/proof/block-refs.test.ts +0 -108
  344. package/.next/standalone/src/tests/proof/blocks.test.ts +0 -92
  345. package/.next/standalone/src/tests/proof/collab-state.test.ts +0 -501
  346. package/.next/standalone/src/tests/proof/comments-ops.test.ts +0 -177
  347. package/.next/standalone/src/tests/proof/editor-roundtrip.test.ts +0 -85
  348. package/.next/standalone/src/tests/proof/external-edit.test.ts +0 -58
  349. package/.next/standalone/src/tests/proof/file-lock.test.ts +0 -80
  350. package/.next/standalone/src/tests/proof/git-branches-checkout.test.ts +0 -136
  351. package/.next/standalone/src/tests/proof/git-read-features.test.ts +0 -473
  352. package/.next/standalone/src/tests/proof/git-secrets.test.ts +0 -138
  353. package/.next/standalone/src/tests/proof/git-sparse.test.ts +0 -257
  354. package/.next/standalone/src/tests/proof/git-workspace.test.ts +0 -135
  355. package/.next/standalone/src/tests/proof/git.test.ts +0 -243
  356. package/.next/standalone/src/tests/proof/glob.test.ts +0 -82
  357. package/.next/standalone/src/tests/proof/helpers/auth-session.ts +0 -27
  358. package/.next/standalone/src/tests/proof/markdown-to-html.test.ts +0 -46
  359. package/.next/standalone/src/tests/proof/ops-applier.test.ts +0 -368
  360. package/.next/standalone/src/tests/proof/owner-init.test.ts +0 -2
  361. package/.next/standalone/src/tests/proof/parse-frontmatter.test.ts +0 -60
  362. package/.next/standalone/src/tests/proof/preload.ts +0 -21
  363. package/.next/standalone/src/tests/proof/proof-span.test.ts +0 -98
  364. package/.next/standalone/src/tests/proof/rate-limit.test.ts +0 -54
  365. package/.next/standalone/src/tests/proof/readonly-enforcement.test.ts +0 -161
  366. package/.next/standalone/src/tests/proof/reconcile-sidecar.test.ts +0 -195
  367. package/.next/standalone/src/tests/proof/registration-flow.test.ts +0 -330
  368. package/.next/standalone/src/tests/proof/registry.test.ts +0 -169
  369. package/.next/standalone/src/tests/proof/routes.test.ts +0 -516
  370. package/.next/standalone/src/tests/proof/search-index.test.ts +0 -376
  371. package/.next/standalone/src/tests/proof/sidecar-lifecycle.test.ts +0 -177
  372. package/.next/standalone/src/tests/proof/sidecar-trim.test.ts +0 -58
  373. package/.next/standalone/src/tests/proof/suggestion-ops.test.ts +0 -280
  374. package/.next/standalone/src/tests/proof/wiki-content-put.test.ts +0 -140
  375. package/.next/standalone/src/tests/proof/wiki-routes-auth.test.ts +0 -208
  376. package/.next/standalone/src/tests/proof/workspace-isolation.test.ts +0 -87
  377. package/.next/standalone/src/tests/proof/workspaces-api.test.ts +0 -227
  378. package/.next/standalone/src/types/index.ts +0 -47
  379. package/.next/standalone/tailwind.config.ts +0 -191
  380. package/.next/standalone/tsconfig.json +0 -41
  381. package/.next/standalone/tsconfig.tsbuildinfo +0 -1
  382. /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → rRyvFORvJoc5OWbCR2A_P}/_buildManifest.js +0 -0
  383. /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → rRyvFORvJoc5OWbCR2A_P}/_clientMiddlewareManifest.js +0 -0
  384. /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → rRyvFORvJoc5OWbCR2A_P}/_ssgManifest.js +0 -0
@@ -1,98 +0,0 @@
1
- # Handoff: Git-backed read-only workspaces (feature complete + perf optimization shipped)
2
-
3
- - **Written:** 2026-06-12 11:33:32 UTC
4
- - **From session:** unknown (pi agent, not Claude Code CLI; no .jsonl pointer)
5
- - **Working dir:** /home/sil/wiki-viewer
6
- - **Resume raw transcript (fallback only):** n/a (pi session, no --resume id captured)
7
-
8
- ## Goal
9
-
10
- Let teams browse docs that live in a remote git repo (GitHub/GitLab/Bitbucket/Gitea/GHE)
11
- with the full wiki-viewer UI, instead of reading raw files on the host. Scope was locked
12
- early: **read-only**, **private repos via HTTPS PAT**, **manual refresh** (no webhook/cron).
13
- "Done" = admin pastes a repo URL, server clones it, it shows up as a normal workspace that
14
- is read-only, with a Refresh button. Plus a perf path for repos whose docs sit in a subdir.
15
-
16
- This work is **shipped and complete**. Both commits pushed to origin/main. There is no
17
- pending task. This handoff exists to orient a fresh agent if the feature is extended.
18
-
19
- ## Current state
20
-
21
- DONE and pushed. Two commits on `main`:
22
-
23
- - `750f1e6` feat: git-backed read-only workspaces (backend spine + UI + tests)
24
- - `52edf40` perf(git): optional subpath via sparse checkout
25
-
26
- Working tree clean. `pnpm test` = 371 pass / 0 fail. `pnpm exec tsc --noEmit` clean.
27
- `pnpm build` succeeds (only the unrelated Better Auth base-URL warning, expected without env).
28
-
29
- What works end-to-end:
30
-
31
- - Add a git workspace via the directory picker "From Git" tab (URL, branch, subdir, username, token, name).
32
- - Server clones to `~/.wiki-viewer/repos/<wsId>/`, registers a `readOnly: true` workspace.
33
- - Optional subdir does a blobless partial clone + cone sparse-checkout; rootDir points at the subdir.
34
- - Every fs-mutating route rejects writes on a read-only workspace with 403 WORKSPACE_READ_ONLY.
35
- - Manual Refresh button in the switcher runs `git pull --ff-only`, shows synced time + last error.
36
- - PAT stored 0600 in `~/.wiki-viewer/git-secrets.json`, never in config.json, never logged, never in any API response.
37
-
38
- Nothing is half-built or untested in this feature.
39
-
40
- ## Next action (do this first)
41
-
42
- Nothing pending. If asked to extend, the most likely next features (all explicitly deferred,
43
- not bugs) are listed under "Open questions". Start by reading the two key lib files below to
44
- rebuild the mental model, then `pnpm test` to confirm green baseline before any change.
45
-
46
- ## Then
47
-
48
- Only if extending. Each item is a fresh mini-feature, use `/feature`:
49
-
50
- 1. Config UI for `git.allowedHosts` / `git.allowInsecureHttp` (currently config.json only, no UI). Verify: admin can restrict clone hosts from settings.
51
- 2. Write-back (commit + push or PR flow). This is the big scope cliff deliberately not built. Would require lifting read-only on a write path + conflict/precondition handling. Verify: edit in a git workspace reaches upstream.
52
- 3. Auto-refresh (webhook or cron). Deferred by design; manual-only shipped. Verify: clone updates without a manual click.
53
-
54
- ## Key files
55
-
56
- - `src/lib/git.ts` — git binary wrapper. `cloneRepo` (askpass auth so token never in argv/.git/config), `validateRemoteUrl` (https-only scheme gate + host allowlist + metachar reject), `validateSubpath`, `pullRepo` (ff-only), `headSha`, `currentBranch`, `assertGitAvailable`. Clone args: whole-repo `["clone","--depth","1","--single-branch","--no-tags",url,dest]`; subpath adds `--filter=blob:none --sparse` then `sparse-checkout set --cone <subpath>`.
57
- - `src/lib/git-secrets.ts` — PAT store, 0600 file, genTokenRef/setToken/getToken/deleteToken. Frozen, do not modify.
58
- - `src/lib/workspaces.ts` — `Workspace.readOnly` + `git{remoteUrl,branch,tokenRef,username,subpath,cloneRoot,lastPulledAt,lastSha,lastError}`. `createGitWorkspace`, `refreshGitWorkspace`, `removeWorkspace` (deletes cloneRoot, path.relative guard), `sanitizeWorkspace` (strips tokenRef from all responses).
59
- - `src/lib/workspace-context.ts` — `resolveWorkspaceForUser/Agent(req, intent)`. `intent:"write"` + `ws.readOnly` → 403 WORKSPACE_READ_ONLY. This is the single read-only chokepoint; every write route passes "write".
60
- - `src/lib/config.ts` — `reposDir()`, `WorkspaceGitEntry` (mirror of WorkspaceGit), `git.allowedHosts`/`git.allowInsecureHttp` config keys.
61
- - `src/app/api/system/workspaces/route.ts` — POST branches to createGitWorkspace when body.remoteUrl present; masks tokenRef.
62
- - `src/app/api/system/workspaces/[id]/refresh/route.ts` — admin+CSRF, calls refreshGitWorkspace.
63
- - `src/components/dir-picker.tsx` — "Local folder" / "From Git" mode toggle + the From Git form.
64
- - `src/app/page.tsx` — workspace switcher: read-only badge, Refresh button (handleRefreshWorkspace ~line 862, switcher render ~line 2015), timeAgo helper (~line 107).
65
- - `src/tests/proof/git.test.ts`, `git-secrets.test.ts`, `git-workspace.test.ts`, `readonly-enforcement.test.ts`, `git-sparse.test.ts` — full coverage.
66
-
67
- ## Decisions & rationale
68
-
69
- - **Full clone, not API/lazy fetch.** Keeps reads as native fs (fast) and viewer/search/agent paths unchanged + provider-agnostic. API-based reads would be per-host and slow. See the read-perf discussion in session.
70
- - **Read-only is a policy, not a tech limit.** The clone is a writable dir, but edits there would be silently lost on `git pull --ff-only` (divergence) and never reach upstream. Read-only protects the user from edits with nowhere to go. Lift it only when write-back exists.
71
- - **Subpath uses sparse cone + blobless,** the only change that improves setup time without sacrificing read perf. `rootDir = cloneRoot/subpath` so `.git` sits outside rootDir (cleaner isolation). `cloneRoot` stored separately so refresh/remove target the real clone, not the subdir.
72
- - **Generalized beyond GitHub** because read-only clone+pull is provider-agnostic; only auth differs and HTTPS-token auth is uniform. Cheap to support all hosts.
73
- - **`--no-tags` on whole-repo, blobless only on subpath.** Depth-1 already fetches only tip blobs, so blobless adds negotiation cost for no gain on a full clone.
74
-
75
- ## Gotchas & landmines
76
-
77
- - **`.git/` is already excluded** in indexer (SKIP_DIRS), fs/ls (SKIP_NAMES), and raw-fs (isDeniedRelPath). Do NOT re-add exclusions; subpath clones keep .git outside rootDir anyway.
78
- - **Local-protocol clones (`file://` or local path) IGNORE `--filter`** (git prints "filtering not recognized by server, ignoring"). Tests use local fixtures so they assert END STATE (only subpath files in rootDir), not transfer savings. Real https hosts get the blobless benefit.
79
- - **`agent-workspace-scope.test.ts` has a pre-existing flaky teardown race** (async agents.json write lands after the test's `rm`, ENOENT unhandledRejection). NOT caused by this feature; surfaced once under parallel load, then passed consistently. If the full suite flakes on exactly that file, it is this known race, not the git code.
80
- - **Symlink subpath attack is blocked twice:** git's `sparse-checkout set --cone` refuses a non-directory, AND createGitWorkspace does lstat + realpath-under-cloneRoot. Test `git-sparse.test.ts` covers it. The error message can be either "not a directory" (git) or "not found" (our guard) so the test regex accepts both.
81
- - **removeWorkspace delete guard** uses `path.relative(managed, cloneDir)` not raw `startsWith`, to stop a tampered config cloneRoot from deleting outside reposDir. Keep that if you touch cleanup.
82
- - **pnpm only.** `kysely` pinned 0.28.5 via overrides, do not bump. No em-dashes in any copy/comments (user rule). No AI attribution in commits.
83
- - Tests run from repo root: `pnpm exec tsx --import ./src/tests/proof/preload.ts --test src/tests/proof/<name>.test.ts`. preload.ts overrides HOME to a temp dir so tests never touch real ~/.wiki-viewer.
84
-
85
- ## Open questions / waiting on
86
-
87
- None blocking. Deferred-by-design (not bugs): write-back/push, auto-refresh (webhook/cron),
88
- GHE-host config UI. All would be net-new features needing `/feature`, not continuations.
89
-
90
- ## Mental model
91
-
92
- A git-backed workspace IS a normal workspace whose `rootDir` happens to be a server-managed
93
- clone. That single insight is why the feature is small: the entire read path (browser, editor
94
- view, search, agent reads) is untouched, because it just sees files on disk. Only two things
95
- are new: the clone/pull/secret orchestration (lib/git\*.ts + createGitWorkspace), and a
96
- read-only write gate centralized in one place (workspace-context resolver `intent` param).
97
- Everything else is wiring. When extending, ask "is this a read concern (already works) or a
98
- write concern (must go through the read-only gate)?" before touching anything.
@@ -1,73 +0,0 @@
1
- # Handoff: Sub-folder git repo detection + branch badge + pull refresh
2
-
3
- - **Written:** 2026-06-12 14:10:32 UTC
4
- - **From session:** unknown (Pi agent, not Claude Code CLI)
5
- - **Working dir:** /home/sil/wiki-viewer
6
- - **Resume raw transcript (fallback only):** n/a (Pi session, no --resume id captured)
7
-
8
- ## Goal
9
-
10
- Let users see git status for sub-folder git repos inside a normal workspace. When expanding a directory in the file tree sidebar, auto-detect any subdirectory that is a git repo root, show branch name + dirty indicator as an inline badge next to the folder name, and provide a pull-to-refresh button.
11
-
12
- "Done" = expand a folder in the sidebar, see `main` or `master` next to repo folders, click the refresh icon and see it pull latest + reload tree.
13
-
14
- ## Current state
15
-
16
- Shipped and committed at `310cb72`. Working tree clean. `pnpm test` = 371 pass / 0 fail. `pnpm exec tsc --noEmit` clean.
17
-
18
- What works end-to-end:
19
-
20
- - `GET /api/wiki?dir=...` returns `git: {branch, dirty}` for each subdirectory that is a git repo root.
21
- - File tree sidebar shows `GitBranch icon branch [* if dirty] [↩ button]` inline.
22
- - Clicking ↩ calls `POST /api/wiki/git-pull` with `{path}`, runs `git pull --ff-only`, shows toast on success/fail, refreshes parent listing.
23
- - Reuses `detectGitRepo` in both listing and pull endpoint for consistent validation.
24
- - Pull endpoint uses `resolveWorkspaceForUser(request, "write")` — blocked on read-only workspaces.
25
- - Node-app entries also get git detection (review fix).
26
- - Follows existing patterns: CSRF, safeWorkspacePath, wsFetch, showError/showSuccess.
27
-
28
- ## Next action (do this first)
29
-
30
- Nothing pending. If asked to extend, read the four changed files below to rebuild mental model, then `pnpm test` to confirm green baseline.
31
-
32
- ## Then
33
-
34
- Possible extensions (all net-new, not continuations):
35
-
36
- 1. **`.gitignore`-aware file listing** — hide ignored files from the tree. Requires running `git ls-files` in the sub-repo and filtering against `fetchDir` results.
37
- 2. **Modification badges in tree** — `M`/`?`/`D` next to files when inside a detected git repo. Requires `git status --porcelain` on the sub-repo.
38
- 3. **Git log / history panel** — show recent commits when clicking the branch badge.
39
- 4. **Write-back (commit + push)** — big scope cliff. Would lift read-only and add commit UI.
40
-
41
- ## Key files
42
-
43
- - `src/lib/git.ts` — added `detectGitRepo(dirPath)` at end of file. Returns `{branch, dirty}` or `null`. Uses `stat(.git)` then `rev-parse --show-toplevel` to confirm repo root, then `currentBranch()` + `status --porcelain`. Also added `GitRepoInfo` interface.
44
- - `src/app/api/wiki/route.ts` — GET handler extended to call `detectGitRepo` for each directory entry. Also restructured to apply git detection uniformly for all directory types (dir, app, node-app).
45
- - `src/app/api/wiki/git-pull/route.ts` — NEW file, POST endpoint. CSRF-protected, uses `resolveWorkspaceForUser(request, "write")`, validates path via `safeWorkspacePath`, reuses `detectGitRepo` for repo validation, runs `pullRepo` then returns `{branch, sha}`.
46
- - `src/app/page.tsx` — `TreeNode.git?` field; `fetchDir` passes through git from API; `pullingRepo` state + `handleGitPull` callback (after reloadDir definition); git badge + refresh button in `renderNodes` between node name and agent presence dot.
47
-
48
- ## Decisions & rationale
49
-
50
- - **Auto-detect, not opt-in.** Scanning for `.git` on directory expand is cheap (one stat per subdirectory). Extra git commands only run for directories WITH `.git`. Zero config burden.
51
- - **Inline badge in tree row**, not status bar or tooltip. Always visible, no extra clicks. Same pattern as VSCode explorer.
52
- - **Reuse `detectGitRepo` in pull endpoint.** Ensures same validation (toplevel check, not just `.git` existence) prevents pulling on non-root repos or submodules.
53
- - **Pull on read-only workspaces blocked.** `resolveWorkspaceForUser(request, "write")` in git-pull endpoint prevents mutating a read-only git-backed workspace by pulling inside it.
54
- - **Node-app entries included.** Review flagged the early-return gap; restructured to detect git before type-specific branching. Node-app folders that are also git repos get the badge.
55
- - **Parent directory reloaded after pull.** Simpler and more accurate than trying to predict new dirty state.
56
- - **No rate limiting.** Frontend guard prevents concurrent pulls per path. Server-side throttle deferred until abuse surfaces.
57
-
58
- ## Gotchas & landmines
59
-
60
- - **`reloadDir` defined before `handleGitPull`** in page.tsx. The callback depends on `reloadDir` being declared first. If you move callbacks around, keep this ordering.
61
- - **Submodules**: `.git` is a file (not dir) in submodule checkouts. `detectGitRepo` handles this because `stat()` works on both files and dirs. The `rev-parse --show-toplevel` check also handles this correctly.
62
- - **Symlink `.git`**: `stat` follows symlinks by default, so detection works. But `rev-parse --show-toplevel` resolves realpath, so comparison against symlinked dirPath would fail. This is acceptable — symlinked `.git` pointing outside the workspace is an unusual case.
63
- - **Nested git repos**: If a git repo has submodules, the submodule dirs are git repos too but `rev-parse --show-toplevel` returns the submodule root, not the superproject root. They each get their own badge, which is correct.
64
- - **pnpm only.** `kysely` pinned 0.28.5 via overrides, do not bump. No em-dashes in copy/comments (user rule). No AI attribution in commits.
65
- - **Tests run from repo root.** `pnpm exec tsx --import ./src/tests/proof/preload.ts --test src/tests/proof/<name>.test.ts`. preload.ts overrides HOME to temp dir.
66
-
67
- ## Open questions / waiting on
68
-
69
- None. Feature is complete and committed.
70
-
71
- ## Mental model
72
-
73
- A sub-folder git repo inside a workspace is just a normal directory with a `.git` file/dir. The whole feature is three layers: (1) detection — one stat + a couple git commands per directory on expand, (2) display — branch badge inline in the existing tree row, (3) refresh — pull endpoint reusing existing `pullRepo` from the git-backed workspace feature. The detection and pull share the same validation helper. No new auth concepts, no new workspace types, no new state management patterns. When extending, focus on "is this a read concern (already works) or a write concern (must gate through workspace read-only policy)?"
@@ -1,3 +0,0 @@
1
- {
2
- "claims": []
3
- }
@@ -1,114 +0,0 @@
1
- # AGENTS.md
2
-
3
- Context for AI agents working in the **wiki-viewer** codebase.
4
-
5
- ## What this is
6
-
7
- Local-or-remote file browser + editor. Run from terminal, starts a Next.js web server,
8
- navigate/read/edit any directory. Single-user no-auth by default; multi-user auth turns on
9
- once anyone signs up. Exposes an HTTP API for AI agents (two tiers) plus an MCP adapter.
10
- Git-aware: detects repos, shows branch/history/diff, supports git-backed read-only workspaces.
11
- Public shared-doc links via `/api/share`.
12
-
13
- Published to npm as `wiki-viewer`. CLI entry: `bin/wiki-viewer.js`.
14
-
15
- ## Stack
16
-
17
- - **Next.js 16** (App Router, standalone output) + **React 19** + **TypeScript**
18
- - **Tailwind 3** + Radix UI + shadcn-style components (`src/components/ui`)
19
- - **TipTap 3** rich Markdown editor
20
- - **Better Auth** + **better-sqlite3** + **kysely** (pinned `0.28.5`) for auth/sessions
21
- - **Zustand** for client state (`src/stores`)
22
- - **chokidar** file watching, **proper-lockfile** write locks
23
- - Package manager: **pnpm** (workspace; do not use npm/yarn for installs)
24
-
25
- ## Commands
26
-
27
- ```bash
28
- pnpm install
29
- ROOT_DIR=~/notes pnpm dev # dev server, hot reload
30
- pnpm dev:https # dev with experimental HTTPS
31
- pnpm build # production build (standalone)
32
- pnpm test # proof + auth suite (tsx node:test, 40 files / 180+ tests)
33
- ```
34
-
35
- Test runner: `tsx --import ./src/tests/proof/preload.ts --test src/tests/proof/*.test.ts`.
36
- Single file: `tsx --import ./src/tests/proof/preload.ts --test src/tests/proof/<name>.test.ts`.
37
-
38
- ## Layout
39
-
40
- ```
41
- bin/wiki-viewer.js CLI: arg parse, config, HTTPS proxy, systemd/launchd service, init wizard
42
- src/app/
43
- api/agent/ Agent HTTP API — fs (tier1), files/events/sidecar (tier2),
44
- activity, register, admin, internal, settings
45
- api/agents/ Public install/skill discovery endpoints
46
- api/auth/ Better Auth handler
47
- api/wiki/ File browser API (session-gated)
48
- api/system/ System config API (session-gated)
49
- api/share/ Public shared-doc links (token-gated)
50
- api/owner/ api/upload/ api/assets/ api/app-proxy/
51
- signin/ layout.tsx page.tsx manifest.ts
52
- src/components/
53
- editor/ TipTap editor, proof-span, comment-pip, suggestion-card
54
- ai-panel/ Agents, activity, install panel
55
- wiki/ layout/ search/ ui/ auth-settings-sheet.tsx dir-picker.tsx
56
- src/lib/
57
- proof/ Agent protocol core: ops-applier, registry, file-lock, raw-fs,
58
- collab-state, sidecar, blocks, block-refs, idempotency, rate-limit,
59
- audit, lease, mutex, activity, event-bus, pending, glob
60
- auth/ Better Auth server+client, allowlist, CSRF
61
- git.ts git-secrets.ts System-git wrapper (provider-agnostic; token via GIT_ASKPASS),
62
- secret scanning. Backs git-history/diff/branch + read-only repo workspaces.
63
- shared-docs/ Public shared-doc link store (db.ts)
64
- workspaces.ts Workspace registry (multi-root)
65
- config.ts root-dir.ts app-runner.ts markdown/ search/ cabinets/ embeds/ google/
66
- src/stores/ Zustand stores
67
- src/middleware.ts Cookie-presence gate for UI routes
68
- packages/wiki-viewer-mcp/ Standalone MCP adapter (own package.json, npm-published)
69
- docs/ agent-collab-plan.md (tier-2 spec), file-vs-collab-authority.md
70
- agents/ Installable Agent Skill + bootstrap prompt
71
- ```
72
-
73
- Import alias: `@/*` → `./src/*`.
74
-
75
- ## Agent API model (the core domain)
76
-
77
- Two tiers share one auth/scope/lock spine:
78
-
79
- - **Tier 1 — raw filesystem** (`/api/agent/fs/*`): read/write/edit/list/search/move/delete for
80
- all file types. Byte-accurate, audited. Overwrite requires `If-Match: <sha256>`.
81
- - **Tier 2 — Markdown collab** (`/api/agent/files/*`): block-ops wrapped in `<proof-span>`
82
- provenance marks, comments, suggestions. Revision-checked, idempotent.
83
-
84
- **Working-vs-collaborating safety**: before editing a `.md` file, agents check the
85
- `X-Collab-State` response header (`active` / `tracked` / `untracked` / `not-markdown`).
86
- When `active` (human has it open), raw writes are rejected `409 COLLAB_ACTIVE` — use tier-2.
87
- This is enforced inside the write lock, not advisory. See `docs/file-vs-collab-authority.md`.
88
-
89
- **Auth**: Trust On First Use. Agent registers → owner approves in UI → one-shot token pickup.
90
- Bearer token + `X-Agent-Id` on every request. Only SHA-256 token hashes stored
91
- (`~/.wiki-viewer/agents.json`). Scopes: `paths` (glob), `ops` (`read`/`mutate`/`delete`).
92
-
93
- **Workspaces**: one server serves many root dirs, isolated. Agents target via `X-Workspace: <id>`
94
- header or `?ws=`. State (leases, locks, idempotency, sidecars, audit) namespaced per workspace.
95
-
96
- ## State / runtime
97
-
98
- - User data dir: `~/.wiki-viewer/` — `auth.db` (WAL), `auth.secret` (0600), `agents.json`, `config.json`.
99
- - SQLite WAL is single-host only (not NFS / not clustered).
100
- - Config precedence: shell env > `config.json` `env` block > CLI-derived defaults.
101
-
102
- ## Conventions / gotchas
103
-
104
- - Use pnpm. `kysely` is pinned to `0.28.5` via overrides — do not bump.
105
- - All state-changing `/api/wiki/*` and `/api/system/*` routes do CSRF Origin checks against
106
- an allowlist (`WIKI_OWNER_HOSTS`). Cross-origin + cookie → `403`.
107
- - Production refuses to boot unless `BETTER_AUTH_URL` is an `https://` origin
108
- (bypass with `WIKI_ALLOW_INSECURE=1` for dev/CI only).
109
- - Editor saves send `baseRevision`; stale → `409 STALE_REVISION`, editor reloads.
110
- - Agent paths reject traversal, symlink escape, and anything under `.proof/`.
111
- - When adding agent-API behavior, add/extend tests in `src/tests/proof/` and run `pnpm test`.
112
- - `AGENT_BEARER_TOKEN` (legacy single-secret) is dead — does nothing.
113
- - Git access uses the system `git` binary; tokens injected via `GIT_ASKPASS`, never in
114
- process args / `.git/config` / `ps` output. `git-secrets.ts` scans for leaked secrets.