MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / parseConversationPluginInvocation

Function parseConversationPluginInvocation

src/core/bridge_coordinator.ts:20531–20553  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

20529}
20530
20531function parseConversationPluginInvocation(text: string): ParsedConversationPluginInvocation | null {
20532 const raw = String(text ?? '').trim();
20533 if (!raw) {
20534 return null;
20535 }
20536 const mentionMatch = raw.match(/^@([a-z0-9][a-z0-9_-]{0,31})\s+([\s\S]+)$/u);
20537 if (mentionMatch) {
20538 return {
20539 token: mentionMatch[1],
20540 taskText: mentionMatch[2].trim(),
20541 syntax: 'at_alias',
20542 };
20543 }
20544 const zhMatch = raw.match(/^用\s*([a-z0-9][a-z0-9_-]{0,31})(?:\s+|[,::,]\s*)([\s\S]+)$/u);
20545 if (zhMatch) {
20546 return {
20547 token: zhMatch[1],
20548 taskText: zhMatch[2].trim(),
20549 syntax: 'zh_alias',
20550 };
20551 }
20552 return null;
20553}
20554
20555function normalizeNullableString(value: unknown): string | null {
20556 const normalized = typeof value === 'string' ? value.trim() : '';

Calls

no outgoing calls

Tested by

no test coverage detected