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.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/internal/span/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/assets/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/share/[token]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/share/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/set-root/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/upload/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/content/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/file/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-history/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/slugs/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/middleware-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/package.json +1 -1
- package/bin/postbuild.js +21 -0
- package/package.json +1 -1
- package/.next/standalone/.github/workflows/publish.yml +0 -37
- package/.next/standalone/.handoffs/archive/handoff-20260612-113332.md +0 -98
- package/.next/standalone/.handoffs/archive/handoff-20260612-141032.md +0 -73
- package/.next/standalone/.pi/ownership.json +0 -3
- package/.next/standalone/AGENTS.md +0 -114
- package/.next/standalone/DESIGN.md +0 -521
- package/.next/standalone/README.md +0 -821
- package/.next/standalone/TODO.md +0 -20
- package/.next/standalone/agents/bootstrap-prompt.md +0 -14
- package/.next/standalone/agents/wiki-viewer-skill/SKILL.md +0 -456
- package/.next/standalone/bin/postbuild.js +0 -78
- package/.next/standalone/bin/wiki-viewer.js +0 -922
- package/.next/standalone/certificates/localhost-key.pem +0 -28
- package/.next/standalone/certificates/localhost.pem +0 -24
- package/.next/standalone/docs/agent-collab-plan.md +0 -1615
- package/.next/standalone/docs/agent-collab-v2-plan.md +0 -771
- package/.next/standalone/docs/agent-fs-plan.md +0 -232
- package/.next/standalone/docs/editorial-skin-spec.md +0 -242
- package/.next/standalone/docs/file-vs-collab-authority.md +0 -124
- package/.next/standalone/docs/mobile-readiness-spec.md +0 -229
- package/.next/standalone/docs/workspacing-plan.md +0 -364
- package/.next/standalone/packages/wiki-viewer-mcp/README.md +0 -195
- package/.next/standalone/packages/wiki-viewer-mcp/bench-e2e.mjs +0 -166
- package/.next/standalone/packages/wiki-viewer-mcp/bench-latency.mjs +0 -87
- package/.next/standalone/packages/wiki-viewer-mcp/bench-payload.mjs +0 -45
- package/.next/standalone/packages/wiki-viewer-mcp/dist/http-client.js +0 -331
- package/.next/standalone/packages/wiki-viewer-mcp/dist/index.js +0 -531
- package/.next/standalone/packages/wiki-viewer-mcp/dist/register.js +0 -94
- package/.next/standalone/packages/wiki-viewer-mcp/dist/state-cache.js +0 -28
- package/.next/standalone/packages/wiki-viewer-mcp/package-lock.json +0 -1716
- package/.next/standalone/packages/wiki-viewer-mcp/package.json +0 -41
- package/.next/standalone/packages/wiki-viewer-mcp/src/http-client.ts +0 -459
- package/.next/standalone/packages/wiki-viewer-mcp/src/index.ts +0 -638
- package/.next/standalone/packages/wiki-viewer-mcp/src/register.ts +0 -144
- package/.next/standalone/packages/wiki-viewer-mcp/src/state-cache.ts +0 -55
- package/.next/standalone/packages/wiki-viewer-mcp/tsconfig.json +0 -19
- package/.next/standalone/pnpm-lock.yaml +0 -6697
- package/.next/standalone/pnpm-workspace.yaml +0 -8
- package/.next/standalone/postcss.config.mjs +0 -2
- package/.next/standalone/src/app/api/agent/activity/route.ts +0 -59
- package/.next/standalone/src/app/api/agent/admin/agents/[agentId]/revoke/route.ts +0 -40
- package/.next/standalone/src/app/api/agent/admin/agents/route.ts +0 -33
- package/.next/standalone/src/app/api/agent/admin/registrations/[regId]/approve/route.ts +0 -83
- package/.next/standalone/src/app/api/agent/admin/registrations/[regId]/deny/route.ts +0 -36
- package/.next/standalone/src/app/api/agent/admin/registrations/route.ts +0 -27
- package/.next/standalone/src/app/api/agent/events/[...path]/route.ts +0 -148
- package/.next/standalone/src/app/api/agent/files/[...path]/route.ts +0 -219
- package/.next/standalone/src/app/api/agent/fs/file/[...path]/route.ts +0 -446
- package/.next/standalone/src/app/api/agent/fs/ls/[[...path]]/route.ts +0 -152
- package/.next/standalone/src/app/api/agent/fs/move/route.ts +0 -130
- package/.next/standalone/src/app/api/agent/fs/search/route.ts +0 -272
- package/.next/standalone/src/app/api/agent/internal/span/route.ts +0 -121
- package/.next/standalone/src/app/api/agent/register/[regId]/route.ts +0 -50
- package/.next/standalone/src/app/api/agent/register/route.ts +0 -118
- package/.next/standalone/src/app/api/agent/settings/route.ts +0 -34
- package/.next/standalone/src/app/api/agent/settings/token/regenerate/route.ts +0 -20
- package/.next/standalone/src/app/api/agent/sidecar/[...path]/route.ts +0 -53
- package/.next/standalone/src/app/api/agents/install/route.ts +0 -143
- package/.next/standalone/src/app/api/agents/skill/route.ts +0 -20
- package/.next/standalone/src/app/api/agents/skill.tar.gz/route.ts +0 -87
- package/.next/standalone/src/app/api/app-proxy/[...path]/route.ts +0 -247
- package/.next/standalone/src/app/api/assets/[...path]/route.ts +0 -75
- package/.next/standalone/src/app/api/auth/[...all]/route.ts +0 -7
- package/.next/standalone/src/app/api/owner/init/route.ts +0 -14
- package/.next/standalone/src/app/api/share/[token]/route.ts +0 -269
- package/.next/standalone/src/app/api/share/route.ts +0 -127
- package/.next/standalone/src/app/api/system/admins/route.ts +0 -103
- package/.next/standalone/src/app/api/system/auth-config/route.ts +0 -22
- package/.next/standalone/src/app/api/system/auth-settings/route.ts +0 -86
- package/.next/standalone/src/app/api/system/browse/route.ts +0 -82
- package/.next/standalone/src/app/api/system/clear-root/route.ts +0 -16
- package/.next/standalone/src/app/api/system/config/route.ts +0 -14
- package/.next/standalone/src/app/api/system/pins/route.ts +0 -38
- package/.next/standalone/src/app/api/system/reveal/route.ts +0 -36
- package/.next/standalone/src/app/api/system/root-status/route.ts +0 -13
- package/.next/standalone/src/app/api/system/set-root/route.ts +0 -53
- package/.next/standalone/src/app/api/system/users/route.ts +0 -120
- package/.next/standalone/src/app/api/system/workspaces/[id]/open/route.ts +0 -34
- package/.next/standalone/src/app/api/system/workspaces/[id]/refresh/route.ts +0 -32
- package/.next/standalone/src/app/api/system/workspaces/[id]/route.ts +0 -78
- package/.next/standalone/src/app/api/system/workspaces/route.ts +0 -128
- package/.next/standalone/src/app/api/upload/[...path]/route.ts +0 -85
- package/.next/standalone/src/app/api/wiki/app/route.ts +0 -60
- package/.next/standalone/src/app/api/wiki/backlinks/route.ts +0 -29
- package/.next/standalone/src/app/api/wiki/content/route.ts +0 -159
- package/.next/standalone/src/app/api/wiki/download/route.ts +0 -100
- package/.next/standalone/src/app/api/wiki/file/route.ts +0 -57
- package/.next/standalone/src/app/api/wiki/folder/route.ts +0 -34
- package/.next/standalone/src/app/api/wiki/git-branches/route.ts +0 -32
- package/.next/standalone/src/app/api/wiki/git-checkout/route.ts +0 -45
- package/.next/standalone/src/app/api/wiki/git-diff/route.ts +0 -33
- package/.next/standalone/src/app/api/wiki/git-file-info/route.ts +0 -27
- package/.next/standalone/src/app/api/wiki/git-history/route.ts +0 -27
- package/.next/standalone/src/app/api/wiki/git-pull/route.ts +0 -48
- package/.next/standalone/src/app/api/wiki/move/route.ts +0 -61
- package/.next/standalone/src/app/api/wiki/new-file/route.ts +0 -56
- package/.next/standalone/src/app/api/wiki/outlinks/route.ts +0 -76
- package/.next/standalone/src/app/api/wiki/page/route.ts +0 -92
- package/.next/standalone/src/app/api/wiki/presence/route.ts +0 -56
- package/.next/standalone/src/app/api/wiki/route.ts +0 -116
- package/.next/standalone/src/app/api/wiki/search/route.ts +0 -44
- package/.next/standalone/src/app/api/wiki/slugs/route.ts +0 -54
- package/.next/standalone/src/app/api/wiki/upload/route.ts +0 -95
- package/.next/standalone/src/app/api/wiki/watch/route.ts +0 -67
- package/.next/standalone/src/app/globals.css +0 -1249
- package/.next/standalone/src/app/icon.svg +0 -11
- package/.next/standalone/src/app/layout.tsx +0 -78
- package/.next/standalone/src/app/manifest.ts +0 -30
- package/.next/standalone/src/app/page.tsx +0 -3260
- package/.next/standalone/src/app/s/[token]/page.tsx +0 -357
- package/.next/standalone/src/app/signin/page.tsx +0 -16
- package/.next/standalone/src/app/signin/signin-form.tsx +0 -238
- package/.next/standalone/src/components/ai-panel/activity-row.tsx +0 -284
- package/.next/standalone/src/components/ai-panel/ai-panel.tsx +0 -311
- package/.next/standalone/src/components/ai-panel/token-section.tsx +0 -313
- package/.next/standalone/src/components/auth-settings-sheet.tsx +0 -474
- package/.next/standalone/src/components/confirm-dialog.tsx +0 -56
- package/.next/standalone/src/components/dir-picker.tsx +0 -606
- package/.next/standalone/src/components/editor/backlinks-panel.tsx +0 -139
- package/.next/standalone/src/components/editor/bubble-menu.tsx +0 -346
- package/.next/standalone/src/components/editor/callout-extension.ts +0 -36
- package/.next/standalone/src/components/editor/comment-pip.tsx +0 -56
- package/.next/standalone/src/components/editor/comment-thread.tsx +0 -254
- package/.next/standalone/src/components/editor/csv-viewer.tsx +0 -379
- package/.next/standalone/src/components/editor/document-outline.tsx +0 -230
- package/.next/standalone/src/components/editor/editor-toolbar.tsx +0 -564
- package/.next/standalone/src/components/editor/editor.tsx +0 -1327
- package/.next/standalone/src/components/editor/extensions/drag-handle.ts +0 -325
- package/.next/standalone/src/components/editor/extensions/heading-anchors.ts +0 -55
- package/.next/standalone/src/components/editor/extensions/proof-span.ts +0 -60
- package/.next/standalone/src/components/editor/extensions/resizable-image.tsx +0 -159
- package/.next/standalone/src/components/editor/extensions.ts +0 -150
- package/.next/standalone/src/components/editor/file-fallback-viewer.tsx +0 -75
- package/.next/standalone/src/components/editor/folder-index.tsx +0 -236
- package/.next/standalone/src/components/editor/google-doc-viewer.tsx +0 -73
- package/.next/standalone/src/components/editor/image-viewer.tsx +0 -57
- package/.next/standalone/src/components/editor/large-file-gate.tsx +0 -108
- package/.next/standalone/src/components/editor/link-popover.tsx +0 -111
- package/.next/standalone/src/components/editor/media-popover.tsx +0 -212
- package/.next/standalone/src/components/editor/media-viewer.tsx +0 -70
- package/.next/standalone/src/components/editor/mermaid-viewer.tsx +0 -286
- package/.next/standalone/src/components/editor/node-app-viewer.tsx +0 -328
- package/.next/standalone/src/components/editor/notebook-viewer.tsx +0 -371
- package/.next/standalone/src/components/editor/office/docx-viewer.tsx +0 -93
- package/.next/standalone/src/components/editor/office/office-chrome.tsx +0 -83
- package/.next/standalone/src/components/editor/office/pptx-viewer.tsx +0 -104
- package/.next/standalone/src/components/editor/office/xlsx-viewer.tsx +0 -192
- package/.next/standalone/src/components/editor/pdf-viewer.tsx +0 -32
- package/.next/standalone/src/components/editor/proof-span-popover.tsx +0 -162
- package/.next/standalone/src/components/editor/slash-commands.tsx +0 -629
- package/.next/standalone/src/components/editor/source-viewer.tsx +0 -289
- package/.next/standalone/src/components/editor/suggest-edit-popover.tsx +0 -229
- package/.next/standalone/src/components/editor/suggestion-card.tsx +0 -206
- package/.next/standalone/src/components/editor/table-menu.tsx +0 -232
- package/.next/standalone/src/components/editor/view-mode-comment-button.tsx +0 -77
- package/.next/standalone/src/components/editor/website-viewer.tsx +0 -75
- package/.next/standalone/src/components/editor/wiki-link-create-dialog.tsx +0 -189
- package/.next/standalone/src/components/editor/wiki-link-decorator.ts +0 -79
- package/.next/standalone/src/components/editor/wiki-link-extension.ts +0 -120
- package/.next/standalone/src/components/editor/wiki-link-picker.tsx +0 -250
- package/.next/standalone/src/components/layout/viewer-toolbar.tsx +0 -54
- package/.next/standalone/src/components/search/search-command-dialog.tsx +0 -246
- package/.next/standalone/src/components/search/sidebar-search-box.tsx +0 -121
- package/.next/standalone/src/components/search/snippet-text.tsx +0 -48
- package/.next/standalone/src/components/share-dialog.tsx +0 -307
- package/.next/standalone/src/components/theme-provider.tsx +0 -16
- package/.next/standalone/src/components/theme-toggle.tsx +0 -24
- package/.next/standalone/src/components/ui/badge.tsx +0 -35
- package/.next/standalone/src/components/ui/button.tsx +0 -56
- package/.next/standalone/src/components/ui/card.tsx +0 -63
- package/.next/standalone/src/components/ui/collapsible.tsx +0 -9
- package/.next/standalone/src/components/ui/command.tsx +0 -151
- package/.next/standalone/src/components/ui/context-menu.tsx +0 -191
- package/.next/standalone/src/components/ui/dialog.tsx +0 -119
- package/.next/standalone/src/components/ui/dropdown-menu.tsx +0 -194
- package/.next/standalone/src/components/ui/input.tsx +0 -22
- package/.next/standalone/src/components/ui/label.tsx +0 -25
- package/.next/standalone/src/components/ui/popover.tsx +0 -33
- package/.next/standalone/src/components/ui/scroll-area.tsx +0 -47
- package/.next/standalone/src/components/ui/select.tsx +0 -156
- package/.next/standalone/src/components/ui/separator.tsx +0 -30
- package/.next/standalone/src/components/ui/sheet.tsx +0 -140
- package/.next/standalone/src/components/ui/skeleton.tsx +0 -15
- package/.next/standalone/src/components/ui/switch.tsx +0 -28
- package/.next/standalone/src/components/ui/tabs.tsx +0 -54
- package/.next/standalone/src/components/ui/textarea.tsx +0 -21
- package/.next/standalone/src/components/ui/tip.tsx +0 -23
- package/.next/standalone/src/components/ui/toggle-group.tsx +0 -41
- package/.next/standalone/src/components/ui/tooltip.tsx +0 -27
- package/.next/standalone/src/components/view-width-toggle.tsx +0 -70
- package/.next/standalone/src/components/wiki/frontmatter-header.tsx +0 -164
- package/.next/standalone/src/hooks/use-is-mobile.ts +0 -14
- package/.next/standalone/src/lib/app-runner.ts +0 -272
- package/.next/standalone/src/lib/auth/admin.ts +0 -120
- package/.next/standalone/src/lib/auth/allowlist.ts +0 -50
- package/.next/standalone/src/lib/auth/client.ts +0 -4
- package/.next/standalone/src/lib/auth/csrf.ts +0 -68
- package/.next/standalone/src/lib/auth/server.ts +0 -215
- package/.next/standalone/src/lib/cabinets/tree.ts +0 -75
- package/.next/standalone/src/lib/config.ts +0 -114
- package/.next/standalone/src/lib/embeds/detect.ts +0 -142
- package/.next/standalone/src/lib/git-secrets.ts +0 -65
- package/.next/standalone/src/lib/git.ts +0 -503
- package/.next/standalone/src/lib/google/detect.ts +0 -107
- package/.next/standalone/src/lib/markdown/parse-frontmatter.ts +0 -104
- package/.next/standalone/src/lib/markdown/remark-wikilinks.ts +0 -100
- package/.next/standalone/src/lib/markdown/sanitize-schema.ts +0 -106
- package/.next/standalone/src/lib/markdown/to-html.ts +0 -282
- package/.next/standalone/src/lib/markdown/to-markdown.ts +0 -252
- package/.next/standalone/src/lib/proof/activity-shared.ts +0 -31
- package/.next/standalone/src/lib/proof/activity.ts +0 -74
- package/.next/standalone/src/lib/proof/audit.ts +0 -88
- package/.next/standalone/src/lib/proof/auth.ts +0 -143
- package/.next/standalone/src/lib/proof/block-refs.ts +0 -133
- package/.next/standalone/src/lib/proof/blocks.ts +0 -73
- package/.next/standalone/src/lib/proof/client-auth.ts +0 -23
- package/.next/standalone/src/lib/proof/collab-state.ts +0 -81
- package/.next/standalone/src/lib/proof/event-bus.ts +0 -47
- package/.next/standalone/src/lib/proof/file-lock.ts +0 -43
- package/.next/standalone/src/lib/proof/glob.ts +0 -51
- package/.next/standalone/src/lib/proof/idempotency.ts +0 -37
- package/.next/standalone/src/lib/proof/lease.ts +0 -117
- package/.next/standalone/src/lib/proof/mutex.ts +0 -36
- package/.next/standalone/src/lib/proof/ops-applier.ts +0 -727
- package/.next/standalone/src/lib/proof/owner-auth.ts +0 -2
- package/.next/standalone/src/lib/proof/pending.ts +0 -97
- package/.next/standalone/src/lib/proof/proof-span.ts +0 -141
- package/.next/standalone/src/lib/proof/rate-limit.ts +0 -53
- package/.next/standalone/src/lib/proof/raw-fs.ts +0 -197
- package/.next/standalone/src/lib/proof/register-rate-limit.ts +0 -53
- package/.next/standalone/src/lib/proof/registry.ts +0 -195
- package/.next/standalone/src/lib/proof/sidecar.ts +0 -103
- package/.next/standalone/src/lib/proof/suggest-capture.ts +0 -69
- package/.next/standalone/src/lib/proof/types.ts +0 -182
- package/.next/standalone/src/lib/proof-config.ts +0 -14
- package/.next/standalone/src/lib/root-dir.ts +0 -35
- package/.next/standalone/src/lib/search/indexable-exts.ts +0 -25
- package/.next/standalone/src/lib/search/indexer.ts +0 -634
- package/.next/standalone/src/lib/search/sanitize.ts +0 -35
- package/.next/standalone/src/lib/search/search-db.ts +0 -57
- package/.next/standalone/src/lib/search/watcher-pool.ts +0 -79
- package/.next/standalone/src/lib/shared-docs/db.ts +0 -177
- package/.next/standalone/src/lib/toast.ts +0 -9
- package/.next/standalone/src/lib/utils.ts +0 -6
- package/.next/standalone/src/lib/wiki-helpers.ts +0 -36
- package/.next/standalone/src/lib/workspace-client.ts +0 -82
- package/.next/standalone/src/lib/workspace-context.ts +0 -173
- package/.next/standalone/src/lib/workspaces.ts +0 -400
- package/.next/standalone/src/middleware.ts +0 -44
- package/.next/standalone/src/stores/ai-panel-store.ts +0 -79
- package/.next/standalone/src/stores/editor-store.ts +0 -439
- package/.next/standalone/src/stores/pin-store.ts +0 -56
- package/.next/standalone/src/stores/proof-store.ts +0 -124
- package/.next/standalone/src/stores/recent-store.ts +0 -51
- package/.next/standalone/src/stores/search-store.ts +0 -104
- package/.next/standalone/src/stores/show-hidden-store.ts +0 -26
- package/.next/standalone/src/stores/sidebar-width-store.ts +0 -39
- package/.next/standalone/src/stores/skin-store.ts +0 -42
- package/.next/standalone/src/stores/tree-store.ts +0 -52
- package/.next/standalone/src/stores/view-width-store.ts +0 -101
- package/.next/standalone/src/stores/wiki-slugs-store.ts +0 -75
- package/.next/standalone/src/tests/proof/activity-aggregator.test.ts +0 -146
- package/.next/standalone/src/tests/proof/admin-create-user.test.ts +0 -43
- package/.next/standalone/src/tests/proof/agent-fs.test.ts +0 -973
- package/.next/standalone/src/tests/proof/agent-ownership.test.ts +0 -140
- package/.next/standalone/src/tests/proof/agent-workspace-scope.test.ts +0 -134
- package/.next/standalone/src/tests/proof/agents-install.test.ts +0 -110
- package/.next/standalone/src/tests/proof/bench-write.ts +0 -179
- package/.next/standalone/src/tests/proof/better-auth.test.ts +0 -68
- package/.next/standalone/src/tests/proof/block-refs.test.ts +0 -108
- package/.next/standalone/src/tests/proof/blocks.test.ts +0 -92
- package/.next/standalone/src/tests/proof/collab-state.test.ts +0 -501
- package/.next/standalone/src/tests/proof/comments-ops.test.ts +0 -177
- package/.next/standalone/src/tests/proof/editor-roundtrip.test.ts +0 -85
- package/.next/standalone/src/tests/proof/external-edit.test.ts +0 -58
- package/.next/standalone/src/tests/proof/file-lock.test.ts +0 -80
- package/.next/standalone/src/tests/proof/git-branches-checkout.test.ts +0 -136
- package/.next/standalone/src/tests/proof/git-read-features.test.ts +0 -473
- package/.next/standalone/src/tests/proof/git-secrets.test.ts +0 -138
- package/.next/standalone/src/tests/proof/git-sparse.test.ts +0 -257
- package/.next/standalone/src/tests/proof/git-workspace.test.ts +0 -135
- package/.next/standalone/src/tests/proof/git.test.ts +0 -243
- package/.next/standalone/src/tests/proof/glob.test.ts +0 -82
- package/.next/standalone/src/tests/proof/helpers/auth-session.ts +0 -27
- package/.next/standalone/src/tests/proof/markdown-to-html.test.ts +0 -46
- package/.next/standalone/src/tests/proof/ops-applier.test.ts +0 -368
- package/.next/standalone/src/tests/proof/owner-init.test.ts +0 -2
- package/.next/standalone/src/tests/proof/parse-frontmatter.test.ts +0 -60
- package/.next/standalone/src/tests/proof/preload.ts +0 -21
- package/.next/standalone/src/tests/proof/proof-span.test.ts +0 -98
- package/.next/standalone/src/tests/proof/rate-limit.test.ts +0 -54
- package/.next/standalone/src/tests/proof/readonly-enforcement.test.ts +0 -161
- package/.next/standalone/src/tests/proof/reconcile-sidecar.test.ts +0 -195
- package/.next/standalone/src/tests/proof/registration-flow.test.ts +0 -330
- package/.next/standalone/src/tests/proof/registry.test.ts +0 -169
- package/.next/standalone/src/tests/proof/routes.test.ts +0 -516
- package/.next/standalone/src/tests/proof/search-index.test.ts +0 -376
- package/.next/standalone/src/tests/proof/sidecar-lifecycle.test.ts +0 -177
- package/.next/standalone/src/tests/proof/sidecar-trim.test.ts +0 -58
- package/.next/standalone/src/tests/proof/suggestion-ops.test.ts +0 -280
- package/.next/standalone/src/tests/proof/wiki-content-put.test.ts +0 -140
- package/.next/standalone/src/tests/proof/wiki-routes-auth.test.ts +0 -208
- package/.next/standalone/src/tests/proof/workspace-isolation.test.ts +0 -87
- package/.next/standalone/src/tests/proof/workspaces-api.test.ts +0 -227
- package/.next/standalone/src/types/index.ts +0 -47
- package/.next/standalone/tailwind.config.ts +0 -191
- package/.next/standalone/tsconfig.json +0 -41
- package/.next/standalone/tsconfig.tsbuildinfo +0 -1
- /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → rRyvFORvJoc5OWbCR2A_P}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → rRyvFORvJoc5OWbCR2A_P}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → rRyvFORvJoc5OWbCR2A_P}/_ssgManifest.js +0 -0
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from "next/server";
|
|
2
|
-
import { findEnclosingGitRepo, gitFileHistory } from "@/lib/git";
|
|
3
|
-
import { resolveWorkspaceForUser } from "@/lib/workspace-context";
|
|
4
|
-
import { safeWorkspacePath } from "@/lib/workspaces";
|
|
5
|
-
|
|
6
|
-
export async function GET(request: Request) {
|
|
7
|
-
const ctx = await resolveWorkspaceForUser(request);
|
|
8
|
-
if (!ctx.ok) return NextResponse.json({ error: ctx.code }, { status: ctx.status });
|
|
9
|
-
const { rootDir } = ctx;
|
|
10
|
-
|
|
11
|
-
const { searchParams } = new URL(request.url);
|
|
12
|
-
const rel = searchParams.get("path") ?? "";
|
|
13
|
-
if (!rel) return NextResponse.json({ error: "Invalid path" }, { status: 400 });
|
|
14
|
-
|
|
15
|
-
const filePath = safeWorkspacePath(rootDir, rel);
|
|
16
|
-
if (!filePath) return NextResponse.json({ error: "Invalid path" }, { status: 400 });
|
|
17
|
-
|
|
18
|
-
const repo = await findEnclosingGitRepo(rootDir, rel);
|
|
19
|
-
if (!repo) return NextResponse.json({ commits: [] });
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
const commits = await gitFileHistory(repo.repoDir, repo.relFromRepo);
|
|
23
|
-
return NextResponse.json({ commits });
|
|
24
|
-
} catch {
|
|
25
|
-
return NextResponse.json({ commits: [] });
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { NextResponse } from "next/server";
|
|
3
|
-
import { checkOrigin } from "@/lib/auth/csrf";
|
|
4
|
-
import { detectGitRepo, pullRepo, currentBranch, headSha } from "@/lib/git";
|
|
5
|
-
import { resolveWorkspaceForUser } from "@/lib/workspace-context";
|
|
6
|
-
import { safeWorkspacePath } from "@/lib/workspaces";
|
|
7
|
-
|
|
8
|
-
export async function POST(request: Request) {
|
|
9
|
-
const csrf = checkOrigin(request);
|
|
10
|
-
if (csrf) return csrf;
|
|
11
|
-
|
|
12
|
-
const ctx = await resolveWorkspaceForUser(request, "write");
|
|
13
|
-
if (!ctx.ok) return NextResponse.json({ error: ctx.code }, { status: ctx.status });
|
|
14
|
-
const { rootDir } = ctx;
|
|
15
|
-
|
|
16
|
-
const body: { path?: string } = await request.json();
|
|
17
|
-
const rel = body.path;
|
|
18
|
-
if (!rel || typeof rel !== "string")
|
|
19
|
-
return NextResponse.json({ error: "Invalid path" }, { status: 400 });
|
|
20
|
-
|
|
21
|
-
const repoDir = safeWorkspacePath(rootDir, rel);
|
|
22
|
-
if (!repoDir || repoDir === rootDir)
|
|
23
|
-
return NextResponse.json({ error: "Invalid path" }, { status: 400 });
|
|
24
|
-
|
|
25
|
-
// Verify it's a valid git repo root (same check as directory listing)
|
|
26
|
-
if (!(await detectGitRepo(repoDir))) {
|
|
27
|
-
return NextResponse.json(
|
|
28
|
-
{ error: "Not a git repository" },
|
|
29
|
-
{ status: 400 },
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
await pullRepo({ rootDir: repoDir });
|
|
35
|
-
const [branch, sha] = await Promise.all([
|
|
36
|
-
currentBranch(repoDir),
|
|
37
|
-
headSha(repoDir),
|
|
38
|
-
]);
|
|
39
|
-
return NextResponse.json({ ok: true, branch, sha });
|
|
40
|
-
} catch (err: unknown) {
|
|
41
|
-
const message =
|
|
42
|
-
err instanceof Error ? err.message : "Pull failed";
|
|
43
|
-
return NextResponse.json(
|
|
44
|
-
{ error: "Pull failed", message },
|
|
45
|
-
{ status: 500 },
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { rename, stat } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { NextResponse } from "next/server";
|
|
4
|
-
import { checkOrigin } from "@/lib/auth/csrf";
|
|
5
|
-
import { resolveWorkspaceForUser } from "@/lib/workspace-context";
|
|
6
|
-
import { safeWorkspacePath } from "@/lib/workspaces";
|
|
7
|
-
import { moveSidecar } from "@/lib/proof/sidecar";
|
|
8
|
-
|
|
9
|
-
export async function POST(request: Request) {
|
|
10
|
-
const csrf = checkOrigin(request);
|
|
11
|
-
if (csrf) return csrf;
|
|
12
|
-
const ctx = await resolveWorkspaceForUser(request, "write");
|
|
13
|
-
if (!ctx.ok) return NextResponse.json({ error: ctx.code }, { status: ctx.status });
|
|
14
|
-
const { rootDir } = ctx;
|
|
15
|
-
|
|
16
|
-
const body: { from?: string; to?: string } = await request.json();
|
|
17
|
-
if (
|
|
18
|
-
!body.from ||
|
|
19
|
-
!body.to ||
|
|
20
|
-
typeof body.from !== "string" ||
|
|
21
|
-
typeof body.to !== "string"
|
|
22
|
-
) {
|
|
23
|
-
return NextResponse.json(
|
|
24
|
-
{ error: "Missing from/to paths" },
|
|
25
|
-
{ status: 400 },
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const fromPath = safeWorkspacePath(rootDir, body.from);
|
|
30
|
-
const toPath = safeWorkspacePath(rootDir, body.to);
|
|
31
|
-
|
|
32
|
-
if (!fromPath || !toPath)
|
|
33
|
-
return NextResponse.json({ error: "Invalid path" }, { status: 400 });
|
|
34
|
-
|
|
35
|
-
if (toPath.startsWith(fromPath + path.sep) || toPath === fromPath) {
|
|
36
|
-
return NextResponse.json(
|
|
37
|
-
{ error: "Cannot move a folder into itself" },
|
|
38
|
-
{ status: 400 },
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
await stat(fromPath);
|
|
44
|
-
} catch {
|
|
45
|
-
return NextResponse.json({ error: "Source not found" }, { status: 404 });
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
await rename(fromPath, toPath);
|
|
50
|
-
|
|
51
|
-
// Fix latent bug: sidecar was orphaned on .md renames (R3)
|
|
52
|
-
const fromExt = path.extname(body.from).toLowerCase();
|
|
53
|
-
if (fromExt === ".md" || fromExt === ".markdown") {
|
|
54
|
-
await moveSidecar(rootDir, body.from, body.to);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return NextResponse.json({ ok: true });
|
|
58
|
-
} catch {
|
|
59
|
-
return NextResponse.json({ error: "Move failed" }, { status: 500 });
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { mkdir, stat, writeFile } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { NextResponse } from "next/server";
|
|
4
|
-
import { checkOrigin } from "@/lib/auth/csrf";
|
|
5
|
-
import { resolveWorkspaceForUser } from "@/lib/workspace-context";
|
|
6
|
-
import { safeWorkspacePath } from "@/lib/workspaces";
|
|
7
|
-
|
|
8
|
-
export async function POST(request: Request) {
|
|
9
|
-
const csrf = checkOrigin(request);
|
|
10
|
-
if (csrf) return csrf;
|
|
11
|
-
const ctx = await resolveWorkspaceForUser(request, "write");
|
|
12
|
-
if (!ctx.ok)
|
|
13
|
-
return NextResponse.json({ error: ctx.code }, { status: ctx.status });
|
|
14
|
-
const { rootDir } = ctx;
|
|
15
|
-
|
|
16
|
-
const body: { path?: string } = await request.json();
|
|
17
|
-
const rel = body.path;
|
|
18
|
-
|
|
19
|
-
if (!rel || typeof rel !== "string" || /[<>:"|?*]/.test(rel)) {
|
|
20
|
-
return NextResponse.json({ error: "Invalid file path" }, { status: 400 });
|
|
21
|
-
}
|
|
22
|
-
if (rel.endsWith("/")) {
|
|
23
|
-
return NextResponse.json({ error: "Invalid file path" }, { status: 400 });
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const filePath = safeWorkspacePath(rootDir, rel);
|
|
27
|
-
if (!filePath)
|
|
28
|
-
return NextResponse.json({ error: "Invalid path" }, { status: 400 });
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
await stat(filePath);
|
|
32
|
-
return NextResponse.json(
|
|
33
|
-
{ error: "File already exists", path: rel },
|
|
34
|
-
{ status: 409 },
|
|
35
|
-
);
|
|
36
|
-
} catch (e: unknown) {
|
|
37
|
-
const code = (e as NodeJS.ErrnoException).code;
|
|
38
|
-
if (code !== "ENOENT") {
|
|
39
|
-
return NextResponse.json(
|
|
40
|
-
{ error: "Failed to create file" },
|
|
41
|
-
{ status: 500 },
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
await mkdir(path.dirname(filePath), { recursive: true });
|
|
48
|
-
await writeFile(filePath, "", "utf-8");
|
|
49
|
-
return NextResponse.json({ ok: true, path: rel });
|
|
50
|
-
} catch {
|
|
51
|
-
return NextResponse.json(
|
|
52
|
-
{ error: "Failed to create file" },
|
|
53
|
-
{ status: 500 },
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
export const runtime = "nodejs";
|
|
2
|
-
|
|
3
|
-
import { NextResponse } from "next/server";
|
|
4
|
-
import { resolveWorkspaceForUser } from "@/lib/workspace-context";
|
|
5
|
-
import { getSearchDb } from "@/lib/search/search-db";
|
|
6
|
-
import { ensureIndexer } from "@/lib/search/indexer";
|
|
7
|
-
|
|
8
|
-
// Matches [[slug]], [[slug|alias]], [[slug#anchor]] — slug is [a-z0-9-]+
|
|
9
|
-
const WIKILINK_RE = /\[\[([a-z0-9-]+)(?:\|[^\]#|]+|#[a-z0-9-]+)?\]\]/gi;
|
|
10
|
-
|
|
11
|
-
function slugFromPath(filePath: string): string {
|
|
12
|
-
const base = filePath.split("/").pop() ?? filePath;
|
|
13
|
-
return base.replace(/\.md$/i, "").toLowerCase();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface OutlinkEntry {
|
|
17
|
-
slug: string;
|
|
18
|
-
resolved_path: string | null;
|
|
19
|
-
exists: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export async function GET(request: Request) {
|
|
23
|
-
const ctx = await resolveWorkspaceForUser(request);
|
|
24
|
-
if (!ctx.ok) return NextResponse.json({ error: ctx.code }, { status: ctx.status });
|
|
25
|
-
|
|
26
|
-
const url = new URL(request.url);
|
|
27
|
-
const filePath = url.searchParams.get("path") ?? "";
|
|
28
|
-
if (!filePath) {
|
|
29
|
-
return NextResponse.json({ error: "path required" }, { status: 400 });
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Warm indexer in background (same pattern as backlinks route)
|
|
33
|
-
ensureIndexer(ctx.ws.id, ctx.rootDir).catch((e) =>
|
|
34
|
-
console.error("[outlinks] ensureIndexer failed", e),
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
const db = getSearchDb();
|
|
38
|
-
|
|
39
|
-
// Read body from search index (avoids a file-system read)
|
|
40
|
-
const row = db
|
|
41
|
-
.prepare(`SELECT body FROM docs WHERE ws = ? AND path = ?`)
|
|
42
|
-
.get(ctx.ws.id, filePath) as { body: string } | undefined;
|
|
43
|
-
|
|
44
|
-
if (!row) {
|
|
45
|
-
return NextResponse.json({ error: "file not indexed" }, { status: 404 });
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Extract unique slugs from [[wikilinks]]
|
|
49
|
-
const slugs = new Set<string>();
|
|
50
|
-
const re = new RegExp(WIKILINK_RE.source, "gi");
|
|
51
|
-
let match: RegExpExecArray | null;
|
|
52
|
-
while ((match = re.exec(row.body)) !== null) {
|
|
53
|
-
if (match[1]) slugs.add(match[1].toLowerCase());
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (slugs.size === 0) {
|
|
57
|
-
return NextResponse.json({ links: [] });
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Build slug → path map from indexed .md files (single DB pass)
|
|
61
|
-
const allMdPaths = db
|
|
62
|
-
.prepare(`SELECT path FROM docs WHERE ws = ? AND path LIKE '%.md'`)
|
|
63
|
-
.all(ctx.ws.id) as { path: string }[];
|
|
64
|
-
|
|
65
|
-
const pathBySlug = new Map<string, string>();
|
|
66
|
-
for (const { path } of allMdPaths) {
|
|
67
|
-
pathBySlug.set(slugFromPath(path), path);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const links: OutlinkEntry[] = Array.from(slugs).map((slug) => {
|
|
71
|
-
const resolved_path = pathBySlug.get(slug) ?? null;
|
|
72
|
-
return { slug, resolved_path, exists: resolved_path !== null };
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
return NextResponse.json({ links });
|
|
76
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { mkdir, stat, writeFile } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { NextResponse } from "next/server";
|
|
4
|
-
import { checkOrigin } from "@/lib/auth/csrf";
|
|
5
|
-
import { resolveWorkspaceForUser } from "@/lib/workspace-context";
|
|
6
|
-
import { safeWorkspacePath } from "@/lib/workspaces";
|
|
7
|
-
|
|
8
|
-
const VALID_DIRS = new Set(["entities", "concepts", "comparisons"]);
|
|
9
|
-
const SLUG_RE = /^[a-z0-9-]+$/;
|
|
10
|
-
|
|
11
|
-
type PageBody = {
|
|
12
|
-
dir?: string;
|
|
13
|
-
slug?: string;
|
|
14
|
-
title?: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
function humanizeSlug(slug: string): string {
|
|
18
|
-
return slug
|
|
19
|
-
.split("-")
|
|
20
|
-
.filter(Boolean)
|
|
21
|
-
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
22
|
-
.join(" ");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function dateStampUTC(): string {
|
|
26
|
-
return new Date().toISOString().slice(0, 10);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function singularType(
|
|
30
|
-
dir: "entities" | "concepts" | "comparisons",
|
|
31
|
-
): "entity" | "concept" | "comparison" {
|
|
32
|
-
if (dir === "entities") return "entity";
|
|
33
|
-
if (dir === "concepts") return "concept";
|
|
34
|
-
return "comparison";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export async function POST(request: Request) {
|
|
38
|
-
const csrf = checkOrigin(request);
|
|
39
|
-
if (csrf) return csrf;
|
|
40
|
-
const ctx = await resolveWorkspaceForUser(request, "write");
|
|
41
|
-
if (!ctx.ok) return NextResponse.json({ error: ctx.code }, { status: ctx.status });
|
|
42
|
-
const { rootDir } = ctx;
|
|
43
|
-
|
|
44
|
-
const body: PageBody = await request.json();
|
|
45
|
-
const { dir, slug } = body;
|
|
46
|
-
|
|
47
|
-
if (!dir || !VALID_DIRS.has(dir)) {
|
|
48
|
-
return NextResponse.json({ error: "Invalid dir" }, { status: 400 });
|
|
49
|
-
}
|
|
50
|
-
if (!slug || !SLUG_RE.test(slug)) {
|
|
51
|
-
return NextResponse.json({ error: "Invalid slug" }, { status: 400 });
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const relPath = `${dir}/${slug}.md`;
|
|
55
|
-
const filePath = safeWorkspacePath(rootDir, relPath);
|
|
56
|
-
if (!filePath)
|
|
57
|
-
return NextResponse.json({ error: "Invalid path" }, { status: 400 });
|
|
58
|
-
|
|
59
|
-
try {
|
|
60
|
-
await stat(filePath);
|
|
61
|
-
return NextResponse.json(
|
|
62
|
-
{ error: "Page already exists", path: relPath },
|
|
63
|
-
{ status: 409 },
|
|
64
|
-
);
|
|
65
|
-
} catch (e: unknown) {
|
|
66
|
-
const code = (e as NodeJS.ErrnoException).code;
|
|
67
|
-
if (code !== "ENOENT") {
|
|
68
|
-
return NextResponse.json(
|
|
69
|
-
{ error: "Failed to create page" },
|
|
70
|
-
{ status: 500 },
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const safeDir = dir as "entities" | "concepts" | "comparisons";
|
|
76
|
-
const resolvedTitle =
|
|
77
|
-
typeof body.title === "string" && body.title.trim().length > 0
|
|
78
|
-
? body.title
|
|
79
|
-
: humanizeSlug(slug);
|
|
80
|
-
const content = `---\ntitle: ${resolvedTitle}\ntype: ${singularType(safeDir)}\ntags: []\nupdated: ${dateStampUTC()}\n---\n\n# ${resolvedTitle}\n\n`;
|
|
81
|
-
|
|
82
|
-
try {
|
|
83
|
-
await mkdir(path.dirname(filePath), { recursive: true });
|
|
84
|
-
await writeFile(filePath, content, "utf-8");
|
|
85
|
-
return NextResponse.json({ ok: true, path: relPath, slug, dir: safeDir });
|
|
86
|
-
} catch {
|
|
87
|
-
return NextResponse.json(
|
|
88
|
-
{ error: "Failed to create page" },
|
|
89
|
-
{ status: 500 },
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* POST /api/wiki/presence
|
|
3
|
-
*
|
|
4
|
-
* Human editor heartbeat — sets or clears a human-edit lease so that
|
|
5
|
-
* computeCollabState can return "active" even before the first suggestion.
|
|
6
|
-
*
|
|
7
|
-
* Body: { path: string; action: "open" | "heartbeat" | "close" }
|
|
8
|
-
*
|
|
9
|
-
* Authenticated: requires a logged-in browser session (same as /api/wiki/watch).
|
|
10
|
-
* Agent tokens are NOT accepted here — this endpoint is human-only.
|
|
11
|
-
*/
|
|
12
|
-
export const runtime = "nodejs";
|
|
13
|
-
|
|
14
|
-
import { NextResponse } from "next/server";
|
|
15
|
-
import { resolveWorkspaceForUser } from "@/lib/workspace-context";
|
|
16
|
-
import { safeWorkspacePath } from "@/lib/workspaces";
|
|
17
|
-
import { setLease, clearLease } from "@/lib/proof/lease";
|
|
18
|
-
|
|
19
|
-
function errJson(code: string, message: string, status: number): NextResponse {
|
|
20
|
-
return NextResponse.json({ error: code, message }, { status });
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export async function POST(req: Request): Promise<NextResponse> {
|
|
24
|
-
const ctx = await resolveWorkspaceForUser(req);
|
|
25
|
-
if (!ctx.ok) return errJson(ctx.code, "Not authenticated", ctx.status);
|
|
26
|
-
const { rootDir } = ctx;
|
|
27
|
-
|
|
28
|
-
let body: { path?: unknown; action?: unknown };
|
|
29
|
-
try {
|
|
30
|
-
body = (await req.json()) as { path?: unknown; action?: unknown };
|
|
31
|
-
} catch {
|
|
32
|
-
return errJson("INVALID_PAYLOAD", "Request body must be JSON", 400);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const relPath = typeof body.path === "string" ? body.path : null;
|
|
36
|
-
const action = typeof body.action === "string" ? body.action : null;
|
|
37
|
-
|
|
38
|
-
if (!relPath) return errJson("MISSING_PATH", "path is required", 400);
|
|
39
|
-
if (!action || !["open", "heartbeat", "close"].includes(action)) {
|
|
40
|
-
return errJson("INVALID_ACTION", "action must be open | heartbeat | close", 400);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Basic traversal guard
|
|
44
|
-
if (!safeWorkspacePath(rootDir, relPath)) {
|
|
45
|
-
return errJson("INVALID_PATH", "Path traversal rejected", 400);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (action === "open" || action === "heartbeat") {
|
|
49
|
-
setLease(rootDir, relPath, ctx.userId);
|
|
50
|
-
} else {
|
|
51
|
-
// close
|
|
52
|
-
clearLease(rootDir, relPath, ctx.userId);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return NextResponse.json({ ok: true });
|
|
56
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { readdir, rmdir, stat, unlink } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { NextResponse } from "next/server";
|
|
4
|
-
import { checkOrigin } from "@/lib/auth/csrf";
|
|
5
|
-
import { resolveWorkspaceForUser } from "@/lib/workspace-context";
|
|
6
|
-
import { safeWorkspacePath } from "@/lib/workspaces";
|
|
7
|
-
import { isAppFolder, isNodeApp } from "@/lib/wiki-helpers";
|
|
8
|
-
import { detectGitRepo } from "@/lib/git";
|
|
9
|
-
|
|
10
|
-
export async function GET(request: Request) {
|
|
11
|
-
const ctx = await resolveWorkspaceForUser(request);
|
|
12
|
-
if (!ctx.ok) return NextResponse.json({ error: ctx.code }, { status: ctx.status });
|
|
13
|
-
const { rootDir } = ctx;
|
|
14
|
-
|
|
15
|
-
const { searchParams } = new URL(request.url);
|
|
16
|
-
const dir = searchParams.get("dir") ?? "";
|
|
17
|
-
|
|
18
|
-
const targetDir = safeWorkspacePath(rootDir, dir);
|
|
19
|
-
if (!targetDir)
|
|
20
|
-
return NextResponse.json({ error: "Invalid path" }, { status: 400 });
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
let names: string[];
|
|
24
|
-
try {
|
|
25
|
-
names = await readdir(targetDir);
|
|
26
|
-
} catch {
|
|
27
|
-
return NextResponse.json({ entries: [] });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const entries = await Promise.all(
|
|
31
|
-
names.map(async (name) => {
|
|
32
|
-
const filePath = path.join(targetDir, name);
|
|
33
|
-
const info = await stat(filePath);
|
|
34
|
-
if (!info.isDirectory()) {
|
|
35
|
-
return {
|
|
36
|
-
name,
|
|
37
|
-
type: "file" as const,
|
|
38
|
-
size: info.size,
|
|
39
|
-
modifiedAt: info.mtime.toISOString(),
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const relPath = dir ? `${dir}/${name}` : name;
|
|
44
|
-
const nodeApp = await isNodeApp(rootDir, relPath);
|
|
45
|
-
const isApp = nodeApp ? false : await isAppFolder(rootDir, relPath);
|
|
46
|
-
const type = nodeApp ? "node-app" as const : (isApp ? "app" as const : "dir" as const);
|
|
47
|
-
|
|
48
|
-
const entry: {
|
|
49
|
-
name: string;
|
|
50
|
-
type: "node-app" | "app" | "dir";
|
|
51
|
-
modifiedAt: string;
|
|
52
|
-
git?: { branch: string; dirty: boolean };
|
|
53
|
-
} = {
|
|
54
|
-
name,
|
|
55
|
-
type,
|
|
56
|
-
modifiedAt: info.mtime.toISOString(),
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const gitInfo = await detectGitRepo(filePath);
|
|
60
|
-
if (gitInfo) entry.git = gitInfo;
|
|
61
|
-
return entry;
|
|
62
|
-
}),
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
entries.sort((a, b) => {
|
|
66
|
-
const aIsDir = a.type === "dir" || a.type === "app" || a.type === "node-app";
|
|
67
|
-
const bIsDir = b.type === "dir" || b.type === "app" || b.type === "node-app";
|
|
68
|
-
if (aIsDir !== bIsDir) return aIsDir ? -1 : 1;
|
|
69
|
-
return a.name.localeCompare(b.name);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
return NextResponse.json({ entries });
|
|
73
|
-
} catch {
|
|
74
|
-
return NextResponse.json(
|
|
75
|
-
{ error: "Failed to list directory" },
|
|
76
|
-
{ status: 500 },
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export async function DELETE(request: Request) {
|
|
82
|
-
const csrf = checkOrigin(request);
|
|
83
|
-
if (csrf) return csrf;
|
|
84
|
-
const ctx = await resolveWorkspaceForUser(request, "write");
|
|
85
|
-
if (!ctx.ok) return NextResponse.json({ error: ctx.code }, { status: ctx.status });
|
|
86
|
-
const { rootDir } = ctx;
|
|
87
|
-
|
|
88
|
-
const body: { path?: string } = await request.json();
|
|
89
|
-
const rel = body.path;
|
|
90
|
-
if (!rel || typeof rel !== "string")
|
|
91
|
-
return NextResponse.json({ error: "Invalid path" }, { status: 400 });
|
|
92
|
-
|
|
93
|
-
const filePath = safeWorkspacePath(rootDir, rel);
|
|
94
|
-
if (!filePath || filePath === rootDir)
|
|
95
|
-
return NextResponse.json({ error: "Invalid path" }, { status: 400 });
|
|
96
|
-
|
|
97
|
-
try {
|
|
98
|
-
const info = await stat(filePath);
|
|
99
|
-
if (info.isDirectory()) {
|
|
100
|
-
await rmdir(filePath);
|
|
101
|
-
} else {
|
|
102
|
-
await unlink(filePath);
|
|
103
|
-
}
|
|
104
|
-
return NextResponse.json({ ok: true });
|
|
105
|
-
} catch (e: unknown) {
|
|
106
|
-
const code = (e as NodeJS.ErrnoException).code;
|
|
107
|
-
if (code === "ENOENT")
|
|
108
|
-
return NextResponse.json({ error: "Not found" }, { status: 404 });
|
|
109
|
-
if (code === "ENOTEMPTY")
|
|
110
|
-
return NextResponse.json(
|
|
111
|
-
{ error: "Folder is not empty" },
|
|
112
|
-
{ status: 409 },
|
|
113
|
-
);
|
|
114
|
-
return NextResponse.json({ error: "Delete failed" }, { status: 500 });
|
|
115
|
-
}
|
|
116
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export const runtime = "nodejs";
|
|
2
|
-
|
|
3
|
-
import { NextResponse } from "next/server";
|
|
4
|
-
import { checkOrigin } from "@/lib/auth/csrf";
|
|
5
|
-
import { resolveWorkspaceForUser } from "@/lib/workspace-context";
|
|
6
|
-
import { ensureIndexer, ftsSearch } from "@/lib/search/indexer";
|
|
7
|
-
|
|
8
|
-
const HARD_LIMIT = 200;
|
|
9
|
-
|
|
10
|
-
export async function POST(request: Request) {
|
|
11
|
-
const csrf = checkOrigin(request);
|
|
12
|
-
if (csrf) return csrf;
|
|
13
|
-
|
|
14
|
-
const ctx = await resolveWorkspaceForUser(request);
|
|
15
|
-
if (!ctx.ok) return NextResponse.json({ error: ctx.code }, { status: ctx.status });
|
|
16
|
-
|
|
17
|
-
let body: { query?: unknown; limit?: unknown };
|
|
18
|
-
try {
|
|
19
|
-
body = (await request.json()) as typeof body;
|
|
20
|
-
} catch {
|
|
21
|
-
return NextResponse.json({ error: "INVALID_PAYLOAD" }, { status: 400 });
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const query = typeof body.query === "string" ? body.query : "";
|
|
25
|
-
const limit = Math.min(
|
|
26
|
-
typeof body.limit === "number" ? body.limit : 30,
|
|
27
|
-
HARD_LIMIT,
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
// Lazy init: fire-and-forget. Returns results from whatever is already indexed;
|
|
31
|
-
// index warms up in background on first call per workspace.
|
|
32
|
-
ensureIndexer(ctx.ws.id, ctx.rootDir).catch((e) =>
|
|
33
|
-
console.error("[search] ensureIndexer failed", e),
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const result = ftsSearch(ctx.ws.id, query, limit);
|
|
37
|
-
|
|
38
|
-
return NextResponse.json({
|
|
39
|
-
kind: "fts",
|
|
40
|
-
query,
|
|
41
|
-
matches: result.matches,
|
|
42
|
-
truncated: result.truncated,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { readdir } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { NextResponse } from "next/server";
|
|
4
|
-
import { resolveWorkspaceForUser } from "@/lib/workspace-context";
|
|
5
|
-
|
|
6
|
-
type SlugBuckets = {
|
|
7
|
-
entities: string[];
|
|
8
|
-
concepts: string[];
|
|
9
|
-
comparisons: string[];
|
|
10
|
-
root: string[];
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
async function readMarkdownSlugsFromDir(dirPath: string): Promise<string[]> {
|
|
14
|
-
try {
|
|
15
|
-
const entries = await readdir(dirPath, { withFileTypes: true });
|
|
16
|
-
return entries
|
|
17
|
-
.filter(
|
|
18
|
-
(entry) => entry.isFile() && entry.name.toLowerCase().endsWith(".md"),
|
|
19
|
-
)
|
|
20
|
-
.map((entry) => entry.name.slice(0, -3))
|
|
21
|
-
.sort((a, b) => a.localeCompare(b));
|
|
22
|
-
} catch (e: unknown) {
|
|
23
|
-
const code = (e as NodeJS.ErrnoException).code;
|
|
24
|
-
if (code === "ENOENT") return [];
|
|
25
|
-
throw e;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export async function GET(request: Request) {
|
|
30
|
-
const ctx = await resolveWorkspaceForUser(request);
|
|
31
|
-
if (!ctx.ok) return NextResponse.json({ error: ctx.code }, { status: ctx.status });
|
|
32
|
-
const { rootDir } = ctx;
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
// Scan root + known dirs (entities, concepts, comparisons for wiki compat)
|
|
36
|
-
// plus any other immediate subdirectories
|
|
37
|
-
const [entities, concepts, comparisons, root] = await Promise.all([
|
|
38
|
-
readMarkdownSlugsFromDir(path.join(rootDir, "entities")),
|
|
39
|
-
readMarkdownSlugsFromDir(path.join(rootDir, "concepts")),
|
|
40
|
-
readMarkdownSlugsFromDir(path.join(rootDir, "comparisons")),
|
|
41
|
-
readMarkdownSlugsFromDir(rootDir),
|
|
42
|
-
]);
|
|
43
|
-
|
|
44
|
-
const body: SlugBuckets = { entities, concepts, comparisons, root };
|
|
45
|
-
return NextResponse.json(body, {
|
|
46
|
-
headers: { "Cache-Control": "private, max-age=10" },
|
|
47
|
-
});
|
|
48
|
-
} catch {
|
|
49
|
-
return NextResponse.json(
|
|
50
|
-
{ error: "Failed to list slugs" },
|
|
51
|
-
{ status: 500 },
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
}
|