diff --git a/CHANGELOG.md b/CHANGELOG.md index c8dd7436c..12d5aef05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - Auto-reply: preserve block reply ordering with timeout fallback for streaming. (#503) — thanks @joshp123 - Auto-reply: block reply ordering fix (duplicate PR superseded by #503). (#483) — thanks @AbhisekBasu1 - Auto-reply: avoid splitting outbound chunks inside parentheses. (#499) — thanks @philipp-spiess +- Auto-reply: preserve spacing when stripping inline directives. (#539) — thanks @joshp123 - Status: show provider prefix in /status model display. (#506) — thanks @mcinteerj - macOS: package ClawdbotKit resources and Swift 6.2 compatibility dylib to avoid launch/tool crashes. (#473) — thanks @gupsammy - WhatsApp: group `/model list` output by provider for scannability. (#456) - thanks @mcinteerj diff --git a/src/auto-reply/reply.directive.parse.test.ts b/src/auto-reply/reply.directive.parse.test.ts index b4bf49009..91b321a99 100644 --- a/src/auto-reply/reply.directive.parse.test.ts +++ b/src/auto-reply/reply.directive.parse.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from "vitest"; +import { extractStatusDirective } from "./reply/directives.js"; import { extractElevatedDirective, extractQueueDirective, @@ -119,6 +120,24 @@ describe("directive parsing", () => { expect(res.cleaned).toBe("please now"); }); + it("preserves spacing when stripping think directives before paths", () => { + const res = extractThinkDirective("thats not /think high/tmp/hello"); + expect(res.hasDirective).toBe(true); + expect(res.cleaned).toBe("thats not /tmp/hello"); + }); + + it("preserves spacing when stripping verbose directives before paths", () => { + const res = extractVerboseDirective("thats not /verbose on/tmp/hello"); + expect(res.hasDirective).toBe(true); + expect(res.cleaned).toBe("thats not /tmp/hello"); + }); + + it("preserves spacing when stripping status directives before paths", () => { + const res = extractStatusDirective("thats not /status:/tmp/hello"); + expect(res.hasDirective).toBe(true); + expect(res.cleaned).toBe("thats not /tmp/hello"); + }); + it("parses queue options and modes", () => { const res = extractQueueDirective( "please /queue steer+backlog debounce:2s cap:5 drop:summarize now", diff --git a/src/auto-reply/reply/queue.ts b/src/auto-reply/reply/queue.ts index a7cf97e66..0b486fe57 100644 --- a/src/auto-reply/reply/queue.ts +++ b/src/auto-reply/reply/queue.ts @@ -271,8 +271,9 @@ export function extractQueueDirective(body?: string): { const argsStart = start + "/queue".length; const args = body.slice(argsStart); const parsed = parseQueueDirectiveArgs(args); - const cleanedRaw = - body.slice(0, start) + " " + body.slice(argsStart + parsed.consumed); + const cleanedRaw = `${body.slice(0, start)} ${body.slice( + argsStart + parsed.consumed, + )}`; const cleaned = cleanedRaw.replace(/\s+/g, " ").trim(); return { cleaned,