pi-para 0.5.2 → 0.6.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 +160 -0
- package/CHANGELOG.md +51 -0
- package/CONFIGURATION.md +243 -0
- package/README.md +140 -237
- package/SETUP.md +196 -112
- package/STRUCTURE.md +140 -0
- package/package.json +86 -18
- package/scripts/build-assets.mjs +29 -0
- package/scripts/install.ps1 +55 -0
- package/scripts/install.sh +63 -0
- package/scripts/smoke-install.mjs +63 -0
- package/skills/para/SKILL.md +1 -1
- package/skills/setup/SKILL.md +1 -1
- package/src/atomic-write.ts +17 -0
- package/src/capture.ts +4 -4
- package/src/cli-legacy.ts +43 -0
- package/src/cli.ts +133 -28
- package/src/commands.ts +203 -243
- package/src/config.ts +355 -0
- package/src/context.ts +29 -14
- package/src/credentials.ts +100 -0
- package/src/daemon.ts +1 -1
- package/src/doctor.ts +209 -0
- package/src/gepa/index.ts +1 -1
- package/src/index.ts +119 -40
- package/src/maintainer.ts +4 -4
- package/src/model-resolver.ts +96 -0
- package/src/paths.ts +48 -0
- package/src/processor.ts +4 -4
- package/src/qmd-providers.ts +63 -0
- package/src/query.ts +15 -1
- package/src/repair.ts +49 -0
- package/src/scheduler/controls.ts +125 -0
- package/src/scheduler/index.ts +210 -0
- package/src/scheduler/leases.ts +98 -0
- package/src/scheduler/session-capture.ts +146 -0
- package/src/scheduler/state.ts +304 -0
- package/src/session-tools.ts +1 -1
- package/src/settings.ts +126 -0
- package/src/setup.ts +116 -0
- package/src/status.ts +115 -0
- package/src/store.ts +116 -31
- package/src/summarize.ts +72 -16
- package/src/templates/prompts.ts +1 -1
- package/src/tools.ts +280 -90
- package/src/wiki-tool-guidance.ts +84 -0
- package/src/wiki.ts +98 -26
- package/dist/capture.d.ts +0 -34
- package/dist/capture.d.ts.map +0 -1
- package/dist/capture.js +0 -461
- package/dist/capture.js.map +0 -1
- package/dist/cli.d.ts +0 -15
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -405
- package/dist/cli.js.map +0 -1
- package/dist/commands.d.ts +0 -15
- package/dist/commands.d.ts.map +0 -1
- package/dist/commands.js +0 -786
- package/dist/commands.js.map +0 -1
- package/dist/context.d.ts +0 -61
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -289
- package/dist/context.js.map +0 -1
- 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/frontmatter.d.ts +0 -59
- package/dist/frontmatter.d.ts.map +0 -1
- package/dist/frontmatter.js +0 -170
- package/dist/frontmatter.js.map +0 -1
- package/dist/gepa/dataset.d.ts +0 -36
- package/dist/gepa/dataset.d.ts.map +0 -1
- package/dist/gepa/dataset.js +0 -148
- package/dist/gepa/dataset.js.map +0 -1
- package/dist/gepa/evaluator.d.ts +0 -51
- package/dist/gepa/evaluator.d.ts.map +0 -1
- package/dist/gepa/evaluator.js +0 -317
- package/dist/gepa/evaluator.js.map +0 -1
- package/dist/gepa/index.d.ts +0 -66
- package/dist/gepa/index.d.ts.map +0 -1
- package/dist/gepa/index.js +0 -240
- package/dist/gepa/index.js.map +0 -1
- package/dist/gepa/llm.d.ts +0 -35
- package/dist/gepa/llm.d.ts.map +0 -1
- package/dist/gepa/llm.js +0 -268
- package/dist/gepa/llm.js.map +0 -1
- package/dist/gepa/optimized/capture-prompt.txt +0 -65
- package/dist/gepa/optimizer.d.ts +0 -29
- package/dist/gepa/optimizer.d.ts.map +0 -1
- package/dist/gepa/optimizer.js +0 -249
- package/dist/gepa/optimizer.js.map +0 -1
- package/dist/gepa/targets.d.ts +0 -39
- package/dist/gepa/targets.d.ts.map +0 -1
- package/dist/gepa/targets.js +0 -326
- package/dist/gepa/targets.js.map +0 -1
- package/dist/gepa/types.d.ts +0 -168
- package/dist/gepa/types.d.ts.map +0 -1
- package/dist/gepa/types.js +0 -124
- package/dist/gepa/types.js.map +0 -1
- package/dist/index.d.ts +0 -21
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -294
- package/dist/index.js.map +0 -1
- package/dist/ingest.d.ts +0 -88
- package/dist/ingest.d.ts.map +0 -1
- package/dist/ingest.js +0 -105
- package/dist/ingest.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/link-utils.d.ts +0 -30
- package/dist/link-utils.d.ts.map +0 -1
- package/dist/link-utils.js +0 -145
- package/dist/link-utils.js.map +0 -1
- package/dist/lint.d.ts +0 -39
- package/dist/lint.d.ts.map +0 -1
- package/dist/lint.js +0 -827
- package/dist/lint.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/processor.d.ts +0 -14
- package/dist/processor.d.ts.map +0 -1
- package/dist/processor.js +0 -361
- package/dist/processor.js.map +0 -1
- package/dist/query.d.ts +0 -69
- package/dist/query.d.ts.map +0 -1
- package/dist/query.js +0 -107
- package/dist/query.js.map +0 -1
- package/dist/raw.d.ts +0 -57
- package/dist/raw.d.ts.map +0 -1
- package/dist/raw.js +0 -219
- package/dist/raw.js.map +0 -1
- package/dist/redact.d.ts +0 -21
- package/dist/redact.d.ts.map +0 -1
- package/dist/redact.js +0 -143
- package/dist/redact.js.map +0 -1
- package/dist/scope.d.ts +0 -54
- package/dist/scope.d.ts.map +0 -1
- package/dist/scope.js +0 -161
- package/dist/scope.js.map +0 -1
- package/dist/scripts/bulk-link-fix.d.ts +0 -9
- package/dist/scripts/bulk-link-fix.d.ts.map +0 -1
- package/dist/scripts/bulk-link-fix.js +0 -106
- package/dist/scripts/bulk-link-fix.js.map +0 -1
- package/dist/session-tools.d.ts +0 -33
- package/dist/session-tools.d.ts.map +0 -1
- package/dist/session-tools.js +0 -211
- package/dist/session-tools.js.map +0 -1
- package/dist/state.d.ts +0 -54
- package/dist/state.d.ts.map +0 -1
- package/dist/state.js +0 -176
- package/dist/state.js.map +0 -1
- package/dist/store.d.ts +0 -56
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js +0 -227
- package/dist/store.js.map +0 -1
- package/dist/summarize.d.ts +0 -56
- package/dist/summarize.d.ts.map +0 -1
- package/dist/summarize.js +0 -231
- package/dist/summarize.js.map +0 -1
- package/dist/tag-registry.d.ts +0 -56
- package/dist/tag-registry.d.ts.map +0 -1
- package/dist/tag-registry.js +0 -146
- package/dist/tag-registry.js.map +0 -1
- package/dist/templates/prompts.d.ts +0 -63
- package/dist/templates/prompts.d.ts.map +0 -1
- package/dist/templates/prompts.js +0 -260
- package/dist/templates/prompts.js.map +0 -1
- package/dist/tools.d.ts +0 -26
- package/dist/tools.d.ts.map +0 -1
- package/dist/tools.js +0 -1033
- package/dist/tools.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/dist/wiki.d.ts +0 -103
- package/dist/wiki.d.ts.map +0 -1
- package/dist/wiki.js +0 -428
- package/dist/wiki.js.map +0 -1
- package/scripts/gepa/__pycache__/dataset.cpython-313.pyc +0 -0
- package/scripts/gepa/__pycache__/lm_providers.cpython-313.pyc +0 -0
- package/scripts/gepa/__pycache__/metric.cpython-313.pyc +0 -0
- package/scripts/gepa/__pycache__/program.cpython-313.pyc +0 -0
- package/scripts/gepa/__pycache__/wiki_reader.cpython-313.pyc +0 -0
- package/scripts/gepa/uv.lock +0 -2241
package/dist/ingest.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ingest pipeline — processes sources and integrates knowledge into the wiki.
|
|
3
|
-
*
|
|
4
|
-
* Resolves source content (URL, file, text), saves raw copy to the vault,
|
|
5
|
-
* and returns structured data for the caller (tool or standalone agent)
|
|
6
|
-
* to pass to the LLM for synthesis into wiki pages.
|
|
7
|
-
*/
|
|
8
|
-
import type { ParaCategory, PageRef, LogEntry } from "./wiki.js";
|
|
9
|
-
import type { ProjectScope } from "./scope.js";
|
|
10
|
-
export interface IngestOptions {
|
|
11
|
-
source: string;
|
|
12
|
-
sourceType?: "url" | "file" | "text";
|
|
13
|
-
scope?: string[];
|
|
14
|
-
category?: ParaCategory;
|
|
15
|
-
}
|
|
16
|
-
export interface IngestReport {
|
|
17
|
-
pagesCreated: PageRef[];
|
|
18
|
-
pagesUpdated: PageRef[];
|
|
19
|
-
logEntry: LogEntry;
|
|
20
|
-
}
|
|
21
|
-
/** Structure returned by LLM during ingest. */
|
|
22
|
-
export interface IngestResult {
|
|
23
|
-
newPages: Array<{
|
|
24
|
-
category: ParaCategory;
|
|
25
|
-
slug: string;
|
|
26
|
-
title: string;
|
|
27
|
-
scope: string[];
|
|
28
|
-
tags: string[];
|
|
29
|
-
body: string;
|
|
30
|
-
}>;
|
|
31
|
-
updatedPages: Array<{
|
|
32
|
-
category: ParaCategory;
|
|
33
|
-
slug: string;
|
|
34
|
-
appendOrReplace: "append" | "replace";
|
|
35
|
-
body: string;
|
|
36
|
-
}>;
|
|
37
|
-
indexUpdate: string;
|
|
38
|
-
logSummary: string;
|
|
39
|
-
}
|
|
40
|
-
/** Resolved source data from the ingest pipeline. */
|
|
41
|
-
export interface ResolvedSource {
|
|
42
|
-
/** Original source string (URL, path, or text) */
|
|
43
|
-
source: string;
|
|
44
|
-
/** Detected or explicit source type */
|
|
45
|
-
sourceType: "url" | "file" | "text";
|
|
46
|
-
/** Fetched/read source content */
|
|
47
|
-
content: string;
|
|
48
|
-
/** Path in raw/ vault (undefined for inline text) */
|
|
49
|
-
rawPath: string | undefined;
|
|
50
|
-
/** Schema.md content for LLM context */
|
|
51
|
-
schema: string;
|
|
52
|
-
/** Index.md content for LLM context */
|
|
53
|
-
index: string;
|
|
54
|
-
/** Scope tags to assign */
|
|
55
|
-
scopeTags: string[];
|
|
56
|
-
/** Scope name */
|
|
57
|
-
scopeName: string;
|
|
58
|
-
/** Category hint (if provided) */
|
|
59
|
-
categoryHint: ParaCategory | undefined;
|
|
60
|
-
}
|
|
61
|
-
/** Detect source type from the source string. */
|
|
62
|
-
export declare function detectSourceType(source: string): "url" | "file" | "text";
|
|
63
|
-
/** Fetch content from a URL. */
|
|
64
|
-
export declare function fetchUrl(url: string): Promise<string>;
|
|
65
|
-
/** Read content from a file path. */
|
|
66
|
-
export declare function readFileSource(filePath: string): Promise<string>;
|
|
67
|
-
/**
|
|
68
|
-
* Resolve a source and prepare it for LLM synthesis.
|
|
69
|
-
*
|
|
70
|
-
* This is the reusable library function. It:
|
|
71
|
-
* 1. Detects or uses the explicit source type
|
|
72
|
-
* 2. Fetches URL / reads file / uses text directly
|
|
73
|
-
* 3. Saves a raw copy to the vault (for non-text sources)
|
|
74
|
-
* 4. Reads schema.md and index.md for LLM context
|
|
75
|
-
* 5. Returns everything the caller needs to build an LLM prompt
|
|
76
|
-
*
|
|
77
|
-
* The caller (tool or standalone agent) assembles the prompt and
|
|
78
|
-
* passes it to the LLM, which calls wiki_write to create pages.
|
|
79
|
-
*/
|
|
80
|
-
export declare function resolveSource(wikiDir: string, options: IngestOptions, scope: ProjectScope): Promise<ResolvedSource>;
|
|
81
|
-
/** Maximum source content length before truncation. */
|
|
82
|
-
export declare const MAX_SOURCE_LENGTH = 50000;
|
|
83
|
-
/**
|
|
84
|
-
* Truncate source content if it exceeds the limit.
|
|
85
|
-
* Returns the truncated content with a marker.
|
|
86
|
-
*/
|
|
87
|
-
export declare function truncateSource(content: string, maxLength?: number): string;
|
|
88
|
-
//# sourceMappingURL=ingest.d.ts.map
|
package/dist/ingest.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
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pC,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;CACxC;AAID,iDAAiD;AACjD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAQxE;AAED,gCAAgC;AAChC,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM3D;AAED,qCAAqC;AACrC,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGtE;AAID;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,cAAc,CAAC,CA6CzB;AAED,uDAAuD;AACvD,eAAO,MAAM,iBAAiB,QAAS,CAAC;AAExC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,MAA0B,GAAG,MAAM,CAG7F"}
|
package/dist/ingest.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ingest pipeline — processes sources and integrates knowledge into the wiki.
|
|
3
|
-
*
|
|
4
|
-
* Resolves source content (URL, file, text), saves raw copy to the vault,
|
|
5
|
-
* and returns structured data for the caller (tool or standalone agent)
|
|
6
|
-
* to pass to the LLM for synthesis into wiki pages.
|
|
7
|
-
*/
|
|
8
|
-
import { readFile } from "node:fs/promises";
|
|
9
|
-
import { readSchema, readIndex } from "./wiki.js";
|
|
10
|
-
import { saveRawSource } from "./raw.js";
|
|
11
|
-
// -- Source resolution -------------------------------------------------------
|
|
12
|
-
/** Detect source type from the source string. */
|
|
13
|
-
export function detectSourceType(source) {
|
|
14
|
-
if (/^https?:\/\//i.test(source))
|
|
15
|
-
return "url";
|
|
16
|
-
if (/^\/|^\.\/|^~\/|^[a-zA-Z]:\\/.test(source))
|
|
17
|
-
return "file";
|
|
18
|
-
// Heuristic: if it contains newlines or is very long, treat as text
|
|
19
|
-
if (source.includes("\n") || source.length > 500)
|
|
20
|
-
return "text";
|
|
21
|
-
// Check for file-like paths (has extension)
|
|
22
|
-
if (/\.\w{1,10}$/.test(source) && !source.includes(" "))
|
|
23
|
-
return "file";
|
|
24
|
-
return "text";
|
|
25
|
-
}
|
|
26
|
-
/** Fetch content from a URL. */
|
|
27
|
-
export async function fetchUrl(url) {
|
|
28
|
-
const response = await fetch(url);
|
|
29
|
-
if (!response.ok) {
|
|
30
|
-
throw new Error(`Failed to fetch ${url}: ${response.status} ${response.statusText}`);
|
|
31
|
-
}
|
|
32
|
-
return response.text();
|
|
33
|
-
}
|
|
34
|
-
/** Read content from a file path. */
|
|
35
|
-
export async function readFileSource(filePath) {
|
|
36
|
-
const resolved = filePath.replace(/^~\//, `${process.env.HOME ?? ""}/`);
|
|
37
|
-
return readFile(resolved, "utf-8");
|
|
38
|
-
}
|
|
39
|
-
// -- Main pipeline -----------------------------------------------------------
|
|
40
|
-
/**
|
|
41
|
-
* Resolve a source and prepare it for LLM synthesis.
|
|
42
|
-
*
|
|
43
|
-
* This is the reusable library function. It:
|
|
44
|
-
* 1. Detects or uses the explicit source type
|
|
45
|
-
* 2. Fetches URL / reads file / uses text directly
|
|
46
|
-
* 3. Saves a raw copy to the vault (for non-text sources)
|
|
47
|
-
* 4. Reads schema.md and index.md for LLM context
|
|
48
|
-
* 5. Returns everything the caller needs to build an LLM prompt
|
|
49
|
-
*
|
|
50
|
-
* The caller (tool or standalone agent) assembles the prompt and
|
|
51
|
-
* passes it to the LLM, which calls wiki_write to create pages.
|
|
52
|
-
*/
|
|
53
|
-
export async function resolveSource(wikiDir, options, scope) {
|
|
54
|
-
const sourceType = options.sourceType ?? detectSourceType(options.source);
|
|
55
|
-
// Resolve source content
|
|
56
|
-
let content;
|
|
57
|
-
switch (sourceType) {
|
|
58
|
-
case "url":
|
|
59
|
-
content = await fetchUrl(options.source);
|
|
60
|
-
break;
|
|
61
|
-
case "file":
|
|
62
|
-
content = await readFileSource(options.source);
|
|
63
|
-
break;
|
|
64
|
-
case "text":
|
|
65
|
-
content = options.source;
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
// Save raw source (skip for inline text — it's ephemeral)
|
|
69
|
-
let rawPath;
|
|
70
|
-
if (sourceType !== "text") {
|
|
71
|
-
rawPath = await saveRawSource(wikiDir, {
|
|
72
|
-
type: sourceType,
|
|
73
|
-
content,
|
|
74
|
-
originalPath: options.source,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
// Read schema and index for LLM context
|
|
78
|
-
const schema = await readSchema(wikiDir);
|
|
79
|
-
const index = await readIndex(wikiDir);
|
|
80
|
-
// Build scope info
|
|
81
|
-
const scopeTags = options.scope ?? scope.include;
|
|
82
|
-
return {
|
|
83
|
-
source: options.source,
|
|
84
|
-
sourceType,
|
|
85
|
-
content,
|
|
86
|
-
rawPath,
|
|
87
|
-
schema,
|
|
88
|
-
index,
|
|
89
|
-
scopeTags,
|
|
90
|
-
scopeName: scope.name,
|
|
91
|
-
categoryHint: options.category,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
/** Maximum source content length before truncation. */
|
|
95
|
-
export const MAX_SOURCE_LENGTH = 50_000;
|
|
96
|
-
/**
|
|
97
|
-
* Truncate source content if it exceeds the limit.
|
|
98
|
-
* Returns the truncated content with a marker.
|
|
99
|
-
*/
|
|
100
|
-
export function truncateSource(content, maxLength = MAX_SOURCE_LENGTH) {
|
|
101
|
-
if (content.length <= maxLength)
|
|
102
|
-
return content;
|
|
103
|
-
return content.slice(0, maxLength) + "\n\n[... truncated]";
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=ingest.js.map
|
package/dist/ingest.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../src/ingest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA4DzC,+EAA+E;AAE/E,iDAAiD;AACjD,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,IAAI,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAC/C,IAAI,6BAA6B,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAC9D,oEAAoE;IACpE,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,GAAG;QAAE,OAAO,MAAM,CAAC;IAChE,4CAA4C;IAC5C,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,MAAM,CAAC;IACvE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,gCAAgC;AAChC,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,GAAW;IACxC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,KAAK,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU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AS,CAAC,OAAO,CAAC,CAAC;IAEvC,mBAAmB;IACnB,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC;IAEjD,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU;QACV,OAAO;QACP,OAAO;QACP,MAAM;QACN,KAAK;QACL,SAAS;QACT,SAAS,EAAE,KAAK,CAAC,IAAI;QACrB,YAAY,EAAE,OAAO,CAAC,QAAQ;KAC/B,CAAC;AACJ,CAAC;AAED,uDAAuD;AACvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAExC;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,YAAoB,iBAAiB;IACnF,IAAI,OAAO,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,OAAO,CAAC;IAChD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,qBAAqB,CAAC;AAC7D,CAAC"}
|
package/dist/link-discovery.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Link discovery — finds related wiki pages and adds [[wikilinks]].
|
|
3
|
-
*
|
|
4
|
-
* Uses BM25 search to find pages that are semantically related but
|
|
5
|
-
* not yet linked. Runs as a periodic daemon job or on-demand.
|
|
6
|
-
*
|
|
7
|
-
* Strategy:
|
|
8
|
-
* 1. For each page, search the wiki using its title + key terms
|
|
9
|
-
* 2. Filter results to pages not already linked
|
|
10
|
-
* 3. If a related page scores above threshold, add it to ## Connections
|
|
11
|
-
* 4. Sync frontmatter.links
|
|
12
|
-
*/
|
|
13
|
-
import type { QMDStore } from "./store.js";
|
|
14
|
-
export interface LinkDiscoveryResult {
|
|
15
|
-
pagesUpdated: number;
|
|
16
|
-
linksAdded: number;
|
|
17
|
-
discoveries: Array<{
|
|
18
|
-
page: string;
|
|
19
|
-
newLinks: string[];
|
|
20
|
-
}>;
|
|
21
|
-
}
|
|
22
|
-
export interface LinkDiscoveryOptions {
|
|
23
|
-
/** Minimum BM25 score to consider a page related (0-1). Default 0.3 */
|
|
24
|
-
minScore?: number;
|
|
25
|
-
/** Max new links to add per page per run. Default 5 */
|
|
26
|
-
maxLinksPerPage?: number;
|
|
27
|
-
/** Dry run — report but don't write. Default false */
|
|
28
|
-
dryRun?: boolean;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Discover and add missing [[wikilinks]] between related pages.
|
|
32
|
-
*
|
|
33
|
-
* For each page:
|
|
34
|
-
* 1. Search wiki using the page's title as query
|
|
35
|
-
* 2. Find high-scoring pages not already linked
|
|
36
|
-
* 3. Add them to ## Connections section
|
|
37
|
-
* 4. Sync frontmatter.links
|
|
38
|
-
*/
|
|
39
|
-
export declare function discoverLinks(wikiDir: string, store: QMDStore, options?: LinkDiscoveryOptions): Promise<LinkDiscoveryResult>;
|
|
40
|
-
//# sourceMappingURL=link-discovery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"link-discovery.d.ts","sourceRoot":"","sources":["../src/link-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAK3C,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,KAAK,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,oBAAoB;IACnC,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sDAAsD;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAID;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,QAAQ,EACf,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CA+G9B"}
|
package/dist/link-discovery.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Link discovery — finds related wiki pages and adds [[wikilinks]].
|
|
3
|
-
*
|
|
4
|
-
* Uses BM25 search to find pages that are semantically related but
|
|
5
|
-
* not yet linked. Runs as a periodic daemon job or on-demand.
|
|
6
|
-
*
|
|
7
|
-
* Strategy:
|
|
8
|
-
* 1. For each page, search the wiki using its title + key terms
|
|
9
|
-
* 2. Filter results to pages not already linked
|
|
10
|
-
* 3. If a related page scores above threshold, add it to ## Connections
|
|
11
|
-
* 4. Sync frontmatter.links
|
|
12
|
-
*/
|
|
13
|
-
import { listPages, readPage, writePage, } from "./wiki.js";
|
|
14
|
-
import { searchWiki } from "./store.js";
|
|
15
|
-
import { extractWikilinks, syncFrontmatterLinks } from "./link-utils.js";
|
|
16
|
-
// -- Discovery ---------------------------------------------------------------
|
|
17
|
-
/**
|
|
18
|
-
* Discover and add missing [[wikilinks]] between related pages.
|
|
19
|
-
*
|
|
20
|
-
* For each page:
|
|
21
|
-
* 1. Search wiki using the page's title as query
|
|
22
|
-
* 2. Find high-scoring pages not already linked
|
|
23
|
-
* 3. Add them to ## Connections section
|
|
24
|
-
* 4. Sync frontmatter.links
|
|
25
|
-
*/
|
|
26
|
-
export async function discoverLinks(wikiDir, store, options) {
|
|
27
|
-
const minScore = options?.minScore ?? 0.3;
|
|
28
|
-
const maxLinksPerPage = options?.maxLinksPerPage ?? 5;
|
|
29
|
-
const dryRun = options?.dryRun ?? false;
|
|
30
|
-
const refs = await listPages(wikiDir);
|
|
31
|
-
const pages = [];
|
|
32
|
-
for (const ref of refs) {
|
|
33
|
-
const page = await readPage(wikiDir, ref.category, ref.slug);
|
|
34
|
-
if (page)
|
|
35
|
-
pages.push(page);
|
|
36
|
-
}
|
|
37
|
-
const allSlugs = new Set(pages.map(p => p.slug));
|
|
38
|
-
const result = {
|
|
39
|
-
pagesUpdated: 0,
|
|
40
|
-
linksAdded: 0,
|
|
41
|
-
discoveries: [],
|
|
42
|
-
};
|
|
43
|
-
for (const page of pages) {
|
|
44
|
-
// Get existing outgoing links
|
|
45
|
-
const existingLinks = new Set(extractWikilinks(page.body));
|
|
46
|
-
// Also include frontmatter links
|
|
47
|
-
for (const l of page.frontmatter.links)
|
|
48
|
-
existingLinks.add(l);
|
|
49
|
-
// Search for related pages using title
|
|
50
|
-
const query = page.frontmatter.title;
|
|
51
|
-
let related;
|
|
52
|
-
try {
|
|
53
|
-
related = await searchWiki(store, query, { limit: 10 });
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
continue; // search failure — skip this page
|
|
57
|
-
}
|
|
58
|
-
// Filter: not self, not already linked, above score threshold
|
|
59
|
-
const candidates = related
|
|
60
|
-
.filter(r => r.page.slug !== page.slug &&
|
|
61
|
-
!existingLinks.has(r.page.slug) &&
|
|
62
|
-
r.score >= minScore)
|
|
63
|
-
.slice(0, maxLinksPerPage);
|
|
64
|
-
if (candidates.length === 0)
|
|
65
|
-
continue;
|
|
66
|
-
const newLinks = candidates.map(c => c.page.slug);
|
|
67
|
-
// Build ## Connections addition
|
|
68
|
-
const connectionsLines = newLinks.map(slug => {
|
|
69
|
-
const targetPage = pages.find(p => p.slug === slug);
|
|
70
|
-
const title = targetPage?.frontmatter.title ?? slug;
|
|
71
|
-
return `- [[${slug}]] — ${title}`;
|
|
72
|
-
});
|
|
73
|
-
// Update page body
|
|
74
|
-
let newBody = page.body;
|
|
75
|
-
const hasConnections = /^## Connections/m.test(newBody);
|
|
76
|
-
if (hasConnections) {
|
|
77
|
-
// Append to existing Connections section
|
|
78
|
-
// Find the end of the Connections section (next ## heading or EOF)
|
|
79
|
-
const connectionsIdx = newBody.indexOf("## Connections");
|
|
80
|
-
const afterConnections = newBody.indexOf("\n## ", connectionsIdx + 1);
|
|
81
|
-
const insertPos = afterConnections === -1 ? newBody.length : afterConnections;
|
|
82
|
-
// Insert before the next section
|
|
83
|
-
const insertion = "\n" + connectionsLines.join("\n");
|
|
84
|
-
newBody = newBody.slice(0, insertPos) + insertion + newBody.slice(insertPos);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
// Add new Connections section at the end (before ## Sources or ## Open Questions if they exist)
|
|
88
|
-
const sourcesIdx = newBody.indexOf("\n## Sources");
|
|
89
|
-
const questionsIdx = newBody.indexOf("\n## Open Questions");
|
|
90
|
-
const insertBefore = Math.min(sourcesIdx === -1 ? Infinity : sourcesIdx, questionsIdx === -1 ? Infinity : questionsIdx);
|
|
91
|
-
const section = "\n\n## Connections\n" + connectionsLines.join("\n");
|
|
92
|
-
if (insertBefore === Infinity) {
|
|
93
|
-
newBody = newBody.trimEnd() + section + "\n";
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
newBody = newBody.slice(0, insertBefore) + section + newBody.slice(insertBefore);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
// Sync frontmatter.links
|
|
100
|
-
const updatedLinks = syncFrontmatterLinks(newBody);
|
|
101
|
-
if (!dryRun) {
|
|
102
|
-
const updatedPage = {
|
|
103
|
-
...page,
|
|
104
|
-
body: newBody,
|
|
105
|
-
frontmatter: {
|
|
106
|
-
...page.frontmatter,
|
|
107
|
-
links: updatedLinks,
|
|
108
|
-
updated: new Date().toISOString(),
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
await writePage(wikiDir, updatedPage);
|
|
112
|
-
}
|
|
113
|
-
result.pagesUpdated++;
|
|
114
|
-
result.linksAdded += newLinks.length;
|
|
115
|
-
result.discoveries.push({
|
|
116
|
-
page: `${page.category}/${page.slug}`,
|
|
117
|
-
newLinks,
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
return result;
|
|
121
|
-
}
|
|
122
|
-
//# sourceMappingURL=link-discovery.js.map
|
|
@@ -1 +0,0 @@
|
|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AC,CAAC;YAErE,IAAI,YAAY,KAAK,QAAQ,EAAE,CAAC;gBAC9B,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,GAAG,OAAO,GAAG,IAAI,CAAC;YAC/C,CAAC;iBAAM,CAAC;gBACN,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YACnF,CAAC;QACH,CAAC;QAED,yBAAyB;QACzB,MAAM,YAAY,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAEnD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,WAAW,GAAa;gBAC5B,GAAG,IAAI;gBACP,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE;oBACX,GAAG,IAAI,CAAC,WAAW;oBACnB,KAAK,EAAE,YAAY;oBACnB,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBAClC;aACF,CAAC;YACF,MAAM,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QACxC,CAAC;QAED,MAAM,CAAC,YAAY,EAAE,CAAC;QACtB,MAAM,CAAC,UAAU,IAAI,QAAQ,CAAC,MAAM,CAAC;QACrC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;YACtB,IAAI,EAAE,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE;YACrC,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/link-utils.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared wikilink utilities — extraction, auto-linking, and sync.
|
|
3
|
-
*
|
|
4
|
-
* Centralizes the [[wikilink]] logic that was duplicated across
|
|
5
|
-
* tools.ts, lint.ts, processor.ts, and webui/server.ts.
|
|
6
|
-
*/
|
|
7
|
-
/** Extract all [[wikilink]] targets from markdown body. Returns deduplicated slugs. */
|
|
8
|
-
export declare function extractWikilinks(body: string): string[];
|
|
9
|
-
/** Remove [[target]] (and optional display text) from body text. */
|
|
10
|
-
export declare function removeWikilink(body: string, target: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* Auto-link page slug mentions in body text with [[wikilinks]].
|
|
13
|
-
*
|
|
14
|
-
* - Wraps unlinked slug mentions in [[slug]]
|
|
15
|
-
* - Skips code blocks, URLs, existing [[wikilinks]], headings
|
|
16
|
-
* - Matches longest slugs first to avoid partial matches
|
|
17
|
-
* - Uses word-boundary matching (won't match "pi-para" inside "pi-para-daemon")
|
|
18
|
-
* - Only links each slug once per page (first occurrence) to avoid noise
|
|
19
|
-
*
|
|
20
|
-
* @param body - Page body markdown
|
|
21
|
-
* @param allSlugs - Set of all existing page slugs
|
|
22
|
-
* @param ownSlug - This page's own slug (excluded from auto-linking)
|
|
23
|
-
* @returns Updated body with [[wikilinks]] inserted
|
|
24
|
-
*/
|
|
25
|
-
export declare function autoLinkSlugs(body: string, allSlugs: Set<string>, ownSlug?: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* Sync frontmatter.links to match all [[wikilinks]] found in body text.
|
|
28
|
-
*/
|
|
29
|
-
export declare function syncFrontmatterLinks(body: string): string[];
|
|
30
|
-
//# sourceMappingURL=link-utils.d.ts.map
|
package/dist/link-utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"link-utils.d.ts","sourceRoot":"","sources":["../src/link-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAQvD;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAInE;AAgED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,EACrB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAoDR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAE3D"}
|
package/dist/link-utils.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared wikilink utilities — extraction, auto-linking, and sync.
|
|
3
|
-
*
|
|
4
|
-
* Centralizes the [[wikilink]] logic that was duplicated across
|
|
5
|
-
* tools.ts, lint.ts, processor.ts, and webui/server.ts.
|
|
6
|
-
*/
|
|
7
|
-
// -- Wikilink extraction ----------------------------------------------------
|
|
8
|
-
const WIKILINK_RE = /\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g;
|
|
9
|
-
/** Extract all [[wikilink]] targets from markdown body. Returns deduplicated slugs. */
|
|
10
|
-
export function extractWikilinks(body) {
|
|
11
|
-
const links = [];
|
|
12
|
-
let m;
|
|
13
|
-
const re = new RegExp(WIKILINK_RE.source, WIKILINK_RE.flags);
|
|
14
|
-
while ((m = re.exec(body)) !== null) {
|
|
15
|
-
links.push(m[1].trim());
|
|
16
|
-
}
|
|
17
|
-
return [...new Set(links)];
|
|
18
|
-
}
|
|
19
|
-
/** Remove [[target]] (and optional display text) from body text. */
|
|
20
|
-
export function removeWikilink(body, target) {
|
|
21
|
-
const escaped = target.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
22
|
-
const re = new RegExp(`\\[\\[${escaped}(?:\\|[^\\]]+)?\\]\\]`, "g");
|
|
23
|
-
return body.replace(re, "");
|
|
24
|
-
}
|
|
25
|
-
// -- Auto-linking -----------------------------------------------------------
|
|
26
|
-
/**
|
|
27
|
-
* Identify regions in markdown body that should NOT be auto-linked.
|
|
28
|
-
* Returns array of [start, end] ranges to skip.
|
|
29
|
-
*
|
|
30
|
-
* Protected regions:
|
|
31
|
-
* - Fenced code blocks (``` ... ```)
|
|
32
|
-
* - Inline code (`...`)
|
|
33
|
-
* - Existing [[wikilinks]]
|
|
34
|
-
* - URLs (http:// https://)
|
|
35
|
-
* - YAML frontmatter lines referencing slugs
|
|
36
|
-
*/
|
|
37
|
-
function findProtectedRanges(body) {
|
|
38
|
-
const ranges = [];
|
|
39
|
-
// Fenced code blocks
|
|
40
|
-
const fencedRe = /```[\s\S]*?```/g;
|
|
41
|
-
let m;
|
|
42
|
-
while ((m = fencedRe.exec(body)) !== null) {
|
|
43
|
-
ranges.push([m.index, m.index + m[0].length]);
|
|
44
|
-
}
|
|
45
|
-
// Inline code
|
|
46
|
-
const inlineCodeRe = /`[^`]+`/g;
|
|
47
|
-
while ((m = inlineCodeRe.exec(body)) !== null) {
|
|
48
|
-
ranges.push([m.index, m.index + m[0].length]);
|
|
49
|
-
}
|
|
50
|
-
// Existing [[wikilinks]]
|
|
51
|
-
const wlRe = /\[\[[^\]]+\]\]/g;
|
|
52
|
-
while ((m = wlRe.exec(body)) !== null) {
|
|
53
|
-
ranges.push([m.index, m.index + m[0].length]);
|
|
54
|
-
}
|
|
55
|
-
// URLs
|
|
56
|
-
const urlRe = /https?:\/\/[^\s)>]+/g;
|
|
57
|
-
while ((m = urlRe.exec(body)) !== null) {
|
|
58
|
-
ranges.push([m.index, m.index + m[0].length]);
|
|
59
|
-
}
|
|
60
|
-
// Markdown headings (don't wrap slugs in heading lines)
|
|
61
|
-
const headingRe = /^#{1,6}\s+.*$/gm;
|
|
62
|
-
while ((m = headingRe.exec(body)) !== null) {
|
|
63
|
-
ranges.push([m.index, m.index + m[0].length]);
|
|
64
|
-
}
|
|
65
|
-
return ranges.sort((a, b) => a[0] - b[0]);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Check if a position falls inside any protected range.
|
|
69
|
-
*/
|
|
70
|
-
function isProtected(pos, end, ranges) {
|
|
71
|
-
for (const [rStart, rEnd] of ranges) {
|
|
72
|
-
if (rStart > end)
|
|
73
|
-
break; // ranges are sorted
|
|
74
|
-
if (pos >= rStart && end <= rEnd)
|
|
75
|
-
return true;
|
|
76
|
-
if (pos < rEnd && end > rStart)
|
|
77
|
-
return true; // overlap
|
|
78
|
-
}
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Auto-link page slug mentions in body text with [[wikilinks]].
|
|
83
|
-
*
|
|
84
|
-
* - Wraps unlinked slug mentions in [[slug]]
|
|
85
|
-
* - Skips code blocks, URLs, existing [[wikilinks]], headings
|
|
86
|
-
* - Matches longest slugs first to avoid partial matches
|
|
87
|
-
* - Uses word-boundary matching (won't match "pi-para" inside "pi-para-daemon")
|
|
88
|
-
* - Only links each slug once per page (first occurrence) to avoid noise
|
|
89
|
-
*
|
|
90
|
-
* @param body - Page body markdown
|
|
91
|
-
* @param allSlugs - Set of all existing page slugs
|
|
92
|
-
* @param ownSlug - This page's own slug (excluded from auto-linking)
|
|
93
|
-
* @returns Updated body with [[wikilinks]] inserted
|
|
94
|
-
*/
|
|
95
|
-
export function autoLinkSlugs(body, allSlugs, ownSlug) {
|
|
96
|
-
if (allSlugs.size === 0)
|
|
97
|
-
return body;
|
|
98
|
-
// Sort slugs longest-first so "pi-para-daemon" is matched before "pi-para"
|
|
99
|
-
const sortedSlugs = [...allSlugs]
|
|
100
|
-
.filter(s => s !== ownSlug)
|
|
101
|
-
.sort((a, b) => b.length - a.length);
|
|
102
|
-
const protectedRanges = findProtectedRanges(body);
|
|
103
|
-
const linkedSlugs = new Set(extractWikilinks(body));
|
|
104
|
-
let result = body;
|
|
105
|
-
for (const slug of sortedSlugs) {
|
|
106
|
-
// Skip if already linked
|
|
107
|
-
if (linkedSlugs.has(slug))
|
|
108
|
-
continue;
|
|
109
|
-
// Build regex: match slug at word boundaries
|
|
110
|
-
// Slug chars are [a-z0-9-], so word boundary = not preceded/followed by these chars
|
|
111
|
-
const escaped = slug.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
112
|
-
// Use negative lookbehind/lookahead for slug characters
|
|
113
|
-
const re = new RegExp(`(?<![a-z0-9-])${escaped}(?![a-z0-9-])`, "g");
|
|
114
|
-
// Re-compute protected ranges for current state of result
|
|
115
|
-
const currentProtected = findProtectedRanges(result);
|
|
116
|
-
let match;
|
|
117
|
-
let linked = false;
|
|
118
|
-
// Reset regex
|
|
119
|
-
re.lastIndex = 0;
|
|
120
|
-
while ((match = re.exec(result)) !== null) {
|
|
121
|
-
if (linked)
|
|
122
|
-
break; // only link first occurrence
|
|
123
|
-
const pos = match.index;
|
|
124
|
-
const end = pos + match[0].length;
|
|
125
|
-
if (isProtected(pos, end, currentProtected))
|
|
126
|
-
continue;
|
|
127
|
-
// Replace this occurrence with [[slug]]
|
|
128
|
-
const before = result.slice(0, pos);
|
|
129
|
-
const after = result.slice(end);
|
|
130
|
-
const replacement = `[[${slug}]]`;
|
|
131
|
-
result = before + replacement + after;
|
|
132
|
-
linked = true;
|
|
133
|
-
// Update regex index to account for replacement length difference
|
|
134
|
-
re.lastIndex = pos + replacement.length;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return result;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Sync frontmatter.links to match all [[wikilinks]] found in body text.
|
|
141
|
-
*/
|
|
142
|
-
export function syncFrontmatterLinks(body) {
|
|
143
|
-
return extractWikilinks(body);
|
|
144
|
-
}
|
|
145
|
-
//# sourceMappingURL=link-utils.js.map
|
package/dist/link-utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"link-utils.js","sourceRoot":"","sources":["../src/link-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8EAA8E;AAE9E,MAAM,WAAW,GAAG,iCAAiC,CAAC;AAEtD,uFAAuF;AACvF,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAyB,CAAC;IAC9B,MAAM,EAAE,GAAG,IAAI,M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iki structure and content integrity.
|
|
3
|
-
*
|
|
4
|
-
* Checks for orphan pages, broken links, stale pages, scope drift,
|
|
5
|
-
* archive candidates, missing pages, frontmatter issues, index drift,
|
|
6
|
-
* empty categories, and duplicate slugs.
|
|
7
|
-
*
|
|
8
|
-
* When autoFix is true (default), fixable issues are repaired in-place:
|
|
9
|
-
* broken links removed, index rebuilt for drift, missing frontmatter fields set.
|
|
10
|
-
*/
|
|
11
|
-
import type { ParaCategory } from "./wiki.js";
|
|
12
|
-
export interface LintOptions {
|
|
13
|
-
staleDays?: number;
|
|
14
|
-
autoFix?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export interface LintReport {
|
|
17
|
-
issues: LintIssue[];
|
|
18
|
-
fixed: LintIssue[];
|
|
19
|
-
stats: WikiStats;
|
|
20
|
-
}
|
|
21
|
-
export interface LintIssue {
|
|
22
|
-
severity: "error" | "warning" | "info";
|
|
23
|
-
category: string;
|
|
24
|
-
page?: string;
|
|
25
|
-
message: string;
|
|
26
|
-
autoFixable: boolean;
|
|
27
|
-
}
|
|
28
|
-
export interface WikiStats {
|
|
29
|
-
totalPages: number;
|
|
30
|
-
byCategory: Record<ParaCategory, number>;
|
|
31
|
-
totalLinks: number;
|
|
32
|
-
brokenLinks: number;
|
|
33
|
-
orphanPages: number;
|
|
34
|
-
oldestPage: string;
|
|
35
|
-
newestPage: string;
|
|
36
|
-
lastIngest: string;
|
|
37
|
-
}
|
|
38
|
-
export declare function lintWiki(wikiDir: string, options?: LintOptions): Promise<LintReport>;
|
|
39
|
-
//# sourceMappingURL=lint.d.ts.map
|
package/dist/lint.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../src/lint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAYH,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,WAAW,CAAC;AAkBjE,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAw1BD,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,UAAU,CAAC,CA2FrB"}
|