Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (claude): accept curly apostrophes in negative-assertion/not-saying/couldnt-help-but patterns
Adam Eivy1ad78ecd75a2
diff --git a/server/lib/editorial/slopScore.js b/server/lib/editorial/slopScore.jsindex 3b13e8588f..ac8f6f3eea 100644--- a/server/lib/editorial/slopScore.js+++ b/server/lib/editorial/slopScore.js@@ -205,7 +205,11 @@ export const AI_TELL_PATTERNS = Object.freeze([{id: 'couldnt-help-but',label: '"couldn\'t help but" hedge-tell',- re: /\bcould(?:n'?t| not) help but\b/gi,+ // [''] accepts both the straight apostrophe and the curly one word+ // processors (Word/Scrivener/Google Docs) auto-substitute — manuscript+ // text is not guaranteed to be normalized upstream (see dialogue.js's+ // similar DQUOTE straight+curly handling for double quotes).+ re: /\bcould(?:n['’]?t| not) help but\b/gi,suggestion: 'Commit to the action directly — cut the hedge and just show the character doing it.',},{@@ -266,8 +270,12 @@ export function findAiTells(text, opts = {}) {// ---------------------------------------------------------------------------const NOT_JUST_BUT_RE = /\bnot\s+(?:just|only)\b[^.!?\n]{1,100}?\bbut\b(?:\s+also)?[^.!?\n]{1,100}?[.!?]/gi;-const NOT_SAYING_RE = /\bI'?m\s+not\s+saying\b[^.!?\n]{1,100}?\bI'?m\s+saying\b[^.!?\n]{1,100}?[.!?]/gi;-const NEGATIVE_ASSERTION_RE = /\b(?:did|does)\s+not\s+[a-z]+\b|\b(?:didn'?t|doesn'?t)\s+[a-z]+\b/gi;+// [''] accepts both the straight apostrophe and the curly one word processors+// (Word/Scrivener/Google Docs) auto-substitute — manuscript text is not+// guaranteed to be normalized upstream (see dialogue.js's similar DQUOTE+// straight+curly handling for double quotes).+const NOT_SAYING_RE = /\bI['’]?m\s+not\s+saying\b[^.!?\n]{1,100}?\bI['’]?m\s+saying\b[^.!?\n]{1,100}?[.!?]/gi;+const NEGATIVE_ASSERTION_RE = /\b(?:did|does)\s+not\s+[a-z]+\b|\b(?:didn['’]?t|doesn['’]?t)\s+[a-z]+\b/gi;const THE_WAY_RE = /\bthe\s+way\s+(?:[a-z']+\s+){1,4}?(?:[a-z]+(?:ed|ing)|did|does|would|had|has|was|were|is|are|could|can|might|should)\b/gi;/**diff --git a/server/lib/editorial/slopScore.test.js b/server/lib/editorial/slopScore.test.jsindex d8d2584b91..7f13f14fc3 100644--- a/server/lib/editorial/slopScore.test.js+++ b/server/lib/editorial/slopScore.test.js@@ -128,6 +128,12 @@ describe('findAiTells', () => {expect(findAiTells('The door creaked open and she stepped through.')).toHaveLength(0);});+ it('"couldn\'t help but" matches the typographic curly apostrophe too', () => {+ // ’ is the curly apostrophe Word/Scrivener/Google Docs auto-substitute.+ const hits = findAiTells('She couldn’t help but smile at the memory.');+ expect(hits.map((h) => h.id)).toContain('couldnt-help-but');+ });+it('every pattern declares a unique id', () => {const ids = AI_TELL_PATTERNS.map((p) => p.id);expect(new Set(ids).size).toBe(ids.length);@@ -161,6 +167,12 @@ describe('findNotSayingPatterns', () => {it('does not flag a lone "I\'m not saying" clause', () => {expect(findNotSayingPatterns("I'm not saying anything else about it tonight.")).toHaveLength(0);});++ it('matches typographic curly apostrophes too (word-processor manuscripts)', () => {+ // ’ is the curly apostrophe Word/Scrivener/Google Docs auto-substitute.+ const text = 'I’m not saying he’s guilty, I’m saying the evidence is thin.';+ expect(findNotSayingPatterns(text)).toHaveLength(1);+ });});describe('findNegativeAssertions', () => {@@ -173,6 +185,11 @@ describe('findNegativeAssertions', () => {it('returns nothing for text with no negative assertions', () => {expect(findNegativeAssertions('She smiled and walked away.')).toHaveLength(0);});++ it('matches typographic curly apostrophes too (word-processor manuscripts)', () => {+ const text = 'They didn’t speak. It doesn’t matter.';+ expect(findNegativeAssertions(text)).toHaveLength(2);+ });});describe('findTheWaySimiles', () => {