Skip to content

Commit 63516ff

Browse files
committed
fix: sync desktop cleanArtifactTitle preamble patterns with sidecar
1 parent 945a045 commit 63516ff

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

apps/desktop/src/features/dashboard/lib/clean-artifact-title.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { normalizeQuotes } from "./normalize-quotes";
77
* appear as an artifact title. Case-insensitive.
88
*/
99
export const CONVERSATIONAL_PATTERN =
10-
/^(I |I'm |I'll |I've |I don't|I can't|I still|I checked|Got it|Let me|Here |Sure|OK |Okay|Well |So |Hmm|Based on |According to |After reviewing |After analyzing |Looking at |From the |From my |Given |Pulling |Checking |Reviewing |Analyzing |To help |In order to |For this |For your |As requested)/i;
10+
/^(I |I'm |I'll |I've |I don't|I can't|I can |I still|I checked|Got it|Let me|Here |Here'|Sure|OK |Okay|Well |So |Hmm|Based on |According to |After reviewing |After analyzing |Looking at |From the |From my |Given |Pulling |Checking |Reviewing |Analyzing |To help |In order to |For this |For your |As requested|Absolutely|Assuming )/i;
1111

1212
/**
1313
* Returns true if the given title looks like AI conversational preamble

test/ui/clean-artifact-title.test.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,49 @@ describe("clean-artifact-title utility", () => {
5858
expect(src).toMatch(/Sure/);
5959
expect(src).toMatch(/Hmm/);
6060
});
61+
62+
it("detects 'Absolutely' preamble pattern", () => {
63+
const src = readFileSync(utilPath, "utf-8");
64+
expect(src).toMatch(/Absolutely/);
65+
});
66+
67+
it("detects 'Assuming ' preamble pattern", () => {
68+
const src = readFileSync(utilPath, "utf-8");
69+
expect(src).toMatch(/Assuming /);
70+
});
71+
72+
it("detects 'Here\\'' (Here's) preamble pattern", () => {
73+
const src = readFileSync(utilPath, "utf-8");
74+
expect(src).toMatch(/Here'/);
75+
});
76+
77+
it("detects 'I can ' preamble pattern", () => {
78+
const src = readFileSync(utilPath, "utf-8");
79+
expect(src).toMatch(/I can /);
80+
});
81+
82+
it("desktop CONVERSATIONAL_PATTERN matches sidecar patterns", () => {
83+
const src = readFileSync(utilPath, "utf-8");
84+
const sidecarSrc = readFileSync(
85+
resolve(__dirname, "../../packages/sidecar/src/artifact-extractor/title-cleaner.ts"),
86+
"utf-8",
87+
);
88+
89+
// Extract pattern alternatives from both files
90+
const extractAlternatives = (source: string): string[] => {
91+
const match = source.match(/CONVERSATIONAL_PATTERN\s*=\s*\/\^\(([^)]+)\)\//);
92+
if (!match) return [];
93+
return match[1].split("|").map((s) => s.trim()).sort();
94+
};
95+
96+
const desktopAlts = extractAlternatives(src);
97+
const sidecarAlts = extractAlternatives(sidecarSrc);
98+
99+
// Every sidecar pattern should be present in desktop
100+
for (const pattern of sidecarAlts) {
101+
expect(desktopAlts).toContain(pattern);
102+
}
103+
});
61104
});
62105

63106
describe("ArtifactCard summary filtering", () => {

0 commit comments

Comments
 (0)