wiki-viewer 1.8.2 → 1.8.4

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 (102) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +5 -5
  3. package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
  4. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  5. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
  12. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  14. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  15. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  16. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  18. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  21. package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/system/browse/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/index.html +1 -1
  26. package/.next/standalone/.next/server/app/index.rsc +3 -3
  27. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  28. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  29. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  30. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  31. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  32. package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
  33. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  35. package/.next/standalone/.next/server/app/signin/page/build-manifest.json +2 -2
  36. package/.next/standalone/.next/server/app/signin/page_client-reference-manifest.js +1 -1
  37. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-inabx._.js +1 -1
  38. package/.next/standalone/.next/server/chunks/[root-of-the-server]__00lep-u._.js +1 -1
  39. package/.next/standalone/.next/server/chunks/node_modules__pnpm_0aj5g-w._.js +1 -1
  40. package/.next/standalone/.next/server/chunks/ssr/{0~w0_katex_dist_katex_mjs_04mhawr._.js → 0~w0_katex_dist_katex_mjs_0hyln.b._.js} +1 -1
  41. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__09~x2v~._.js → [root-of-the-server]__0du58sw._.js} +2 -2
  42. package/.next/standalone/.next/server/chunks/ssr/_0pqaawz._.js +19 -19
  43. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0shlang._.js → node_modules__pnpm_0.kyqfq._.js} +1 -1
  44. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_04n0h6.._.js → node_modules__pnpm_0.~goq~._.js} +1 -1
  45. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_011vy_q._.js → node_modules__pnpm_00y7foi._.js} +2 -2
  46. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0yiz.-t._.js → node_modules__pnpm_03.1jli._.js} +1 -1
  47. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_093dp2q._.js → node_modules__pnpm_03z3na-._.js} +1 -1
  48. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_01o_5qt._.js → node_modules__pnpm_05~w-ok._.js} +1 -1
  49. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0b8qx0g._.js → node_modules__pnpm_09d5yyu._.js} +1 -1
  50. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0wmx9kq._.js → node_modules__pnpm_09eo8jh._.js} +2 -2
  51. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0nw5ou2._.js → node_modules__pnpm_0adm8h6._.js} +1 -1
  52. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0bbc---._.js → node_modules__pnpm_0arbjru._.js} +1 -1
  53. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0t9jb7d._.js → node_modules__pnpm_0b5fla7._.js} +1 -1
  54. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_124u4o2._.js → node_modules__pnpm_0beormu._.js} +2 -2
  55. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_13tajgx._.js → node_modules__pnpm_0c7u76a._.js} +2 -2
  56. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09ej62_._.js → node_modules__pnpm_0dbr7c2._.js} +1 -1
  57. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0s0ur~d._.js → node_modules__pnpm_0d~ida~._.js} +1 -1
  58. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09ljbdz._.js → node_modules__pnpm_0elpfsb._.js} +2 -2
  59. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0hlzy8f._.js → node_modules__pnpm_0fh.6ir._.js} +1 -1
  60. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09~_ob2._.js → node_modules__pnpm_0fm6wcx._.js} +1 -1
  61. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0o.dn8o._.js → node_modules__pnpm_0iikbcy._.js} +1 -1
  62. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0hk6xys._.js → node_modules__pnpm_0mvih7b._.js} +2 -2
  63. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0a01ng7._.js → node_modules__pnpm_0qd2ovj._.js} +2 -2
  64. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0c.309.._.js → node_modules__pnpm_0s4yn43._.js} +1 -1
  65. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0sq3c2r._.js → node_modules__pnpm_0s8fvbn._.js} +1 -1
  66. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0xfx0sf._.js → node_modules__pnpm_0tq8zs6._.js} +1 -1
  67. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_11sut1u._.js → node_modules__pnpm_0vyv.lz._.js} +1 -1
  68. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0c8aunj._.js → node_modules__pnpm_0xa.ko1._.js} +1 -1
  69. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0.96tmo._.js → node_modules__pnpm_12.ymhl._.js} +1 -1
  70. package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
  71. package/.next/standalone/.next/server/middleware-manifest.json +1 -1
  72. package/.next/standalone/.next/server/pages/404.html +1 -1
  73. package/.next/standalone/.next/server/pages/500.html +1 -1
  74. package/.next/standalone/.next/static/chunks/{0vp-ahhagxptc.js → 06iw_iy5e90d4.js} +1 -1
  75. package/.next/standalone/.next/static/chunks/125_k3o0s4cid.js +129 -0
  76. package/.next/standalone/.next/static/chunks/167ph4xws_-61.css +2 -0
  77. package/.next/standalone/.next/static/chunks/{turbopack-12~z-mr7b9b50.js → turbopack-0lf4~b-ofzbm6.js} +1 -1
  78. package/.next/standalone/AGENTS.md +104 -0
  79. package/.next/standalone/bin/wiki-viewer.js +0 -0
  80. package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
  81. package/.next/standalone/package.json +1 -1
  82. package/.next/standalone/packages/wiki-viewer-mcp/dist/index.js +0 -0
  83. package/.next/standalone/src/app/api/wiki/app/route.ts +7 -4
  84. package/.next/standalone/src/app/page.tsx +582 -192
  85. package/.next/standalone/src/components/editor/backlinks-panel.tsx +152 -0
  86. package/.next/standalone/src/components/editor/document-outline.tsx +221 -0
  87. package/.next/standalone/src/components/editor/editor.tsx +145 -48
  88. package/.next/standalone/src/components/editor/node-app-viewer.tsx +65 -7
  89. package/.next/standalone/src/components/editor/slash-commands.tsx +216 -41
  90. package/.next/standalone/src/components/editor/source-viewer.tsx +29 -2
  91. package/.next/standalone/src/components/search/search-command-dialog.tsx +183 -46
  92. package/.next/standalone/src/lib/app-runner.ts +57 -16
  93. package/.next/standalone/src/stores/pin-store.ts +56 -0
  94. package/.next/standalone/src/stores/recent-store.ts +51 -0
  95. package/.next/standalone/tsconfig.tsbuildinfo +1 -1
  96. package/package.json +10 -16
  97. package/.next/standalone/.next/static/chunks/0c_~zevf2n0r4.css +0 -2
  98. package/.next/standalone/.next/static/chunks/16r--8~rpehcz.js +0 -129
  99. package/.next/standalone/src/components/wiki/markdown-preview.tsx +0 -120
  100. /package/.next/standalone/.next/static/{t_k0ztuf0V-iA-kgeez18 → o1H_4UveBVPqClSUldzEv}/_buildManifest.js +0 -0
  101. /package/.next/standalone/.next/static/{t_k0ztuf0V-iA-kgeez18 → o1H_4UveBVPqClSUldzEv}/_clientMiddlewareManifest.js +0 -0
  102. /package/.next/standalone/.next/static/{t_k0ztuf0V-iA-kgeez18 → o1H_4UveBVPqClSUldzEv}/_ssgManifest.js +0 -0
@@ -73,30 +73,71 @@ interface Cmd {
73
73
  isVite: boolean;
74
74
  }
75
75
 
76
- function detectCmd(dir: string, pm: PM): Cmd | null {
76
+ interface Pkg {
77
+ scripts?: Record<string, string>;
78
+ main?: string;
79
+ dependencies?: Record<string, string>;
80
+ devDependencies?: Record<string, string>;
81
+ }
82
+
83
+ function readPkg(dir: string): Pkg | null {
77
84
  const pkgPath = path.join(dir, "package.json");
78
85
  if (!existsSync(pkgPath)) return null;
86
+ try {
87
+ return JSON.parse(readFileSync(pkgPath, "utf-8")) as Pkg;
88
+ } catch {
89
+ return null;
90
+ }
91
+ }
79
92
 
80
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8")) as {
81
- scripts?: Record<string, string>;
82
- main?: string;
83
- dependencies?: Record<string, string>;
84
- devDependencies?: Record<string, string>;
93
+ function hasViteDep(pkg: Pkg): boolean {
94
+ const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
95
+ return Object.keys(allDeps).some((k) => k === "vite" || k.includes("vite"));
96
+ }
97
+
98
+ /**
99
+ * Default script chosen when the user doesn't pick one explicitly.
100
+ * Priority: start > preview (built) > dev.
101
+ */
102
+ function defaultScript(dir: string, scripts: Record<string, string>): string | null {
103
+ if (scripts.start) return "start";
104
+ if (scripts.preview && existsSync(path.join(dir, "dist"))) return "preview";
105
+ if (scripts.dev) return "dev";
106
+ return null;
107
+ }
108
+
109
+ /**
110
+ * List the npm scripts available to launch, plus which one is the default.
111
+ * Returns empty scripts list when only `main` is runnable (node entry).
112
+ */
113
+ export function getScripts(absPath: string): { scripts: string[]; defaultScript: string | null } {
114
+ const pkg = readPkg(absPath);
115
+ if (!pkg) return { scripts: [], defaultScript: null };
116
+ const scripts = pkg.scripts ?? {};
117
+ return {
118
+ scripts: Object.keys(scripts),
119
+ defaultScript: defaultScript(absPath, scripts),
85
120
  };
121
+ }
122
+
123
+ function detectCmd(dir: string, pm: PM, script?: string): Cmd | null {
124
+ const pkg = readPkg(dir);
125
+ if (!pkg) return null;
126
+
86
127
  const scripts = pkg.scripts ?? {};
87
- const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
88
- const hasVite = Object.keys(allDeps).some((k) => k === "vite" || k.includes("vite"));
128
+ const hasVite = hasViteDep(pkg);
89
129
 
90
- const run = (script: string, extraArgs: string[] = []): Cmd => ({
130
+ const run = (s: string, extraArgs: string[] = []): Cmd => ({
91
131
  bin: pm,
92
- args: ["run", script, ...(extraArgs.length ? ["--", ...extraArgs] : [])],
132
+ args: ["run", s, ...(extraArgs.length ? ["--", ...extraArgs] : [])],
93
133
  isVite: hasVite,
94
134
  });
95
135
 
96
- // Priority: start > preview (built) > dev > node main
97
- if (scripts.start) return run("start");
98
- if (scripts.preview && existsSync(path.join(dir, "dist"))) return run("preview");
99
- if (scripts.dev) return run("dev");
136
+ // Explicit script choice wins
137
+ if (script && scripts[script]) return run(script);
138
+
139
+ const def = defaultScript(dir, scripts);
140
+ if (def) return run(def);
100
141
  if (pkg.main) return { bin: "node", args: [pkg.main], isVite: false };
101
142
  return null;
102
143
  }
@@ -121,7 +162,7 @@ export function getStatus(relPath: string): { status: AppStatus; port?: number;
121
162
  return { status: app.status, port: app.port || undefined, error: app.error, logs: app.logs };
122
163
  }
123
164
 
124
- export async function startApp(relPath: string, absPath: string): Promise<{ port: number }> {
165
+ export async function startApp(relPath: string, absPath: string, script?: string): Promise<{ port: number }> {
125
166
  const existing = apps.get(relPath);
126
167
  if (existing && existing.status !== "stopped" && existing.status !== "error") {
127
168
  return { port: existing.port };
@@ -129,7 +170,7 @@ export async function startApp(relPath: string, absPath: string): Promise<{ port
129
170
 
130
171
  const port = await findFreePort();
131
172
  const pm = detectPM(absPath);
132
- const cmd = detectCmd(absPath, pm);
173
+ const cmd = detectCmd(absPath, pm, script);
133
174
  if (!cmd) throw new Error("No runnable script found in package.json (need start, preview, or dev)");
134
175
 
135
176
  const entry: RunningApp = { port, process: null, status: "installing", logs: [] };
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import { create } from "zustand";
3
+
4
+ export interface PinnedEntry {
5
+ path: string;
6
+ name: string;
7
+ type?: "file" | "app" | "node-app";
8
+ }
9
+
10
+ interface PinState {
11
+ pins: PinnedEntry[];
12
+ loadForWorkspace: (workspaceId: string | null | undefined) => void;
13
+ toggle: (entry: PinnedEntry, workspaceId: string | null | undefined) => void;
14
+ isPinned: (path: string) => boolean;
15
+ }
16
+
17
+ function storageKey(ws: string | null | undefined): string {
18
+ return ws ? `wiki-pinned-files-${ws}` : "wiki-pinned-files";
19
+ }
20
+
21
+ function readStorage(ws: string | null | undefined): PinnedEntry[] {
22
+ if (typeof window === "undefined") return [];
23
+ try {
24
+ const raw = localStorage.getItem(storageKey(ws));
25
+ return raw ? (JSON.parse(raw) as PinnedEntry[]) : [];
26
+ } catch {
27
+ return [];
28
+ }
29
+ }
30
+
31
+ function writeStorage(ws: string | null | undefined, items: PinnedEntry[]): void {
32
+ if (typeof window === "undefined") return;
33
+ localStorage.setItem(storageKey(ws), JSON.stringify(items));
34
+ }
35
+
36
+ export const usePinStore = create<PinState>((set, get) => ({
37
+ pins: [],
38
+
39
+ loadForWorkspace: (ws) => {
40
+ set({ pins: readStorage(ws) });
41
+ },
42
+
43
+ toggle: (entry, ws) => {
44
+ const current = readStorage(ws);
45
+ const exists = current.some((p) => p.path === entry.path);
46
+ const next = exists
47
+ ? current.filter((p) => p.path !== entry.path)
48
+ : [...current, entry];
49
+ writeStorage(ws, next);
50
+ set({ pins: next });
51
+ },
52
+
53
+ isPinned: (path) => {
54
+ return get().pins.some((p) => p.path === path);
55
+ },
56
+ }));
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import { create } from "zustand";
3
+
4
+ export interface RecentEntry {
5
+ path: string;
6
+ name: string;
7
+ type?: "file" | "app" | "node-app";
8
+ }
9
+
10
+ interface RecentState {
11
+ recents: RecentEntry[];
12
+ loadForWorkspace: (workspaceId: string | null | undefined) => void;
13
+ push: (entry: RecentEntry, workspaceId: string | null | undefined) => void;
14
+ }
15
+
16
+ const MAX_RECENTS = 15;
17
+
18
+ function storageKey(ws: string | null | undefined): string {
19
+ return ws ? `wiki-recent-files-${ws}` : "wiki-recent-files";
20
+ }
21
+
22
+ function readStorage(ws: string | null | undefined): RecentEntry[] {
23
+ if (typeof window === "undefined") return [];
24
+ try {
25
+ const raw = localStorage.getItem(storageKey(ws));
26
+ return raw ? (JSON.parse(raw) as RecentEntry[]) : [];
27
+ } catch {
28
+ return [];
29
+ }
30
+ }
31
+
32
+ function writeStorage(ws: string | null | undefined, items: RecentEntry[]): void {
33
+ if (typeof window === "undefined") return;
34
+ localStorage.setItem(storageKey(ws), JSON.stringify(items));
35
+ }
36
+
37
+ export const useRecentStore = create<RecentState>((set) => ({
38
+ recents: [],
39
+
40
+ loadForWorkspace: (ws) => {
41
+ set({ recents: readStorage(ws) });
42
+ },
43
+
44
+ push: (entry, ws) => {
45
+ const current = readStorage(ws);
46
+ const deduped = current.filter((r) => r.path !== entry.path);
47
+ const next = [entry, ...deduped].slice(0, MAX_RECENTS);
48
+ writeStorage(ws, next);
49
+ set({ recents: next });
50
+ },
51
+ }));