mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-04 09:34:05 +00:00
Extract shared normalization/coercion helpers into private @openclaw/normalization-core workspace package while preserving existing plugin SDK helper subpaths.\n\nAlso keeps direct normalization-core imports internal, wires UI/build/loader resolution, and replaces the slow PR network CodeQL lane with a fast added-line boundary scan while retaining full CodeQL for scheduled/manual runs.\n\nVerification: local moved tests, plugin SDK boundary tests, extension loader tests, agents-support shard, UI build/test, build artifacts, lint, workflow guards, autoreview, and GitHub CI passed on PR head 963d893715.
28 lines
824 B
TypeScript
28 lines
824 B
TypeScript
import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce";
|
|
import { normalizeCommandBody, type CommandNormalizeOptions } from "../commands-registry.js";
|
|
|
|
const BTW_COMMAND_RE = /^\/btw(?::|\s|$)/i;
|
|
|
|
export function isBtwRequestText(text?: string, options?: CommandNormalizeOptions): boolean {
|
|
if (!text) {
|
|
return false;
|
|
}
|
|
const normalized = normalizeCommandBody(text, options).trim();
|
|
return BTW_COMMAND_RE.test(normalized);
|
|
}
|
|
|
|
export function extractBtwQuestion(
|
|
text?: string,
|
|
options?: CommandNormalizeOptions,
|
|
): string | null {
|
|
if (!text) {
|
|
return null;
|
|
}
|
|
const normalized = normalizeCommandBody(text, options).trim();
|
|
const match = normalized.match(/^\/btw(?:\s+(.*))?$/i);
|
|
if (!match) {
|
|
return null;
|
|
}
|
|
return normalizeOptionalString(match[1]) ?? "";
|
|
}
|