Refactor CLI and Twilio modules; add helper tests and comments

This commit is contained in:
Peter Steinberger
2025-11-25 03:11:39 +01:00
parent c71abf13a1
commit afdaa7ef98
17 changed files with 996 additions and 734 deletions

View File

@@ -1,5 +1,6 @@
// Helpers specific to Claude CLI output/argv handling.
// Preferred binary name for Claude CLI invocations.
export const CLAUDE_BIN = "claude";
function extractClaudeText(payload: unknown): string | undefined {
@@ -45,7 +46,7 @@ function extractClaudeText(payload: unknown): string | undefined {
}
export function parseClaudeJsonText(raw: string): string | undefined {
// Handle a single JSON blob or newline-delimited JSON; return the first extracted text.
// Handle a single JSON blob or newline-delimited JSON; return the first extracted text.
const candidates = [raw, ...raw.split(/\n+/).map((s) => s.trim()).filter(Boolean)];
for (const candidate of candidates) {
try {