fix: preserve inline directive spacing tests (thanks @joshp123) (#539)
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
- Auto-reply: preserve block reply ordering with timeout fallback for streaming. (#503) — thanks @joshp123
|
- 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: 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: 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
|
- 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
|
- 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
|
- WhatsApp: group `/model list` output by provider for scannability. (#456) - thanks @mcinteerj
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
import { extractStatusDirective } from "./reply/directives.js";
|
||||||
import {
|
import {
|
||||||
extractElevatedDirective,
|
extractElevatedDirective,
|
||||||
extractQueueDirective,
|
extractQueueDirective,
|
||||||
@@ -119,6 +120,24 @@ describe("directive parsing", () => {
|
|||||||
expect(res.cleaned).toBe("please now");
|
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", () => {
|
it("parses queue options and modes", () => {
|
||||||
const res = extractQueueDirective(
|
const res = extractQueueDirective(
|
||||||
"please /queue steer+backlog debounce:2s cap:5 drop:summarize now",
|
"please /queue steer+backlog debounce:2s cap:5 drop:summarize now",
|
||||||
|
|||||||
@@ -271,8 +271,9 @@ export function extractQueueDirective(body?: string): {
|
|||||||
const argsStart = start + "/queue".length;
|
const argsStart = start + "/queue".length;
|
||||||
const args = body.slice(argsStart);
|
const args = body.slice(argsStart);
|
||||||
const parsed = parseQueueDirectiveArgs(args);
|
const parsed = parseQueueDirectiveArgs(args);
|
||||||
const cleanedRaw =
|
const cleanedRaw = `${body.slice(0, start)} ${body.slice(
|
||||||
body.slice(0, start) + " " + body.slice(argsStart + parsed.consumed);
|
argsStart + parsed.consumed,
|
||||||
|
)}`;
|
||||||
const cleaned = cleanedRaw.replace(/\s+/g, " ").trim();
|
const cleaned = cleanedRaw.replace(/\s+/g, " ").trim();
|
||||||
return {
|
return {
|
||||||
cleaned,
|
cleaned,
|
||||||
|
|||||||
Reference in New Issue
Block a user