pi-para 0.6.6 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +4 -6
- package/CHANGELOG.md +22 -0
- package/CONFIGURATION.md +1 -16
- package/README.md +2 -13
- package/SETUP.md +1 -7
- package/STRUCTURE.md +7 -18
- package/dist/cli-legacy.d.ts +2 -1
- package/dist/cli-legacy.d.ts.map +1 -1
- package/dist/cli-legacy.js +13 -25
- package/dist/cli-legacy.js.map +1 -1
- package/dist/cli.d.ts +2 -24
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +29 -271
- package/dist/cli.js.map +1 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +1 -28
- package/dist/commands.js.map +1 -1
- package/dist/config.d.ts +1 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -5
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +2 -1
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -64
- package/dist/index.js.map +1 -1
- package/dist/link-utils.d.ts +1 -1
- package/dist/link-utils.js +1 -1
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +9 -3
- package/dist/scheduler/index.js.map +1 -1
- package/dist/settings.d.ts +0 -3
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +0 -11
- package/dist/settings.js.map +1 -1
- package/dist/store.d.ts +11 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +48 -16
- package/dist/store.js.map +1 -1
- package/dist/tools/edit-read.d.ts +18 -0
- package/dist/tools/edit-read.d.ts.map +1 -0
- package/dist/tools/edit-read.js +161 -0
- package/dist/tools/edit-read.js.map +1 -0
- package/dist/tools/ingest.d.ts +12 -0
- package/dist/tools/ingest.d.ts.map +1 -0
- package/dist/tools/ingest.js +48 -0
- package/dist/tools/ingest.js.map +1 -0
- package/dist/tools/lint.d.ts +10 -0
- package/dist/tools/lint.d.ts.map +1 -0
- package/dist/tools/lint.js +57 -0
- package/dist/tools/lint.js.map +1 -0
- package/dist/tools/migrate.d.ts +6 -0
- package/dist/tools/migrate.d.ts.map +1 -0
- package/dist/tools/migrate.js +36 -0
- package/dist/tools/migrate.js.map +1 -0
- package/dist/tools/move.d.ts +9 -0
- package/dist/tools/move.d.ts.map +1 -0
- package/dist/tools/move.js +61 -0
- package/dist/tools/move.js.map +1 -0
- package/dist/tools/query.d.ts +12 -0
- package/dist/tools/query.d.ts.map +1 -0
- package/dist/tools/query.js +47 -0
- package/dist/tools/query.js.map +1 -0
- package/dist/tools/schemas.d.ts +109 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/schemas.js +80 -0
- package/dist/tools/schemas.js.map +1 -0
- package/dist/tools/shared.d.ts +14 -0
- package/dist/tools/shared.d.ts.map +1 -0
- package/dist/tools/shared.js +25 -0
- package/dist/tools/shared.js.map +1 -0
- package/dist/tools/summarize.d.ts +8 -0
- package/dist/tools/summarize.d.ts.map +1 -0
- package/dist/tools/summarize.js +82 -0
- package/dist/tools/summarize.js.map +1 -0
- package/dist/tools/write.d.ts +23 -0
- package/dist/tools/write.d.ts.map +1 -0
- package/dist/tools/write.js +215 -0
- package/dist/tools/write.js.map +1 -0
- package/dist/tools.d.ts +1 -8
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +13 -795
- package/dist/tools.js.map +1 -1
- package/dist/wiki-tool-guidance.js +2 -2
- package/dist/wiki-tool-guidance.js.map +1 -1
- package/package.json +2 -6
- package/src/cli-legacy.ts +14 -26
- package/src/cli.ts +29 -293
- package/src/commands.ts +0 -21
- package/src/config.ts +1 -6
- package/src/context.ts +2 -1
- package/src/index.ts +5 -66
- package/src/link-utils.ts +1 -1
- package/src/scheduler/index.ts +9 -3
- package/src/settings.ts +0 -14
- package/src/store.ts +52 -15
- package/src/tools/edit-read.ts +193 -0
- package/src/tools/ingest.ts +63 -0
- package/src/tools/lint.ts +74 -0
- package/src/tools/migrate.ts +44 -0
- package/src/tools/move.ts +79 -0
- package/src/tools/query.ts +63 -0
- package/src/tools/schemas.ts +157 -0
- package/src/tools/shared.ts +35 -0
- package/src/tools/summarize.ts +89 -0
- package/src/tools/write.ts +252 -0
- package/src/tools.ts +18 -1046
- package/src/wiki-tool-guidance.ts +2 -2
- package/dist/daemon.d.ts +0 -49
- package/dist/daemon.d.ts.map +0 -1
- package/dist/daemon.js +0 -226
- package/dist/daemon.js.map +0 -1
- package/dist/link-discovery.d.ts +0 -40
- package/dist/link-discovery.d.ts.map +0 -1
- package/dist/link-discovery.js +0 -122
- package/dist/link-discovery.js.map +0 -1
- package/dist/maintainer.d.ts +0 -24
- package/dist/maintainer.d.ts.map +0 -1
- package/dist/maintainer.js +0 -358
- package/dist/maintainer.js.map +0 -1
- package/dist/watcher.d.ts +0 -25
- package/dist/watcher.d.ts.map +0 -1
- package/dist/watcher.js +0 -84
- package/dist/watcher.js.map +0 -1
- package/dist/webui/client/dist/index.html +0 -1885
- package/dist/webui/server.d.ts +0 -31
- package/dist/webui/server.d.ts.map +0 -1
- package/dist/webui/server.js +0 -566
- package/dist/webui/server.js.map +0 -1
- package/scripts/build-assets.mjs +0 -17
- package/src/daemon.ts +0 -288
- package/src/link-discovery.ts +0 -170
- package/src/maintainer.ts +0 -404
- package/src/python/__pycache__/minimax_lm.cpython-312.pyc +0 -0
- package/src/python/minimax_lm.py +0 -198
- package/src/python/rlm_capture.py +0 -215
- package/src/watcher.ts +0 -101
- package/src/webui/client/dist/index.html +0 -1885
- package/src/webui/server.ts +0 -765
package/dist/webui/server.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Web Wiki HTTP Server
|
|
3
|
-
*
|
|
4
|
-
* Serves the React SPA and provides REST API endpoints for wiki operations.
|
|
5
|
-
* Uses Node's built-in http module — no Express dependency.
|
|
6
|
-
*
|
|
7
|
-
* API:
|
|
8
|
-
* GET /api/pages — list pages grouped by PARA category
|
|
9
|
-
* GET /api/pages/:category/:slug — get page content + frontmatter
|
|
10
|
-
* PUT /api/pages/:category/:slug — update page body
|
|
11
|
-
* POST /api/pages/:category/:slug/move — move page to different category
|
|
12
|
-
* GET /api/search?q=query — BM25 search via qmd store
|
|
13
|
-
* GET /api/graph — nodes + edges from wikilinks
|
|
14
|
-
* GET /api/log — activity log entries
|
|
15
|
-
* GET /api/sessions — session digest entries
|
|
16
|
-
* GET / — serve React SPA
|
|
17
|
-
* GET /* — serve static files, fallback to index.html
|
|
18
|
-
*/
|
|
19
|
-
import type { QMDStore } from "../store.js";
|
|
20
|
-
export interface WebWikiConfig {
|
|
21
|
-
enabled: boolean;
|
|
22
|
-
host: string;
|
|
23
|
-
port: number;
|
|
24
|
-
}
|
|
25
|
-
interface ServerHandle {
|
|
26
|
-
close: () => Promise<void>;
|
|
27
|
-
url: string;
|
|
28
|
-
}
|
|
29
|
-
export declare function startServer(wikiDir: string, store: QMDStore | null, config: WebWikiConfig): ServerHandle;
|
|
30
|
-
export {};
|
|
31
|
-
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/webui/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAoBH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAK5C,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;CACb;AA8kBD,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,QAAQ,GAAG,IAAI,EACtB,MAAM,EAAE,aAAa,GACpB,YAAY,CAuHd"}
|
package/dist/webui/server.js
DELETED
|
@@ -1,566 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Web Wiki HTTP Server
|
|
3
|
-
*
|
|
4
|
-
* Serves the React SPA and provides REST API endpoints for wiki operations.
|
|
5
|
-
* Uses Node's built-in http module — no Express dependency.
|
|
6
|
-
*
|
|
7
|
-
* API:
|
|
8
|
-
* GET /api/pages — list pages grouped by PARA category
|
|
9
|
-
* GET /api/pages/:category/:slug — get page content + frontmatter
|
|
10
|
-
* PUT /api/pages/:category/:slug — update page body
|
|
11
|
-
* POST /api/pages/:category/:slug/move — move page to different category
|
|
12
|
-
* GET /api/search?q=query — BM25 search via qmd store
|
|
13
|
-
* GET /api/graph — nodes + edges from wikilinks
|
|
14
|
-
* GET /api/log — activity log entries
|
|
15
|
-
* GET /api/sessions — session digest entries
|
|
16
|
-
* GET / — serve React SPA
|
|
17
|
-
* GET /* — serve static files, fallback to index.html
|
|
18
|
-
*/
|
|
19
|
-
import { createServer } from "node:http";
|
|
20
|
-
import { readFile, stat } from "node:fs/promises";
|
|
21
|
-
import { join, extname } from "node:path";
|
|
22
|
-
import { fileURLToPath } from "node:url";
|
|
23
|
-
import { listPages, readPage, writePage, movePage, gitCommit, PARA_CATEGORIES, } from "../wiki.js";
|
|
24
|
-
import { extractWikilinks } from "../link-utils.js";
|
|
25
|
-
import { redactSecrets } from "../redact.js";
|
|
26
|
-
import { searchWiki, reindex } from "../store.js";
|
|
27
|
-
import { readSessionDigests } from "../raw.js";
|
|
28
|
-
// -- MIME types --------------------------------------------------------------
|
|
29
|
-
const MIME_TYPES = {
|
|
30
|
-
".html": "text/html; charset=utf-8",
|
|
31
|
-
".js": "application/javascript; charset=utf-8",
|
|
32
|
-
".mjs": "application/javascript; charset=utf-8",
|
|
33
|
-
".css": "text/css; charset=utf-8",
|
|
34
|
-
".json": "application/json; charset=utf-8",
|
|
35
|
-
".png": "image/png",
|
|
36
|
-
".jpg": "image/jpeg",
|
|
37
|
-
".jpeg": "image/jpeg",
|
|
38
|
-
".gif": "image/gif",
|
|
39
|
-
".svg": "image/svg+xml",
|
|
40
|
-
".ico": "image/x-icon",
|
|
41
|
-
".woff": "font/woff",
|
|
42
|
-
".woff2": "font/woff2",
|
|
43
|
-
".ttf": "font/ttf",
|
|
44
|
-
".map": "application/json",
|
|
45
|
-
};
|
|
46
|
-
// -- Helpers ----------------------------------------------------------------
|
|
47
|
-
// extractWikilinks imported from ../link-utils.js
|
|
48
|
-
function json(res, data, statusCode = 200) {
|
|
49
|
-
const body = JSON.stringify(data);
|
|
50
|
-
res.writeHead(statusCode, {
|
|
51
|
-
"Content-Type": "application/json; charset=utf-8",
|
|
52
|
-
"Content-Length": Buffer.byteLength(body),
|
|
53
|
-
});
|
|
54
|
-
res.end(body);
|
|
55
|
-
}
|
|
56
|
-
function errorResponse(res, statusCode, message) {
|
|
57
|
-
json(res, { error: message }, statusCode);
|
|
58
|
-
}
|
|
59
|
-
function setCorsHeaders(res) {
|
|
60
|
-
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
61
|
-
res.setHeader("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE, OPTIONS");
|
|
62
|
-
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
|
|
63
|
-
}
|
|
64
|
-
async function readBody(req) {
|
|
65
|
-
return new Promise((resolve, reject) => {
|
|
66
|
-
const chunks = [];
|
|
67
|
-
let size = 0;
|
|
68
|
-
const MAX_BODY = 5 * 1024 * 1024; // 5MB limit
|
|
69
|
-
req.on("data", (chunk) => {
|
|
70
|
-
size += chunk.length;
|
|
71
|
-
if (size > MAX_BODY) {
|
|
72
|
-
req.destroy();
|
|
73
|
-
reject(new Error("Request body too large"));
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
chunks.push(chunk);
|
|
77
|
-
});
|
|
78
|
-
req.on("end", () => resolve(Buffer.concat(chunks).toString("utf-8")));
|
|
79
|
-
req.on("error", reject);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
function parseJsonBody(raw) {
|
|
83
|
-
try {
|
|
84
|
-
return JSON.parse(raw);
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function isValidCategory(cat) {
|
|
91
|
-
return PARA_CATEGORIES.includes(cat);
|
|
92
|
-
}
|
|
93
|
-
function matchRoute(pattern, pathname) {
|
|
94
|
-
const patternParts = pattern.split("/").filter(Boolean);
|
|
95
|
-
const pathParts = pathname.split("/").filter(Boolean);
|
|
96
|
-
if (patternParts.length !== pathParts.length)
|
|
97
|
-
return null;
|
|
98
|
-
const params = {};
|
|
99
|
-
for (let i = 0; i < patternParts.length; i++) {
|
|
100
|
-
const pp = patternParts[i];
|
|
101
|
-
if (pp.startsWith(":")) {
|
|
102
|
-
params[pp.slice(1)] = decodeURIComponent(pathParts[i]);
|
|
103
|
-
}
|
|
104
|
-
else if (pp !== pathParts[i]) {
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return { params };
|
|
109
|
-
}
|
|
110
|
-
function parseLogEntries(content) {
|
|
111
|
-
const entries = [];
|
|
112
|
-
const entryPattern = /^## \[([^\]]+)\] (\w+) \| (.+)$/gm;
|
|
113
|
-
let match;
|
|
114
|
-
while ((match = entryPattern.exec(content)) !== null) {
|
|
115
|
-
const date = match[1].trim();
|
|
116
|
-
const operation = match[2].trim();
|
|
117
|
-
const summary = match[3].trim();
|
|
118
|
-
// Extract the block after this heading until the next heading or end
|
|
119
|
-
const startIdx = match.index + match[0].length;
|
|
120
|
-
const nextHeading = content.indexOf("\n## ", startIdx);
|
|
121
|
-
const block = nextHeading === -1
|
|
122
|
-
? content.slice(startIdx)
|
|
123
|
-
: content.slice(startIdx, nextHeading);
|
|
124
|
-
// Parse "Pages: ..." line
|
|
125
|
-
const pagesMatch = /^Pages:\s*(.+)$/m.exec(block);
|
|
126
|
-
const pages = [];
|
|
127
|
-
if (pagesMatch && pagesMatch[1].trim() !== "none") {
|
|
128
|
-
for (const p of pagesMatch[1].split(",")) {
|
|
129
|
-
const trimmed = p.trim();
|
|
130
|
-
if (trimmed)
|
|
131
|
-
pages.push(trimmed);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
entries.push({ date, operation, summary, pages });
|
|
135
|
-
}
|
|
136
|
-
return entries;
|
|
137
|
-
}
|
|
138
|
-
// -- Route handlers ---------------------------------------------------------
|
|
139
|
-
async function handleListPages(wikiDir, url, _req, res) {
|
|
140
|
-
const refs = await listPages(wikiDir);
|
|
141
|
-
// Build flat list with metadata
|
|
142
|
-
const allPages = [];
|
|
143
|
-
for (const ref of refs) {
|
|
144
|
-
const page = await readPage(wikiDir, ref.category, ref.slug);
|
|
145
|
-
allPages.push({
|
|
146
|
-
slug: ref.slug,
|
|
147
|
-
title: ref.title,
|
|
148
|
-
path: ref.path,
|
|
149
|
-
category: ref.category,
|
|
150
|
-
scope: page?.frontmatter.scope ?? [],
|
|
151
|
-
tags: page?.frontmatter.tags ?? [],
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
const total = allPages.length;
|
|
155
|
-
const rawPage = url.searchParams.get("page");
|
|
156
|
-
const rawLimit = url.searchParams.get("limit");
|
|
157
|
-
// Default: return grouped by category (what the SPA client expects)
|
|
158
|
-
if (!rawPage && !rawLimit) {
|
|
159
|
-
const grouped = {
|
|
160
|
-
projects: [],
|
|
161
|
-
areas: [],
|
|
162
|
-
resources: [],
|
|
163
|
-
archives: [],
|
|
164
|
-
};
|
|
165
|
-
for (const p of allPages) {
|
|
166
|
-
grouped[p.category]?.push({ slug: p.slug, title: p.title, path: p.path, scope: p.scope, tags: p.tags });
|
|
167
|
-
}
|
|
168
|
-
json(res, grouped);
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
const pageParam = parseInt(rawPage ?? "1", 10);
|
|
172
|
-
const limitParam = parseInt(rawLimit ?? "50", 10);
|
|
173
|
-
const page = Math.max(1, isNaN(pageParam) ? 1 : pageParam);
|
|
174
|
-
const limit = Math.max(1, Math.min(500, isNaN(limitParam) ? 50 : limitParam));
|
|
175
|
-
const start = (page - 1) * limit;
|
|
176
|
-
const paginatedPages = allPages.slice(start, start + limit);
|
|
177
|
-
json(res, {
|
|
178
|
-
pages: paginatedPages,
|
|
179
|
-
total,
|
|
180
|
-
page,
|
|
181
|
-
limit,
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
async function handleGetPage(wikiDir, params, _req, res) {
|
|
185
|
-
const { category, slug } = params;
|
|
186
|
-
if (!isValidCategory(category)) {
|
|
187
|
-
errorResponse(res, 400, `Invalid category: ${category}`);
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
const page = await readPage(wikiDir, category, slug);
|
|
191
|
-
if (!page) {
|
|
192
|
-
errorResponse(res, 404, `Page not found: ${category}/${slug}`);
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
json(res, {
|
|
196
|
-
category: page.category,
|
|
197
|
-
slug: page.slug,
|
|
198
|
-
frontmatter: page.frontmatter,
|
|
199
|
-
body: page.body,
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
async function handleUpdatePage(wikiDir, store, params, req, res) {
|
|
203
|
-
const { category, slug } = params;
|
|
204
|
-
if (!isValidCategory(category)) {
|
|
205
|
-
errorResponse(res, 400, `Invalid category: ${category}`);
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
const rawBody = await readBody(req);
|
|
209
|
-
const body = parseJsonBody(rawBody);
|
|
210
|
-
if (!body || typeof body !== "object") {
|
|
211
|
-
errorResponse(res, 400, "Invalid JSON body");
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
const payload = body;
|
|
215
|
-
// Read existing page or create new
|
|
216
|
-
const existing = await readPage(wikiDir, category, slug);
|
|
217
|
-
if (!existing) {
|
|
218
|
-
errorResponse(res, 404, `Page not found: ${category}/${slug}`);
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
// Update body if provided
|
|
222
|
-
// Redact secrets before saving
|
|
223
|
-
const pageBody = typeof payload.body === "string" ? payload.body : existing.body;
|
|
224
|
-
const newBody = redactSecrets(pageBody).text;
|
|
225
|
-
// Update frontmatter fields if provided
|
|
226
|
-
const newFrontmatter = { ...existing.frontmatter };
|
|
227
|
-
if (typeof payload.title === "string")
|
|
228
|
-
newFrontmatter.title = payload.title;
|
|
229
|
-
if (Array.isArray(payload.tags))
|
|
230
|
-
newFrontmatter.tags = payload.tags.filter((t) => typeof t === "string");
|
|
231
|
-
if (Array.isArray(payload.scope))
|
|
232
|
-
newFrontmatter.scope = payload.scope.filter((s) => typeof s === "string");
|
|
233
|
-
newFrontmatter.updated = new Date().toISOString();
|
|
234
|
-
// Extract wikilinks from new body
|
|
235
|
-
newFrontmatter.links = extractWikilinks(newBody);
|
|
236
|
-
const updatedPage = {
|
|
237
|
-
category,
|
|
238
|
-
slug,
|
|
239
|
-
frontmatter: newFrontmatter,
|
|
240
|
-
body: newBody,
|
|
241
|
-
};
|
|
242
|
-
await writePage(wikiDir, updatedPage);
|
|
243
|
-
// Re-index for search
|
|
244
|
-
if (store) {
|
|
245
|
-
try {
|
|
246
|
-
await reindex(store);
|
|
247
|
-
}
|
|
248
|
-
catch {
|
|
249
|
-
// Non-fatal — search may be stale until next reindex
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
// Git commit
|
|
253
|
-
await gitCommit(wikiDir, `webui: update ${category}/${slug}`);
|
|
254
|
-
json(res, {
|
|
255
|
-
category: updatedPage.category,
|
|
256
|
-
slug: updatedPage.slug,
|
|
257
|
-
frontmatter: updatedPage.frontmatter,
|
|
258
|
-
body: updatedPage.body,
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
async function handleMovePage(wikiDir, store, params, req, res) {
|
|
262
|
-
const { category, slug } = params;
|
|
263
|
-
if (!isValidCategory(category)) {
|
|
264
|
-
errorResponse(res, 400, `Invalid source category: ${category}`);
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
const rawBody = await readBody(req);
|
|
268
|
-
const body = parseJsonBody(rawBody);
|
|
269
|
-
if (!body || typeof body !== "object") {
|
|
270
|
-
errorResponse(res, 400, "Invalid JSON body");
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
const payload = body;
|
|
274
|
-
const toCategory = payload.to;
|
|
275
|
-
if (typeof toCategory !== "string" || !isValidCategory(toCategory)) {
|
|
276
|
-
errorResponse(res, 400, `Invalid target category: ${String(toCategory)}`);
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
if (category === toCategory) {
|
|
280
|
-
errorResponse(res, 400, "Source and target category are the same");
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
// Check page exists
|
|
284
|
-
const page = await readPage(wikiDir, category, slug);
|
|
285
|
-
if (!page) {
|
|
286
|
-
errorResponse(res, 404, `Page not found: ${category}/${slug}`);
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
const pageRef = {
|
|
290
|
-
category,
|
|
291
|
-
slug,
|
|
292
|
-
title: page.frontmatter.title,
|
|
293
|
-
path: `${category}/${slug}.md`,
|
|
294
|
-
};
|
|
295
|
-
await movePage(wikiDir, pageRef, toCategory);
|
|
296
|
-
// Re-index for search
|
|
297
|
-
if (store) {
|
|
298
|
-
try {
|
|
299
|
-
await reindex(store);
|
|
300
|
-
}
|
|
301
|
-
catch {
|
|
302
|
-
// Non-fatal
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
json(res, { moved: true, from: category, to: toCategory, slug });
|
|
306
|
-
}
|
|
307
|
-
async function handleSearch(wikiDir, store, query, _req, res) {
|
|
308
|
-
if (!query) {
|
|
309
|
-
errorResponse(res, 400, "Missing query parameter: q");
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
if (!store) {
|
|
313
|
-
errorResponse(res, 503, "Search is unavailable: store not initialized");
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
const results = await searchWiki(store, query, { limit: 20 });
|
|
317
|
-
json(res, results.map((r) => ({
|
|
318
|
-
category: r.page.category,
|
|
319
|
-
slug: r.page.slug,
|
|
320
|
-
title: r.page.title,
|
|
321
|
-
score: r.score,
|
|
322
|
-
snippet: r.snippet,
|
|
323
|
-
tags: r.frontmatter.tags,
|
|
324
|
-
scope: r.frontmatter.scope,
|
|
325
|
-
updated: r.frontmatter.updated,
|
|
326
|
-
})));
|
|
327
|
-
}
|
|
328
|
-
async function handleGraph(wikiDir, url, _req, res) {
|
|
329
|
-
const maxNodesParam = parseInt(url.searchParams.get("maxNodes") ?? "100", 10);
|
|
330
|
-
const maxNodes = Math.max(1, isNaN(maxNodesParam) ? 100 : maxNodesParam);
|
|
331
|
-
const scopeParam = url.searchParams.get("scope"); // e.g. ?scope=pi-para
|
|
332
|
-
const refs = await listPages(wikiDir);
|
|
333
|
-
const slugToRef = new Map();
|
|
334
|
-
for (const ref of refs) {
|
|
335
|
-
slugToRef.set(ref.slug, ref);
|
|
336
|
-
}
|
|
337
|
-
// Read all pages and apply scope filter
|
|
338
|
-
const pageData = new Map();
|
|
339
|
-
for (const ref of refs) {
|
|
340
|
-
const page = await readPage(wikiDir, ref.category, ref.slug);
|
|
341
|
-
if (!page)
|
|
342
|
-
continue;
|
|
343
|
-
// Scope filter: keep page if no filter, or if page scope includes the filter value or "global"
|
|
344
|
-
if (scopeParam && !page.frontmatter.scope.includes(scopeParam) && !page.frontmatter.scope.includes("global")) {
|
|
345
|
-
continue;
|
|
346
|
-
}
|
|
347
|
-
pageData.set(ref.slug, { ref, page });
|
|
348
|
-
}
|
|
349
|
-
// Build all nodes and edges from filtered pages
|
|
350
|
-
const allNodes = [];
|
|
351
|
-
const allEdges = [];
|
|
352
|
-
const seenEdges = new Set();
|
|
353
|
-
const connectionCounts = new Map();
|
|
354
|
-
for (const { ref, page } of pageData.values()) {
|
|
355
|
-
const nodeId = `${ref.category}/${ref.slug}`;
|
|
356
|
-
// Collect wikilinks from body and frontmatter
|
|
357
|
-
const bodyLinks = extractWikilinks(page.body);
|
|
358
|
-
const fmLinks = page.frontmatter.links;
|
|
359
|
-
const allLinks = new Set([...bodyLinks, ...fmLinks]);
|
|
360
|
-
for (const link of allLinks) {
|
|
361
|
-
const targetRef = slugToRef.get(link);
|
|
362
|
-
if (!targetRef)
|
|
363
|
-
continue; // skip broken links
|
|
364
|
-
// Only include edges to pages that passed scope filter
|
|
365
|
-
if (!pageData.has(link))
|
|
366
|
-
continue;
|
|
367
|
-
const targetId = `${targetRef.category}/${targetRef.slug}`;
|
|
368
|
-
const edgeKey = `${nodeId}->${targetId}`;
|
|
369
|
-
if (seenEdges.has(edgeKey))
|
|
370
|
-
continue;
|
|
371
|
-
seenEdges.add(edgeKey);
|
|
372
|
-
allEdges.push({ source: nodeId, target: targetId });
|
|
373
|
-
// Track connection counts for both source and target
|
|
374
|
-
connectionCounts.set(nodeId, (connectionCounts.get(nodeId) ?? 0) + 1);
|
|
375
|
-
connectionCounts.set(targetId, (connectionCounts.get(targetId) ?? 0) + 1);
|
|
376
|
-
}
|
|
377
|
-
allNodes.push({
|
|
378
|
-
id: nodeId,
|
|
379
|
-
title: ref.title,
|
|
380
|
-
category: ref.category,
|
|
381
|
-
slug: ref.slug,
|
|
382
|
-
connectionCount: 0, // will be filled below
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
// Fill connection counts and sort by most connected
|
|
386
|
-
for (const node of allNodes) {
|
|
387
|
-
node.connectionCount = connectionCounts.get(node.id) ?? 0;
|
|
388
|
-
}
|
|
389
|
-
allNodes.sort((a, b) => b.connectionCount - a.connectionCount);
|
|
390
|
-
// Take top-N most connected nodes
|
|
391
|
-
const topNodes = allNodes.slice(0, maxNodes);
|
|
392
|
-
const topNodeIds = new Set(topNodes.map(n => n.id));
|
|
393
|
-
// Filter edges to only include those between visible nodes
|
|
394
|
-
const filteredEdges = allEdges.filter(e => topNodeIds.has(e.source) && topNodeIds.has(e.target));
|
|
395
|
-
// Strip connectionCount from response
|
|
396
|
-
const nodes = topNodes.map(({ connectionCount, ...rest }) => rest);
|
|
397
|
-
json(res, { nodes, edges: filteredEdges });
|
|
398
|
-
}
|
|
399
|
-
async function handleLog(wikiDir, _req, res) {
|
|
400
|
-
let content;
|
|
401
|
-
try {
|
|
402
|
-
content = await readFile(join(wikiDir, "log.md"), "utf-8");
|
|
403
|
-
}
|
|
404
|
-
catch {
|
|
405
|
-
json(res, []);
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
|
-
const entries = parseLogEntries(content);
|
|
409
|
-
// Return newest first
|
|
410
|
-
entries.reverse();
|
|
411
|
-
json(res, entries);
|
|
412
|
-
}
|
|
413
|
-
async function handleSessions(wikiDir, url, _req, res) {
|
|
414
|
-
const limitParam = url.searchParams.get("limit");
|
|
415
|
-
const scope = url.searchParams.get("scope") ?? undefined;
|
|
416
|
-
const limit = limitParam ? parseInt(limitParam, 10) : undefined;
|
|
417
|
-
const digests = await readSessionDigests(wikiDir, { limit, scope });
|
|
418
|
-
// Return newest first
|
|
419
|
-
digests.reverse();
|
|
420
|
-
json(res, digests);
|
|
421
|
-
}
|
|
422
|
-
// -- Static file serving ----------------------------------------------------
|
|
423
|
-
async function serveStaticFile(staticDir, pathname, res) {
|
|
424
|
-
// Prevent directory traversal
|
|
425
|
-
const safePath = pathname.replace(/\.\./g, "").replace(/\/+/g, "/");
|
|
426
|
-
const filePath = join(staticDir, safePath === "/" ? "index.html" : safePath);
|
|
427
|
-
try {
|
|
428
|
-
const stats = await stat(filePath);
|
|
429
|
-
if (!stats.isFile())
|
|
430
|
-
return false;
|
|
431
|
-
const ext = extname(filePath);
|
|
432
|
-
const contentType = MIME_TYPES[ext] ?? "application/octet-stream";
|
|
433
|
-
const content = await readFile(filePath);
|
|
434
|
-
res.writeHead(200, {
|
|
435
|
-
"Content-Type": contentType,
|
|
436
|
-
"Content-Length": content.length,
|
|
437
|
-
"Cache-Control": ext === ".html" ? "no-cache" : "public, max-age=31536000, immutable",
|
|
438
|
-
});
|
|
439
|
-
res.end(content);
|
|
440
|
-
return true;
|
|
441
|
-
}
|
|
442
|
-
catch {
|
|
443
|
-
return false;
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
async function serveSpaFallback(staticDir, res) {
|
|
447
|
-
try {
|
|
448
|
-
const indexPath = join(staticDir, "index.html");
|
|
449
|
-
const content = await readFile(indexPath);
|
|
450
|
-
res.writeHead(200, {
|
|
451
|
-
"Content-Type": "text/html; charset=utf-8",
|
|
452
|
-
"Content-Length": content.length,
|
|
453
|
-
"Cache-Control": "no-cache",
|
|
454
|
-
});
|
|
455
|
-
res.end(content);
|
|
456
|
-
}
|
|
457
|
-
catch {
|
|
458
|
-
errorResponse(res, 404, "SPA not built — run the client build first");
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
// -- Server -----------------------------------------------------------------
|
|
462
|
-
export function startServer(wikiDir, store, config) {
|
|
463
|
-
// Static files directory — built React SPA
|
|
464
|
-
// Resolve relative to this file: src/webui/server.ts -> src/webui/client/dist
|
|
465
|
-
const thisDir = typeof __dirname !== "undefined"
|
|
466
|
-
? __dirname
|
|
467
|
-
: fileURLToPath(new URL(".", import.meta.url));
|
|
468
|
-
const staticDir = join(thisDir, "client", "dist");
|
|
469
|
-
const server = createServer(async (req, res) => {
|
|
470
|
-
setCorsHeaders(res);
|
|
471
|
-
// Handle CORS preflight
|
|
472
|
-
if (req.method === "OPTIONS") {
|
|
473
|
-
res.writeHead(204);
|
|
474
|
-
res.end();
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
try {
|
|
478
|
-
const url = new URL(req.url ?? "/", `http://${req.headers.host ?? "localhost"}`);
|
|
479
|
-
const pathname = url.pathname;
|
|
480
|
-
const method = req.method ?? "GET";
|
|
481
|
-
// -- API routes -------------------------------------------------------
|
|
482
|
-
// GET /api/pages
|
|
483
|
-
if (method === "GET" && pathname === "/api/pages") {
|
|
484
|
-
await handleListPages(wikiDir, url, req, res);
|
|
485
|
-
return;
|
|
486
|
-
}
|
|
487
|
-
// GET /api/search?q=...
|
|
488
|
-
if (method === "GET" && pathname === "/api/search") {
|
|
489
|
-
const query = url.searchParams.get("q") ?? "";
|
|
490
|
-
await handleSearch(wikiDir, store, query, req, res);
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
// GET /api/graph
|
|
494
|
-
if (method === "GET" && pathname === "/api/graph") {
|
|
495
|
-
await handleGraph(wikiDir, url, req, res);
|
|
496
|
-
return;
|
|
497
|
-
}
|
|
498
|
-
// GET /api/log
|
|
499
|
-
if (method === "GET" && pathname === "/api/log") {
|
|
500
|
-
await handleLog(wikiDir, req, res);
|
|
501
|
-
return;
|
|
502
|
-
}
|
|
503
|
-
// GET /api/sessions
|
|
504
|
-
if (method === "GET" && pathname === "/api/sessions") {
|
|
505
|
-
await handleSessions(wikiDir, url, req, res);
|
|
506
|
-
return;
|
|
507
|
-
}
|
|
508
|
-
// POST /api/pages/:category/:slug/move
|
|
509
|
-
const moveMatch = matchRoute("/api/pages/:category/:slug/move", pathname);
|
|
510
|
-
if (method === "POST" && moveMatch) {
|
|
511
|
-
await handleMovePage(wikiDir, store, moveMatch.params, req, res);
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
// GET /api/pages/:category/:slug
|
|
515
|
-
const pageMatch = matchRoute("/api/pages/:category/:slug", pathname);
|
|
516
|
-
if (method === "GET" && pageMatch) {
|
|
517
|
-
await handleGetPage(wikiDir, pageMatch.params, req, res);
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
// PUT /api/pages/:category/:slug
|
|
521
|
-
if (method === "PUT" && pageMatch) {
|
|
522
|
-
await handleUpdatePage(wikiDir, store, pageMatch.params, req, res);
|
|
523
|
-
return;
|
|
524
|
-
}
|
|
525
|
-
// -- Static files / SPA fallback --------------------------------------
|
|
526
|
-
if (method === "GET") {
|
|
527
|
-
// Try exact static file first
|
|
528
|
-
const served = await serveStaticFile(staticDir, pathname, res);
|
|
529
|
-
if (served)
|
|
530
|
-
return;
|
|
531
|
-
// SPA fallback — serve index.html for client-side routing
|
|
532
|
-
// Only for non-API, non-asset paths
|
|
533
|
-
if (!pathname.startsWith("/api/")) {
|
|
534
|
-
await serveSpaFallback(staticDir, res);
|
|
535
|
-
return;
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
// -- 404 for unmatched routes -----------------------------------------
|
|
539
|
-
errorResponse(res, 404, "Not found");
|
|
540
|
-
}
|
|
541
|
-
catch (err) {
|
|
542
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
543
|
-
console.error(`[webui] Request error: ${message}`);
|
|
544
|
-
errorResponse(res, 500, `Internal server error: ${message}`);
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
const { host, port } = config;
|
|
548
|
-
server.listen(port, host, () => {
|
|
549
|
-
// Server is listening — logged by caller
|
|
550
|
-
});
|
|
551
|
-
const serverUrl = host === "0.0.0.0"
|
|
552
|
-
? `http://localhost:${port}`
|
|
553
|
-
: `http://${host}:${port}`;
|
|
554
|
-
return {
|
|
555
|
-
url: serverUrl,
|
|
556
|
-
close: () => new Promise((resolve, reject) => {
|
|
557
|
-
server.close((err) => {
|
|
558
|
-
if (err)
|
|
559
|
-
reject(err);
|
|
560
|
-
else
|
|
561
|
-
resolve();
|
|
562
|
-
});
|
|
563
|
-
}),
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
//# sourceMappingURL=server.js.map
|
package/dist/webui/server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/webui/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;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AI,EAAE;QAC5B,CAAC,CAAC,UAAU,IAAI,IAAI,IAAI,EAAE,CAAC;IAE7B,OAAO;QACL,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACjD,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACnB,IAAI,GAAG;oBAAE,MAAM,CAAC,GAAG,CAAC,CAAC;;oBAChB,OAAO,EAAE,CAAC;YACjB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
|
package/scripts/build-assets.mjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/* v8 ignore start */
|
|
3
|
-
// Cross-platform post-tsc asset copy (replaces POSIX mkdir -p/cp in npm build).
|
|
4
|
-
import { cp, mkdir } from "node:fs/promises";
|
|
5
|
-
import { existsSync } from "node:fs";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { join, resolve, dirname } from "node:path";
|
|
8
|
-
|
|
9
|
-
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
10
|
-
|
|
11
|
-
// 1. Web UI client bundle
|
|
12
|
-
const webuiSrc = join(root, "src", "webui", "client", "dist", "index.html");
|
|
13
|
-
const webuiDestDir = join(root, "dist", "webui", "client", "dist");
|
|
14
|
-
await mkdir(webuiDestDir, { recursive: true });
|
|
15
|
-
if (existsSync(webuiSrc)) {
|
|
16
|
-
await cp(webuiSrc, join(webuiDestDir, "index.html"));
|
|
17
|
-
}
|