MCPcopy Create free account
hub / github.com/apache/maka / parseMetaComment

Function parseMetaComment

packages/core/src/local-memory.ts:728–742  ·  view source on GitHub ↗
(line: string)

Source from the content-addressed store, hash-verified

726}
727
728function parseMetaComment(line: string): Record<string, string> | null {
729 const match = /^<!--\s*maka-memory:\s*(.*?)\s*-->$/.exec(line.trim());
730 if (!match) return null;
731 const meta: Record<string, string> = {};
732 for (const part of (match[1] ?? '').split(/\s+/)) {
733 const idx = part.indexOf('=');
734 if (idx <= 0) continue;
735 const key = part.slice(0, idx);
736 const value = part.slice(idx + 1);
737 if (/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(key) && value.length <= 128) {
738 meta[key] = value;
739 }
740 }
741 return meta;
742}
743
744function findLocalMemoryEntrySection(
745 input: string,

Calls 4

indexOfMethod · 0.80
execMethod · 0.65
testMethod · 0.65
trimMethod · 0.45

Tested by

no test coverage detected