MCPcopy Index your code
hub / github.com/codeaashu/claude-code / parseXmlBlock

Function parseXmlBlock

src/utils/permissions/yoloClassifier.ts:578–584  ·  view source on GitHub ↗

* Parse XML block response: yes/no * Strips thinking content first to avoid matching tags inside reasoning. * Returns true for "yes" (should block), false for "no", null if unparseable.

(text: string)

Source from the content-addressed store, hash-verified

576 * Returns true for "yes" (should block), false for "no", null if unparseable.
577 */
578function parseXmlBlock(text: string): boolean | null {
579 const matches = [
580 ...stripThinking(text).matchAll(/<block>(yes|no)\b(<\/block>)?/gi),
581 ]
582 if (matches.length === 0) return null
583 return matches[0]![1]!.toLowerCase() === 'yes'
584}
585
586/**
587 * Parse XML reason: <reason>...</reason>

Callers 1

classifyYoloActionXmlFunction · 0.85

Calls 1

stripThinkingFunction · 0.85

Tested by

no test coverage detected