@staix/vault-mem 0.9.0 → 0.10.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/CHANGELOG.md +32 -0
- package/README.md +19 -6
- package/bin/vmem.js +2 -2
- package/package.json +2 -2
- package/src/analysis-commands.ts +24 -14
- package/src/analysis-input.ts +12 -0
- package/src/analysis-types.ts +5 -1
- package/src/assert-command.ts +48 -0
- package/src/assertion-exposure.ts +367 -0
- package/src/assertion-index.ts +86 -0
- package/src/assertion-policy.ts +63 -0
- package/src/assertion-read.ts +170 -0
- package/src/assertions-command.ts +123 -0
- package/src/assertions.ts +1013 -0
- package/src/cli-output.ts +9 -3
- package/src/cli.ts +44 -23
- package/src/commands-table.ts +16 -2
- package/src/evidence.ts +222 -0
- package/src/graph-evidence.ts +169 -0
- package/src/index.ts +14 -0
- package/src/links.ts +18 -0
- package/src/log-commands.ts +7 -7
- package/src/mcp-spec.ts +11 -11
- package/src/mcp-vault.ts +105 -6
- package/src/mcp.ts +4 -0
- package/src/org-commands.ts +5 -5
- package/src/org-promote.ts +9 -0
- package/src/promote-command.ts +6 -6
- package/src/proposal-commands.ts +100 -0
- package/src/proposal-provider.ts +335 -0
- package/src/proposal-storage.ts +334 -0
- package/src/proposals.ts +170 -0
- package/src/read-commands.ts +44 -12
- package/src/read-output.ts +42 -14
- package/src/skills-mine.ts +12 -7
- package/src/source-age.ts +131 -0
- package/src/spec-output.ts +14 -13
- package/src/sync.ts +14 -7
- package/src/text-output.ts +86 -21
- package/src/vault-brief.ts +8 -4
- package/src/vault-graph.ts +12 -3
- package/src/vault-history.ts +662 -0
- package/src/vault-index.ts +2 -0
- package/src/vault-lint.ts +15 -4
- package/src/write-commands.ts +18 -17
- package/src/write-output.ts +6 -6
- package/src/write-types.ts +1 -0
- package/src/write-validation.ts +3 -1
- package/src/writer.ts +257 -11
package/src/text-output.ts
CHANGED
|
@@ -6,13 +6,39 @@
|
|
|
6
6
|
import type { WriteIssue } from "./write-types.ts";
|
|
7
7
|
|
|
8
8
|
export type Tone = "ok" | "warn" | "fail" | "muted" | "info" | "accent" | "bold";
|
|
9
|
-
export
|
|
9
|
+
export type Role = "header" | "section" | "key" | "value" | "success" | "warning" | "error" | "hint" | "accent";
|
|
10
|
+
export type Marker = "ok" | "fail" | "warn" | "absent" | "unknown" | "pending" | "active" | "next";
|
|
11
|
+
export interface TextOptions { color: boolean; columns?: number; ascii?: boolean }
|
|
10
12
|
export interface Cell { text: string; tone?: Tone }
|
|
11
13
|
export type CellInput = string | number | boolean | null | undefined | Cell;
|
|
12
14
|
|
|
13
15
|
/** Plain text, no wrapping: the default for library callers and tests. */
|
|
14
16
|
export const PLAIN: TextOptions = { color: false };
|
|
15
|
-
const
|
|
17
|
+
const ROLE_CODES: Record<Role, string> = { header: "1;34", section: "1;35", key: "34", value: "", success: "1;32", warning: "1;33", error: "1;31", hint: "90", accent: "36" };
|
|
18
|
+
const TONE_ROLES: Record<Tone, Role> = { ok: "success", warn: "warning", fail: "error", muted: "hint", info: "accent", accent: "accent", bold: "header" };
|
|
19
|
+
export const MARKERS: Record<Marker, { glyph: string; ascii: string; role: Role }> = {
|
|
20
|
+
ok: { glyph: "✓", ascii: "ok", role: "success" }, fail: { glyph: "✗", ascii: "x", role: "error" }, warn: { glyph: "⚠", ascii: "!", role: "warning" },
|
|
21
|
+
absent: { glyph: "-", ascii: "-", role: "hint" }, unknown: { glyph: "?", ascii: "?", role: "hint" }, pending: { glyph: "~", ascii: "~", role: "hint" },
|
|
22
|
+
active: { glyph: "*", ascii: "*", role: "success" }, next: { glyph: "→", ascii: "->", role: "accent" },
|
|
23
|
+
};
|
|
24
|
+
export function marker(name: Marker, o: TextOptions): string {
|
|
25
|
+
const item = MARKERS[name], text = o.ascii ? item.ascii : item.glyph;
|
|
26
|
+
return paint(text + " ".repeat(Math.max(0, 2 - width(text))), item.role, o);
|
|
27
|
+
}
|
|
28
|
+
/** A status marker with its state word or finding; padding remains visible without color. */
|
|
29
|
+
export function status(name: "ok" | "warn" | "fail" | "unknown" | "pending" | "absent" | "active", text: string, o: TextOptions): string {
|
|
30
|
+
return `${marker(name, o)} ${paint(clean(text), MARKERS[name].role, o)}`;
|
|
31
|
+
}
|
|
32
|
+
/** Invocation errors use a marker only for a terminal, with color resolved for stderr. */
|
|
33
|
+
export function errorLine(message: string, o: TextOptions, isTTY: boolean): string {
|
|
34
|
+
const text = `vmem: ${clean(message)}`;
|
|
35
|
+
return isTTY ? status("fail", text, o) : paint(text, "error", o);
|
|
36
|
+
}
|
|
37
|
+
export function summary(counts: { failed?: number; warnings?: number; ok?: number; unknown?: number }, o: TextOptions): string {
|
|
38
|
+
const entries = [["fail", counts.failed, "failed"], ["warn", counts.warnings, "warnings"], ["ok", counts.ok, "ok"], ["unknown", counts.unknown, "unknown"]] as const;
|
|
39
|
+
return entries.filter(([, count]) => count).map(([name, count, label]) => `${marker(name, o)} ${count} ${label}`).join(" ") || `${marker("ok", o)} 0 ok`;
|
|
40
|
+
}
|
|
41
|
+
export class UsageError extends Error {}
|
|
16
42
|
const COLOR_USAGE = "--color: expected --color=auto, --color=always or --color=never";
|
|
17
43
|
|
|
18
44
|
/** Removes the one allowed `--color=` flag from args. It may appear anywhere before a `--` separator. */
|
|
@@ -20,37 +46,41 @@ export function takeColorFlag(args: string[]): { args: string[]; color?: string
|
|
|
20
46
|
const end = args.includes("--") ? args.indexOf("--") : args.length;
|
|
21
47
|
const found = args.slice(0, end).filter(arg => arg === "--color" || arg.startsWith("--color="));
|
|
22
48
|
if (!found.length) return { args };
|
|
23
|
-
if (found.length > 1 || found[0] === "--color") throw new
|
|
49
|
+
if (found.length > 1 || found[0] === "--color") throw new UsageError(`${COLOR_USAGE}, given once`);
|
|
24
50
|
return { args: args.filter((arg, i) => i >= end || arg !== found[0]), color: found[0]!.slice("--color=".length) };
|
|
25
51
|
}
|
|
26
|
-
export function resolveColor(flag: string | undefined, env: { isTTY: boolean; TERM?: string; NO_COLOR?: string }): boolean {
|
|
52
|
+
export function resolveColor(flag: string | undefined, env: { isTTY: boolean; TERM?: string; NO_COLOR?: string; FORCE_COLOR?: string; CLICOLOR_FORCE?: string; CLICOLOR?: string }): boolean {
|
|
27
53
|
if (flag === "always") return true;
|
|
28
54
|
if (flag === "never") return false;
|
|
29
|
-
if (flag
|
|
30
|
-
|
|
55
|
+
if (flag !== undefined && flag !== "auto") throw new UsageError(COLOR_USAGE);
|
|
56
|
+
if (env.NO_COLOR) return false;
|
|
57
|
+
if ((env.FORCE_COLOR && env.FORCE_COLOR !== "0") || (env.CLICOLOR_FORCE && env.CLICOLOR_FORCE !== "0")) return true;
|
|
58
|
+
if (env.FORCE_COLOR === "0" || env.CLICOLOR === "0") return false;
|
|
59
|
+
return env.isTTY && env.TERM !== "dumb";
|
|
31
60
|
}
|
|
32
61
|
/** Terminal width on a TTY (at least 80), else `COLUMNS` when set, else no wrapping. */
|
|
33
62
|
export function outputWidth(env: { isTTY: boolean; columns?: number; COLUMNS?: string }): number | undefined {
|
|
34
|
-
if (env.isTTY) return
|
|
63
|
+
if (env.isTTY) return env.columns && Number.isFinite(env.columns) && env.columns > 0 ? env.columns : 80;
|
|
35
64
|
return env.COLUMNS && /^[1-9][0-9]*$/.test(env.COLUMNS) ? Number(env.COLUMNS) : undefined;
|
|
36
65
|
}
|
|
37
66
|
/** Options for a stdout; the default is a non-terminal, so library calls and tests get the same text everywhere. */
|
|
38
67
|
export function textOptions(flag: string | undefined, env: NodeJS.ProcessEnv = process.env, stdout: { isTTY?: boolean; columns?: number } = {}): TextOptions {
|
|
39
|
-
const isTTY = stdout.isTTY === true, color = resolveColor(flag, {
|
|
68
|
+
const isTTY = stdout.isTTY === true, color = resolveColor(flag, { ...env, isTTY });
|
|
40
69
|
const columns = outputWidth({ isTTY, columns: stdout.columns, COLUMNS: env.COLUMNS });
|
|
41
|
-
return { color, ...(columns !== undefined ? { columns } : {}) };
|
|
70
|
+
return { color, ascii: !/utf-?8/i.test(env.LC_ALL || env.LC_CTYPE || env.LANG || ""), ...(columns !== undefined ? { columns } : {}) };
|
|
42
71
|
}
|
|
43
72
|
|
|
44
73
|
const cell = (value: CellInput): Cell => typeof value === "object" && value !== null ? value : { text: value === null || value === undefined ? "" : String(value) };
|
|
45
74
|
/** Control characters (terminal escapes, tabs, newlines) never reach the terminal from data. */
|
|
46
75
|
export const clean = (text: string) => text.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ");
|
|
47
|
-
export const width = (text: string) => Bun.stringWidth(text);
|
|
76
|
+
export const width = (text: string) => Bun.stringWidth(text, { ambiguousIsNarrow: true });
|
|
48
77
|
/** Note and spec bodies printed as is, minus terminal escape sequences (OSC, CSI, C1) and control characters other than tab and newline. */
|
|
49
78
|
export const stripTerminal = (text: string) => text
|
|
50
79
|
.replace(/\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)?|\u001b\[[0-?]*[ -/]*[@-~]?|\u009b[0-?]*[ -/]*[@-~]?|\u001b[^[\]]?/g, "")
|
|
51
80
|
.replace(/\r\n?/g, "\n").replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f]/g, "");
|
|
52
|
-
export function paint(text: string, tone: Tone | undefined, o: TextOptions): string {
|
|
53
|
-
|
|
81
|
+
export function paint(text: string, tone: Tone | Role | undefined, o: TextOptions): string {
|
|
82
|
+
const role = tone && (TONE_ROLES[tone as Tone] ?? tone as Role), code = role && ROLE_CODES[role];
|
|
83
|
+
return o.color && code && text ? `\u001b[${code}m${text}\u001b[0m` : text;
|
|
54
84
|
}
|
|
55
85
|
export const tone = (text: CellInput, t: Tone): Cell => ({ text: cell(text).text, tone: t });
|
|
56
86
|
const graphemes = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
@@ -59,7 +89,7 @@ const graphemes = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
|
59
89
|
export function wrap(text: string, columns: number | undefined, indent = ""): string[] {
|
|
60
90
|
const flat = clean(text);
|
|
61
91
|
if (columns === undefined) return [indent + flat];
|
|
62
|
-
const room = Math.max(
|
|
92
|
+
const room = Math.max(1, columns - width(indent)), lines: string[] = [];
|
|
63
93
|
let line = "";
|
|
64
94
|
for (const word of flat.split(/ +/).filter(Boolean)) {
|
|
65
95
|
const pieces: string[] = [];
|
|
@@ -80,16 +110,51 @@ const pad = (text: string, size: number) => text + " ".repeat(Math.max(0, size -
|
|
|
80
110
|
* wraps under itself; with no width (pipes, tests) rows stay on one line.
|
|
81
111
|
*/
|
|
82
112
|
export function table(headers: string[], rows: CellInput[][], o: TextOptions): string {
|
|
113
|
+
return tableParts(headers, rows, o).join("\n");
|
|
114
|
+
}
|
|
115
|
+
/** Table blocks retain the row boundaries when a cell wraps across several lines. */
|
|
116
|
+
export function tableParts(headers: string[], rows: CellInput[][], o: TextOptions): string[] {
|
|
83
117
|
const data = rows.map(row => headers.map((_, i) => { const c = cell(row[i]); return { ...c, text: clean(c.text) }; }));
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
|
|
118
|
+
const last = headers.length - 1;
|
|
119
|
+
const sizes = headers.map((header, i) => Math.min(i === last ? Infinity : 32, Math.max(width(header), ...data.map(row => width(row[i]!.text)))));
|
|
120
|
+
if (o.columns !== undefined) {
|
|
121
|
+
while (sizes.slice(0, last).reduce((sum, size) => sum + size + 2, 0) + 10 > o.columns) {
|
|
122
|
+
let largest = -1;
|
|
123
|
+
for (let i = 0; i < last; i++) if (sizes[i]! > 4 && (largest < 0 || sizes[i]! > sizes[largest]!)) largest = i;
|
|
124
|
+
if (largest < 0) break;
|
|
125
|
+
sizes[largest]!--;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const lead = sizes.slice(0, last).reduce((sum, size) => sum + size + 2, 0);
|
|
129
|
+
const lastRoom = o.columns !== undefined && lead + sizes[last]! > o.columns ? Math.max(1, o.columns - lead) : undefined;
|
|
130
|
+
const shorten = (text: string, size: number) => {
|
|
131
|
+
if (width(text) <= size) return text;
|
|
132
|
+
let start = "", end = "";
|
|
133
|
+
const parts = [...graphemes.segment(text)].map(part => part.segment);
|
|
134
|
+
while (parts.length && width(start + "..." + end) < size) {
|
|
135
|
+
const part = parts.shift()!;
|
|
136
|
+
if (width(start + part + "..." + end) > size) break;
|
|
137
|
+
start += part;
|
|
138
|
+
if (parts.length) {
|
|
139
|
+
const tail = parts.pop()!;
|
|
140
|
+
if (width(start + "..." + tail + end) <= size) end = tail + end;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return start + "..." + end;
|
|
144
|
+
};
|
|
87
145
|
const line = (cells: Cell[], bold = false) => {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
146
|
+
const columns = cells.map((c, i) => {
|
|
147
|
+
if (i === last) return wrap(c.text, lastRoom);
|
|
148
|
+
if (/PATH|^(ID|STATE)$/i.test(headers[i]!)) return [shorten(c.text, sizes[i]!)];
|
|
149
|
+
return width(c.text) <= sizes[i]! ? [c.text] : wrap(c.text, sizes[i]!);
|
|
150
|
+
});
|
|
151
|
+
const height = Math.max(...columns.map(parts => parts.length));
|
|
152
|
+
return Array.from({ length: height }, (_, row) => cells.map((c, i) => {
|
|
153
|
+
const part = columns[i]![row] ?? "";
|
|
154
|
+
return paint(i === last ? part : pad(part, sizes[i]!), bold ? "key" : c.tone, o);
|
|
155
|
+
}).join(" ").replace(/ +$/, "")).join("\n");
|
|
91
156
|
};
|
|
92
|
-
return [line(headers.map(text => ({ text })), true), ...data.map(row => line(row))]
|
|
157
|
+
return [line(headers.map(text => ({ text })), true), ...data.map(row => line(row))];
|
|
93
158
|
}
|
|
94
159
|
/** `label value` lines with aligned values, indented by two spaces. Empty values are left out. */
|
|
95
160
|
export function fields(pairs: [label: string, value: CellInput][], o: TextOptions, indent = " "): string {
|
|
@@ -112,7 +177,7 @@ export const plural = (count: number, one: string, many = `${one}s`) => `${count
|
|
|
112
177
|
export function issueTable(issues: readonly WriteIssue[], o: TextOptions): string | undefined {
|
|
113
178
|
if (!issues.length) return undefined;
|
|
114
179
|
const sorted = [...issues].sort((a, b) => (a.severity === b.severity ? 0 : a.severity === "error" ? -1 : 1));
|
|
115
|
-
return table(["LEVEL", "CODE", "PATH", "MESSAGE"], sorted.map(issue => [tone(issue.severity, issue.severity === "error" ? "fail" : "warn"), issue.code, issue.path ?? "-", issue.message]), o);
|
|
180
|
+
return table(["LEVEL", "CODE", "PATH", "MESSAGE"], sorted.map(issue => [tone(`${marker(issue.severity === "error" ? "fail" : "warn", { ...o, color: false })} ${issue.severity}`, issue.severity === "error" ? "fail" : "warn"), issue.code, issue.path ?? "-", issue.message]), o);
|
|
116
181
|
}
|
|
117
182
|
/** The command a person runs next, for example to confirm a preview or read the next page. */
|
|
118
183
|
export const nextCommand = (label: string, command: string, o: TextOptions) => `${label}: ${paint(clean(command), "info", o)}`;
|
package/src/vault-brief.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { unenforceablePii, type VaultSpec } from "./config.ts";
|
|
|
4
4
|
import { canonicalPath, isDenied } from "./platform.ts";
|
|
5
5
|
import { loadRegistry } from "./registry.ts";
|
|
6
6
|
import { VaultIndex, type BriefPointer } from "./vault-index.ts";
|
|
7
|
+
import { UsageError } from "./text-output.ts";
|
|
7
8
|
import { screenContent, screenMetadata } from "./write-validation.ts";
|
|
8
9
|
|
|
9
10
|
export interface VaultBrief { vault: string; lines: string[]; omitted: number; bytes: number }
|
|
@@ -76,15 +77,18 @@ export function runBriefCommand(args: string[], home: string): { text: string; c
|
|
|
76
77
|
const arg = args[i]!;
|
|
77
78
|
if (!arg.startsWith("-")) { positional.push(arg); continue; }
|
|
78
79
|
if (arg === "--json" && !json) { json = true; continue; }
|
|
79
|
-
if (!["--for", "--paths", "--bytes"].includes(arg)) throw new
|
|
80
|
+
if (!["--for", "--paths", "--bytes"].includes(arg)) throw new UsageError(`brief: unknown or repeated option ${arg}; run vmem brief --help`);
|
|
80
81
|
const value = args[++i];
|
|
81
|
-
if (!value || value.startsWith("--")) throw new
|
|
82
|
+
if (!value || value.startsWith("--")) throw new UsageError(`brief: ${arg} requires a value; run vmem brief --help`);
|
|
82
83
|
if (arg === "--paths") paths.push(value);
|
|
83
84
|
else if (arg === "--for" && intent === undefined) intent = value;
|
|
84
85
|
else if (arg === "--bytes" && bytes === undefined && /^[0-9]+$/.test(value)) bytes = Number(value);
|
|
85
|
-
else throw new
|
|
86
|
+
else throw new UsageError(`brief: repeated option or invalid value for ${arg}; run vmem brief --help`);
|
|
86
87
|
}
|
|
87
|
-
if (positional.length !== 1 || intent === undefined) throw new
|
|
88
|
+
if (positional.length !== 1 || intent === undefined) throw new UsageError("brief: requires one registered vault and --for intent; run vmem brief --help");
|
|
89
|
+
if (!intent.trim() || Buffer.byteLength(intent) > 1024) throw new UsageError("brief: intent must contain 1..1024 UTF-8 bytes");
|
|
90
|
+
if (bytes !== undefined && (!Number.isSafeInteger(bytes) || bytes < 256 || bytes > 4096)) throw new UsageError("brief: bytes must be an integer 256..4096");
|
|
91
|
+
if (paths.length > 16 || paths.some(p => !p.trim() || Buffer.byteLength(p) > 1024 || /\p{Cc}/u.test(p))) throw new UsageError("brief: paths must be at most 16 nonempty hints of at most 1024 bytes without control characters");
|
|
88
92
|
const result = vaultBrief(home, { vault: positional[0]!, intent, paths, bytes });
|
|
89
93
|
return { text: json ? JSON.stringify(result) : briefText(result), code: 0 };
|
|
90
94
|
}
|
package/src/vault-graph.ts
CHANGED
|
@@ -339,7 +339,7 @@ export function labelCommunities(ids: readonly string[], edges: readonly (readon
|
|
|
339
339
|
return leidenCommunities(ids, edges).membership;
|
|
340
340
|
}
|
|
341
341
|
/** The typed relation of a `- [[x]] (relation)` list line, or undefined for any other wiki link. */
|
|
342
|
-
function linkRelation(body: string, index: number, length: number): string | undefined {
|
|
342
|
+
export function linkRelation(body: string, index: number, length: number): string | undefined {
|
|
343
343
|
// Only `- [[` can be typed; check the two characters before the link before scanning back to the line start,
|
|
344
344
|
// so a long line of plain links stays linear. The scan back then crosses only whitespace.
|
|
345
345
|
if (index < 2 || body[index - 1] !== " " || body[index - 2] !== "-") return undefined;
|
|
@@ -348,6 +348,15 @@ function linkRelation(body: string, index: number, length: number): string | und
|
|
|
348
348
|
const after = /^ \(([a-z-]+)\)(?::|\s*(?:\n|$))/.exec(body.slice(index + length, index + length + 40));
|
|
349
349
|
return after && (LINK_RELATIONS as readonly string[]).includes(after[1]!) ? after[1] : undefined;
|
|
350
350
|
}
|
|
351
|
+
/** The body the legacy graph scans: the source after its `---` frontmatter block, and that block's length. */
|
|
352
|
+
export function graphBody(source: string): { body: string; offset: number } {
|
|
353
|
+
const match = FRONTMATTER.exec(source);
|
|
354
|
+
return match ? { body: source.slice(match[0].length), offset: match[0].length } : { body: source, offset: 0 };
|
|
355
|
+
}
|
|
356
|
+
/** The legacy body link pattern; `graph explain` reuses it so occurrences match exactly the edges `buildGraph` makes. */
|
|
357
|
+
export const LEGACY_LINK = /\[\[([^\]|]+?)(?:\|[^\]]+?)?\]\]/g;
|
|
358
|
+
/** Legacy target normalisation: trimmed, lower case, spaces to hyphens. */
|
|
359
|
+
export const legacyTarget = (text: string) => text.trim().toLowerCase().replaceAll(" ", "-");
|
|
351
360
|
/** Pure transformation of the derived-index snapshot, preserving the reference wiki graph semantics. */
|
|
352
361
|
export function buildGraph(snapshot: AnalysisSnapshot): VaultGraph {
|
|
353
362
|
if (snapshot.notes.length > MAX_NODES) throw new Error(`graph: exceeds ${MAX_NODES} notes`);
|
|
@@ -362,8 +371,8 @@ export function buildGraph(snapshot: AnalysisSnapshot): VaultGraph {
|
|
|
362
371
|
confidence: pyString(truthy(fm.confidence) ? fm.confidence : ""), source_file: `notes/${id}.md`,
|
|
363
372
|
topics: Array.isArray(topics) ? topics.map(topic => pyString(topic).replaceAll("[[", "").replaceAll("]]", "")).join(", ") : pyString(topics),
|
|
364
373
|
community: null, degree: 0 });
|
|
365
|
-
for (const match of body.matchAll(
|
|
366
|
-
const target = match[1]
|
|
374
|
+
for (const match of body.matchAll(LEGACY_LINK)) {
|
|
375
|
+
const target = legacyTarget(match[1]!);
|
|
367
376
|
if (!stems.has(target)) continue;
|
|
368
377
|
const [source, destination] = [id, target].sort(compare) as [string, string];
|
|
369
378
|
const key = JSON.stringify([source, destination]), rel = linkRelation(body, match.index, match[0].length), prior = edges.get(key);
|