MCPcopy Create free account
hub / github.com/Tencent/teamai-cli / extractRecalledDocIds

Function extractRecalledDocIds

src/transcript-parser.ts:110–135  ·  view source on GitHub ↗
(text: string, out: Set<string>)

Source from the content-addressed store, hash-verified

108}
109
110function extractRecalledDocIds(text: string, out: Set<string>): void {
111 const START = '--- [teamai:recall:start] ---';
112 const END = '--- [teamai:recall:end] ---';
113 const filePattern = /^File:\s*(.+)$/gm;
114
115 let searchFrom = 0;
116 while (true) {
117 const startIdx = text.indexOf(START, searchFrom);
118 if (startIdx === -1) break;
119
120 const endIdx = text.indexOf(END, startIdx + START.length);
121 if (endIdx === -1) break;
122
123 const region = text.slice(startIdx + START.length, endIdx);
124 filePattern.lastIndex = 0;
125
126 let match: RegExpExecArray | null;
127 while ((match = filePattern.exec(region)) !== null) {
128 const filePath = match[1].trim();
129 const docId = path.basename(filePath).replace(/\.md$/i, '');
130 if (isValidDocId(docId)) out.add(docId);
131 }
132
133 searchFrom = endIdx + END.length;
134 }
135}
136
137function extractReferencedDocIds(text: string, out: Set<string>): void {
138 // Case-insensitive; accept smart-punctuation variants of both delimiters.

Callers 2

parseTranscriptForVotesFunction · 0.85

Calls 1

isValidDocIdFunction · 0.85

Tested by

no test coverage detected