MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / citationsIn

Function citationsIn

graph-ui/src/compiler/answer-contract.ts:46–62  ·  view source on GitHub ↗
(answer: string)

Source from the content-addressed store, hash-verified

44
45/** Every card id an answer cites, in the order it cites them, without repeats. */
46export function citationsIn(answer: string): string[] {
47 const found: string[] = [];
48 const seen = new Set<string>();
49 const pattern = /\[([^\]]{1,80})\]/g;
50 let match = pattern.exec(answer);
51 while (match !== null) {
52 for (const id of match[1].matchAll(/\bK(\d+)\b/g)) {
53 const key = `K${Number(id[1])}`;
54 if (!seen.has(key)) {
55 seen.add(key);
56 found.push(key);
57 }
58 }
59 match = pattern.exec(answer);
60 }
61 return found;
62}
63
64/** Whether one line is the agreed no-card sentence in either language. */
65export function isNoCardLine(line: string): boolean {

Callers 3

checkCitationsFunction · 0.85
segmentsOfFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected