mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-06 17:49:47 +00:00
Escape project names before building hand-test patterns, compare transport identifiers as literal tokens, preserve boundaries when extracting prose and XML facts, and require canonical containment for smoke static assets. Add regression coverage for metacharacters, dollar identifiers, markup joining, traversal, symlinks, and malformed URL encoding. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
6 lines
293 B
JavaScript
6 lines
293 B
JavaScript
/** Build a pattern for literal text with optional start/end anchoring. */
|
|
export function literalPattern(value, { start = false, end = false } = {}) {
|
|
const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
return new RegExp(`${start ? '^' : ''}${escaped}${end ? '$' : ''}`);
|
|
}
|