🤖 codex: preserve spacing after inline directives (issue-telegram-inline-spacing)

This commit is contained in:
Josh Palmer authored and Peter Steinberger committed 2026-01-09 00:37:40 +01:00
1 parent 4e92ccc0dd
commit 43545a4864
4 files changed
+10 -3

No files matched your search

+6
View File
@@ -107,6 +107,12 @@ describe("extractModelDirective", () => {
});
describe("edge cases", () => {
it("preserves spacing when /model is followed by a path segment", () => {
const result = extractModelDirective("thats not /model gpt-5/tmp/hello");
expect(result.hasDirective).toBe(true);
expect(result.cleaned).toBe("thats not /hello");
});
it("handles alias with special regex characters", () => {
const result = extractModelDirective("/test.alias", {
aliases: ["test.alias"],
+1 -1
View File
@@ -42,7 +42,7 @@ export function extractModelDirective(
}
const cleaned = match
? body.replace(match[0], "").replace(/\s+/g, " ").trim()
? body.replace(match[0], " ").replace(/\s+/g, " ").trim()
: body.trim();
return {
+2 -1
View File
@@ -56,6 +56,7 @@ const extractLevelDirective = <T>(
const level = normalize(rawLevel);
const cleaned = body
.slice(0, match.start)
.concat(" ")
.concat(body.slice(match.end))
.replace(/\s+/g, " ")
.trim();
@@ -76,7 +77,7 @@ const extractSimpleDirective = (
new RegExp(`(?:^|\\s)\\/(?:${namePattern})(?=$|\\s|:)(?:\\s*:\\s*)?`, "i"),
);
const cleaned = match
? body.replace(match[0], "").replace(/\s+/g, " ").trim()
? body.replace(match[0], " ").replace(/\s+/g, " ").trim()
: body.trim();
return {
cleaned,
+1 -1
View File
@@ -272,7 +272,7 @@ export function extractQueueDirective(body?: string): {
const args = body.slice(argsStart);
const parsed = parseQueueDirectiveArgs(args);
const cleanedRaw =
body.slice(0, start) + body.slice(argsStart + parsed.consumed);
body.slice(0, start) + " " + body.slice(argsStart + parsed.consumed);
const cleaned = cleanedRaw.replace(/\s+/g, " ").trim();
return {
cleaned,