@heyramzi/lint 2.14.2 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -225,7 +225,9 @@ function report(file, result, fixed) {
225
225
  console.log(
226
226
  `${file}: ${result.words} words, ${result.language}, ledger ${first} first / ${second} second`,
227
227
  );
228
- if (result.register) {
228
+ if (result.register?.skipped) {
229
+ console.log(` register ${result.register.label}: not graded, ${result.register.skipped}`);
230
+ } else if (result.register) {
229
231
  const m = result.register.measured;
230
232
  console.log(
231
233
  ` register ${result.register.label}: ${m.meanSentence.toFixed(1)} words/sentence, ` +
@@ -32,6 +32,18 @@ export const patternsCommaClauses = [
32
32
  example:
33
33
  '"If they are, 2 or 3 packages would cover most of them, and you can still go custom when a big one shows up." / "Pick the cheaper plan, and you\'ll still have room to upgrade." / "A run that errors waits there with its data, and you can resume it after the fix."',
34
34
  },
35
+ {
36
+ id: "comma-and-clause",
37
+ // House style, not a tell: 6 of 70 human bench posts carry it, so it's Ramzi's call (16 Nov 2026), not evidence.
38
+ // A list's last item ("a, b, and c") has no pronoun subject after the and, so it passes.
39
+ test: /,\s+and\s+(?:it|it's|it’s|that|that's|that’s|this|they|he|she|we|I|you|there)\s+[\w'’]/,
40
+ // voice-stop.mjs holds the session's replies to it too.
41
+ replies: true,
42
+ name: "Comma-and clause",
43
+ rule: 'A finished clause, then a comma, "and" and a pronoun starting a second clause. It chains two sentences into one breath, and the second half lands as an afterthought. Ramzi, 16 Nov 2026, on "I typed wire --help expecting help text, and it ran the real wire command": "this sentence is ai slop". Split it into 2 sentences.',
44
+ example:
45
+ '"I typed wire --help expecting help text, and it ran the real wire command." / "Drive plus Notion is what most agencies run, and it breaks in the same place."',
46
+ },
35
47
  {
36
48
  id: "comma-and-title",
37
49
  name: "The rest of the site, and what each part is for",
@@ -76,10 +76,8 @@ export const patternsSubjectVoice = [
76
76
  {
77
77
  id: "passive-voice",
78
78
  name: "Every scenario is named by its trigger",
79
- // His rule, not a bot tell: 55 of 267 human replies on the Reddit bench use one, against 7 of our 72 bad ones (9 Nov 2026).
80
- // A state word passes unless "by" names who did it: "Hive is not connected", "what's broken", "when we're done" (15 of upsys's 78, 10 Nov 2026).
81
- // So does "you're" or "we're": the person is the subject, nobody's hidden ("what you're paid for", a human r/ClaudeCode comment, 15 Nov 2026).
82
- test: /\b(?:is|are|was|were|be|been|being|['’]s|['’]re)\s+(?:not\s+|never\s+|already\s+|also\s+|still\s+|just\s+|then\s+|\w+ly\s+)?(?!(?:interested|based|related|supposed|used\s+to|tired|bored|excited|worried|scared|married|located|involved|impressed|devastated|surprised|confused|annoyed|pleased|stuck|qualified|indeed|need|feed|seed|speed|breed|greed|weed)\b|(?:closed|locked|unlocked|connected|disconnected|archived|enabled|disabled|un[a-z]{2,}ed)\b(?!\s+by\b)|broken\b(?!\s+(?:by|into|down|up|out|off)\b)|caught\s+up\b|done\b(?=\s*(?:[.!?,;:)]|$)))(?:[a-z]{3,}ed|built|made|done|given|taken|known|seen|written|shown|sent|kept|put|found|held|told|paid|brought|bought|caught|taught|chosen|driven|forgotten|hidden|broken|spoken|stolen|frozen|drawn|grown|thrown|worn|torn)\b(?:(?<!\b(?:you|we)['’]re\s+(?:\w+\s+)?\w+)|(?=\s+by\b))/i,
79
+ // Ramzi's rule, not a bot tell. What passes and why (states, "you're paid", "what's worked", "made-up"): TECHLOG.md, "Passive voice reads grammar".
80
+ test: /\b(?:is|are|was|were|be|been|being|['’]s|['’]re)\s+(?:not\s+|never\s+|already\s+|also\s+|still\s+|just\s+|then\s+|\w+ly\s+)?(?!(?:interested|based|related|supposed|used\s+to|tired|bored|bloated|excited|worried|scared|married|located|involved|impressed|devastated|surprised|confused|annoyed|pleased|stuck|qualified|indeed|need|feed|seed|speed|breed|greed|weed)\b|(?:closed|locked|unlocked|connected|disconnected|archived|enabled|disabled|un[a-z]{2,}ed)\b(?!\s+by\b)|broken\b(?!\s+(?:by|into|down|up|out|off)\b)|caught\s+up\b|made\s+up\s+of\b|done\b(?=\s*(?:[.!?,;:)]|$)))(?:[a-z]{3,}ed|built|made|done|given|taken|known|seen|written|shown|sent|kept|put|found|held|told|paid|brought|bought|caught|taught|chosen|driven|forgotten|hidden|broken|spoken|stolen|frozen|drawn|grown|thrown|worn|torn)\b(?!-)(?<!['’]s\s+(?:\w+\s+)?(?:worked|changed|happened|improved|grown|started|stopped|moved|shifted|increased|decreased|dropped|evolved|helped|failed|succeeded|slowed))(?:(?<!\b(?:you|we)(?:['’]re|\s+are)\s+(?:\w+\s+)?\w+)|(?=\s+by\b))/i,
83
81
  rule: 'A passive: "is named", "was built", "are treated". Nobody does anything in it, so it reads as a report, not a person talking. Name who does it: "we name every scenario by its trigger". Ramzi, 9 Nov 2026, on a Reddit draft: "anything passive tense basically is bad, bad, bad".',
84
82
  example:
85
83
  '"Every scenario we build is named by its trigger" / "anything that comes through chat is treated as an emergency" / "the report was sent on Monday"',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyramzi/lint",
3
- "version": "2.14.2",
3
+ "version": "2.16.0",
4
4
  "description": "Shared oxlint rules, base config and gates for Studio projects",
5
5
  "license": "MIT",
6
6
  "repository": {
package/register.d.ts CHANGED
@@ -1,4 +1,15 @@
1
- export type RegisterName = "spoken" | "shorts" | "written" | "forum";
1
+ export type RegisterName = "spoken" | "shorts" | "dialogue" | "written" | "forum";
2
+
3
+ /** One band. `minWords` leaves a text shorter than that ungraded on it, because the rate is noise there. */
4
+ export type RegisterBand = { min?: number; max?: number; minWords?: number };
5
+
6
+ export type RegisterSpec = {
7
+ label: string;
8
+ source: string;
9
+ bands: Record<string, RegisterBand>;
10
+ /** The `auditSlop` finding kinds, or single `kind:id`s, `slopGate` keeps for this register. Absent keeps every kind. */
11
+ exact?: string[];
12
+ };
2
13
 
3
14
  export type RegisterMeasurement = {
4
15
  words: number;
@@ -13,10 +24,12 @@ export type RegisterMeasurement = {
13
24
  longShare: number;
14
25
  /** Sentence-length spread, SD over mean. His floor is 0.34, machine prose sits near 0.1. */
15
26
  lengthVariation: number;
27
+ /** Per 1,000 words. In French, informal markers only (t'as, y a, a dropped ne): elision is grammar there. */
16
28
  contractions: number;
29
+ /** Per 1,000 words. In French, tu and vous forms. */
17
30
  secondPerson: number;
18
31
  firstPerson: number;
19
- /** `and`, `so`, `because`, `but` per 1,000. He chains, he does not stack. */
32
+ /** `and`, `so`, `because`, `but` per 1,000 (et, mais, donc, parce que, du coup in French). He chains, he does not stack. */
20
33
  chaining: number;
21
34
  /** Second person for every first person. `Infinity` when there is no first person. */
22
35
  egoRatio: number;
@@ -45,22 +58,24 @@ export type RegisterAudit = {
45
58
  label: string;
46
59
  /** The corpus the band was counted from. */
47
60
  source: string;
61
+ /** The language the rates were counted in, as a 2-letter code. */
62
+ language: string;
48
63
  measured: RegisterMeasurement;
49
64
  findings: { kind: "register"; id: string; detail: string }[];
65
+ /** Why nothing was graded: the language has no measure set, or no band for this register. */
66
+ skipped?: string;
50
67
  };
51
68
 
52
- /** Counts only, no judgement. The bands in `REGISTERS` are recounted from this. */
53
- export declare function measureRegister(text: string): RegisterMeasurement;
69
+ /** Counts only, no judgement. `language` picks the word lists; one without a list counts 0 on the lexical rates. */
70
+ export declare function measureRegister(text: string, language?: string): RegisterMeasurement;
71
+
72
+ /** The English bands. */
73
+ export declare const REGISTERS: Record<RegisterName, RegisterSpec>;
54
74
 
55
- export declare const REGISTERS: Record<
56
- RegisterName,
57
- {
58
- label: string;
59
- source: string;
60
- bands: Record<string, { min?: number; max?: number }>;
61
- /** The `auditSlop` finding kinds, or single `kind:id`s, `slopGate` keeps for this register. Absent keeps every kind. */
62
- exact?: string[];
63
- }
75
+ /** The bands per language. A register a language lacks is skipped in it, never graded on English numbers. */
76
+ export declare const LANGUAGE_REGISTERS: Record<
77
+ string,
78
+ Partial<Record<RegisterName, RegisterSpec>>
64
79
  >;
65
80
 
66
81
  /** Whether `register` keeps an `auditSlop` finding, by its kind or its `kind:id`. */
@@ -73,4 +88,8 @@ export declare function keepsExact(
73
88
  export declare function aiSignalNames(text: string, measured?: RegisterMeasurement): string[];
74
89
 
75
90
  /** Measure, then score against one band set. Findings merge into a prose audit. */
76
- export declare function auditRegister(text: string, register?: RegisterName): RegisterAudit;
91
+ export declare function auditRegister(
92
+ text: string,
93
+ register?: RegisterName,
94
+ language?: string,
95
+ ): RegisterAudit;
package/register.js CHANGED
@@ -22,6 +22,7 @@
22
22
  * Bands are counted, never typed. `scripts/measure-register.mjs` recounts them from the corpora named in each band's `source`, and the corpora are the ones humanizer `references/voice-measured.md` records.
23
23
  */
24
24
 
25
+ import { FR_FIRST_PERSON, FR_SECOND_PERSON } from "#lint/slop-language.js";
25
26
  import { withoutCode } from "#lint/slop-views.js";
26
27
 
27
28
  const SENTENCE_SPLIT = /[.!?]+["'”’)]*(?:\s+|$)/;
@@ -29,6 +30,54 @@ const CONTRACTION = /\b[\w]+['’](?:s|t|re|ve|ll|d|m)\b/gi;
29
30
  const SECOND_PERSON = /\b(?:you|your|yours|you're|you've|you'll|you'd|yourself)\b/gi;
30
31
  const FIRST_PERSON = /\b(?:i|me|my|mine|myself|i'm|i've|i'll|i'd)\b/gi;
31
32
  const CHAINING = /\b(?:and|so|because|but)\b/gi;
33
+
34
+ // French needs its own word lists, and `\b` can't be used: it treats "é" as a word break, so it
35
+ // would cut "était" in half. These lookarounds mark a word edge on any letter.
36
+
37
+ // "Contractions" can't mean elision in French. "c'est" and "l'app" are required grammar, so a stiff
38
+ // legal page has as many as a video. What does mark speech is the informal stuff a written page
39
+ // never carries: "t'es" and "t'as" for "tu es" and "tu as", "y a" without its "il", and a negation
40
+ // that drops its "ne" ("je sais pas", "c'est pas", "j'ai pas").
41
+ // "je t'avais dit" is "te", the written form, so a "je" in front rules it out.
42
+ const FR_TU_ELIDED =
43
+ /(?<![\p{L}\p{N}_])(?<!je\s)t['’](?:es|as|avais|étais|auras|aurais)(?![\p{L}\p{N}_])/giu;
44
+ // "il y a" and "il n'y a" are the written forms, so either "il" or "n'" in front rules it out.
45
+ const FR_Y_A = /(?<![\p{L}\p{N}_])(?<!il\s)(?<!n['’])y['’]?\s?a(?:vait)?(?![\p{L}\p{N}_'’])/giu;
46
+ // A subject, then up to 2 words that aren't "ne" or "n'...", then "pas". "je ne sais pas" stops at
47
+ // "ne", and "ce n'est pas" never starts, because "ce" isn't on the list. Only "pas": "plus" and
48
+ // "rien" also mean "more" and "nothing" without any negation, which would count stiff copy.
49
+ const FR_NE_DROPPED =
50
+ /(?<![\p{L}\p{N}_])(?:je|j['’]\p{L}+|tu|t['’]\p{L}+|il|elle|on|ça|c['’]est|c['’]était|ils|elles|nous|vous)(?:\s+(?!ne(?![\p{L}])|n['’])[\p{L}'’]+){0,2}\s+pas(?![\p{L}\p{N}_])/giu;
51
+ // "and, so, because, but". "du coup" is the spoken "so" as often as "donc" is.
52
+ const FR_CHAINING =
53
+ /(?<![\p{L}\p{N}_])(?:(?:et|mais|donc|parce\s+que|du\s+coup)(?![\p{L}\p{N}_])|parce\s+qu['’])/giu;
54
+
55
+ /**
56
+ * What each lexical rate counts, per language. `contractions` sums its list. A language missing
57
+ * here gets no register grade at all (`auditRegister` says so), because its sentence lengths
58
+ * were never counted either.
59
+ */
60
+ const MEASURES = {
61
+ en: {
62
+ contractions: [CONTRACTION],
63
+ secondPerson: SECOND_PERSON,
64
+ firstPerson: FIRST_PERSON,
65
+ chaining: CHAINING,
66
+ },
67
+ fr: {
68
+ contractions: [FR_TU_ELIDED, FR_Y_A, FR_NE_DROPPED],
69
+ secondPerson: FR_SECOND_PERSON,
70
+ firstPerson: FR_FIRST_PERSON,
71
+ chaining: FR_CHAINING,
72
+ // What a finding says it counted, where the English wording would be wrong.
73
+ names: {
74
+ contractions: "informal markers (t'as, y a, a dropped ne) per 1,000 words",
75
+ secondPerson: "tu/vous per 1,000 words",
76
+ firstPerson: "je/me/moi per 1,000 words",
77
+ chaining: "et/mais/donc/parce que/du coup per 1,000 words",
78
+ },
79
+ },
80
+ };
32
81
  /** A menu or breadcrumb step: a capitalised label, " > ", another capitalised label. */
33
82
  const MENU_PATH = /\b[A-Z][\w&'-]*(?: [\w&'-]+){0,3} > [A-Z]/g;
34
83
  // A person in the reply: an I, a hedge or a question. "we" and "our" don't count, because the company voice is the tell.
@@ -50,8 +99,12 @@ function isCommand(sentence) {
50
99
  return COMMAND_OBJECT.test(m[2]) || /^[A-Z0-9`"'“=]/.test(m[2]);
51
100
  }
52
101
 
53
- /** Counts only. No judgement, so a caller can report without a band. */
54
- export function measureRegister(copy) {
102
+ /**
103
+ * Counts only. No judgement, so a caller can report without a band. A language with no measure
104
+ * set counts 0 on every lexical rate, which is why `auditRegister` never grades one.
105
+ */
106
+ export function measureRegister(copy, language = "en") {
107
+ const lexicon = MEASURES[language] ?? { contractions: [] };
55
108
  // A formula's commas aren't prose (TSK-1388).
56
109
  const text = withoutCode(copy);
57
110
  const sentences = text
@@ -61,7 +114,8 @@ export function measureRegister(copy) {
61
114
  const lengths = sentences.map((s) => s.split(/\s+/).filter(Boolean).length);
62
115
  const words = lengths.reduce((a, b) => a + b, 0);
63
116
  const per1k = (n) => (words === 0 ? 0 : (n / words) * 1000);
64
- const count = (re) => (text.match(re) ?? []).length;
117
+ // `match(undefined)` matches the empty string once, so a missing list counts 0 by hand.
118
+ const count = (re) => (re ? (text.match(re) ?? []).length : 0);
65
119
  const share = (fn) =>
66
120
  lengths.length === 0 ? 0 : (lengths.filter(fn).length / lengths.length) * 100;
67
121
  const paragraphs = text
@@ -84,16 +138,19 @@ export function measureRegister(copy) {
84
138
  // where the mean does not. Counts and the rejected run rule are in humanizer
85
139
  // `references/registers.md`, "The sixth rate".
86
140
  lengthVariation: variation(lengths),
87
- contractions: per1k(count(CONTRACTION)),
88
- secondPerson: per1k(count(SECOND_PERSON)),
89
- firstPerson: per1k(count(FIRST_PERSON)),
90
- chaining: per1k(count(CHAINING)),
141
+ contractions: per1k(lexicon.contractions.reduce((n, re) => n + count(re), 0)),
142
+ secondPerson: per1k(count(lexicon.secondPerson)),
143
+ firstPerson: per1k(count(lexicon.firstPerson)),
144
+ chaining: per1k(count(lexicon.chaining)),
91
145
  // "Every I should be a you." Second person over first, 5.25:1 across the four Shorts cut on 20 Aug 2026 against 1.38:1 in the written corpus,
92
146
 
93
147
  // so the rule is short-form only. A raw take fails it at about 1.0 and is meant to: the ratio is what `descript-script-edit` produces, not what the mouth does.
94
148
 
95
149
  // Guarded, because a script with no "I" at all is not a failure.
96
- egoRatio: count(FIRST_PERSON) === 0 ? Infinity : count(SECOND_PERSON) / count(FIRST_PERSON),
150
+ egoRatio:
151
+ count(lexicon.firstPerson) === 0
152
+ ? Infinity
153
+ : count(lexicon.secondPerson) / count(lexicon.firstPerson),
97
154
  paragraphs: paragraphs.length,
98
155
  paragraphSentences: Math.max(0, ...paragraphs.map((p) => lines(p).length)),
99
156
  paragraphWords: Math.max(0, ...paragraphs.map((p) => p.split(/\s+/).length)),
@@ -107,7 +164,7 @@ export function measureRegister(copy) {
107
164
  return all.length === 0 ? 0 : (all.filter(isCommand).length / all.length) * 100;
108
165
  })(),
109
166
  // Nobody speaking: no I, no hedge, no question. 15 of our last 19 replies over 40 words, 2 of 22 humans beside them.
110
- speakerMarks: count(FIRST_PERSON) + count(HEDGE) + (text.match(/\?/g) ?? []).length,
167
+ speakerMarks: count(lexicon.firstPerson) + count(HEDGE) + (text.match(/\?/g) ?? []).length,
111
168
  // "System Settings > Keyboard > Text Replacements": 4 of 6 replies Ramzi flagged on 2 Nov 2026,
112
169
  // 1 of 265 human Reddit replies. A quoted line (`> ...`) is not a path.
113
170
  menuPaths: (text.replace(/^\s*>.*$/gm, "").match(MENU_PATH) ?? []).length,
@@ -297,6 +354,63 @@ REGISTERS.forum = {
297
354
  exact: ["dash", "pattern:comma-and-you-can", "pattern:the-one-doing", "pattern:passive-voice"],
298
355
  };
299
356
 
357
+ /**
358
+ * The bands per language. English is `REGISTERS`. A register missing from a language's table
359
+ * isn't graded in that language, and `auditRegister` says so instead of failing French copy on
360
+ * English numbers.
361
+ */
362
+
363
+ /*
364
+ * French `spoken` is provisional, counted 17 Nov 2026. No French video of his has a transcript yet,
365
+ * so it rests on 3 sources, each used only for what it can count.
366
+ *
367
+ * 61 French client calls, his turns only, stretches of 120 words or more (107,296 words, from the
368
+ * raw ClickUp call export): meanSentence ran 12.4 to 26.0, fragmentShare 0 to 17.1,
369
+ * lengthVariation 0.5 to 0.9, secondPerson p10 21.0, chaining 25.1 to 61.5. The calls can't count
370
+ * the informal markers: the transcriber writes the "ne" back in (2,808 of his 3,219 "pas" carry
371
+ * one), so they come out at 1.2 per 1,000.
372
+ *
373
+ * 6 French voice notes over 300 words (26,092 words): the Voicenotes transcript keeps the dropped
374
+ * "ne", and they run 2.8 to 21.3 informal markers per 1,000. They're conversations with other
375
+ * people in them, so they count nothing else here.
376
+ *
377
+ * The 7 Locameublé concept openings, a sanity set: about 100 words each, 10.3 to 16.8 words a
378
+ * sentence, secondPerson 40 to 73, chaining 29.7 to 59.5, informal markers 0 to 21.5, 7.6 pooled.
379
+ *
380
+ * Each floor clears every opening and every call it was read from. Two differ from English on
381
+ * purpose: these scripts run shorter sentences than his English transcripts (16 to 34 there), and
382
+ * 4 of the 7 openings keep every "ne". So the informal floor is low and waits for 400 words: one
383
+ * marker in 400 words passes, and 0 in 100 is noise, not a written script. Recount with
384
+ * `scripts/measure-register.mjs --lang=fr` once a French video is transcribed.
385
+ */
386
+ export const LANGUAGE_REGISTERS = {
387
+ en: REGISTERS,
388
+ fr: {
389
+ spoken: {
390
+ label: "spoken long-form",
391
+ source:
392
+ "provisional: 61 French calls (107,296 words), 6 French voice notes, 7 Locameublé openings",
393
+ bands: {
394
+ meanSentence: { min: 9, max: 28 },
395
+ fragmentShare: { max: 20 },
396
+ lengthVariation: { min: 0.3 },
397
+ contractions: { min: 2, minWords: 400 },
398
+ secondPerson: { min: 20 },
399
+ chaining: { min: 25 },
400
+ },
401
+ },
402
+ // The two forum rules that aren't about English words. `aiSignals` counts English hedges and
403
+ // English orders, so a French reply would score "nobody speaking" on every line of it.
404
+ forum: {
405
+ ...REGISTERS.forum,
406
+ bands: {
407
+ menuPaths: REGISTERS.forum.bands.menuPaths,
408
+ unbrokenWords: REGISTERS.forum.bands.unbrokenWords,
409
+ },
410
+ },
411
+ },
412
+ };
413
+
300
414
  const DIRECTION = {
301
415
  meanSentence: "words per sentence",
302
416
  lengthVariation: "spread of sentence length, SD over mean",
@@ -331,17 +445,26 @@ export function keepsExact(register, finding) {
331
445
  * Findings carry the same shape `auditSlop` returns, so a caller merges the
332
446
  * two lists and a hook fails on either.
333
447
  */
334
- export function auditRegister(text, register = "spoken") {
335
- const spec = REGISTERS[register];
336
- if (!spec)
448
+ export function auditRegister(text, register = "spoken", language = "en") {
449
+ if (!REGISTERS[register])
337
450
  throw new Error(
338
451
  `unknown register "${register}", expected ${Object.keys(REGISTERS).join(", ")}`,
339
452
  );
340
- const measured = measureRegister(text);
453
+ const measured = measureRegister(text, language);
454
+ const spec = LANGUAGE_REGISTERS[language]?.[register];
455
+ if (!spec) {
456
+ const { label, source } = REGISTERS[register];
457
+ const skipped = MEASURES[language]
458
+ ? `no ${language} band for ${label} yet`
459
+ : `no register measures for ${language}`;
460
+ return { register, label, source, language, measured, findings: [], skipped };
461
+ }
341
462
  const findings = [];
342
463
 
343
464
  for (const [key, band] of Object.entries(spec.bands)) {
344
465
  const value = measured[key];
466
+ // A rate over a few dozen words is noise: the French informal floor waits for 400.
467
+ if (band.minWords !== undefined && measured.words < band.minWords) continue;
345
468
  // A share is noise on a short text.
346
469
 
347
470
  // His own Shorts corpus leaves roughly one fragment every 19 sentences, so a 9-sentence script that leaves one sits at 11% and is not a cadence fault. Two is.
@@ -368,9 +491,9 @@ export function auditRegister(text, register = "spoken") {
368
491
  findings.push({
369
492
  kind: "register",
370
493
  id: key,
371
- detail: `${shown} ${DIRECTION[key]}, ${spec.label} wants ${want}`,
494
+ detail: `${shown} ${MEASURES[language].names?.[key] ?? DIRECTION[key]}, ${spec.label} wants ${want}`,
372
495
  });
373
496
  }
374
497
 
375
- return { register, label: spec.label, source: spec.source, measured, findings };
498
+ return { register, label: spec.label, source: spec.source, language, measured, findings };
376
499
  }
@@ -4,7 +4,9 @@
4
4
  */
5
5
 
6
6
  /*
7
- * node scripts/measure-register.mjs <file|dir> [more...]
7
+ * node scripts/measure-register.mjs <file|dir> [more...] [--lang=fr]
8
+ *
9
+ * `--lang` picks the word lists the lexical rates count with (English by default).
8
10
  */
9
11
 
10
12
  /*
@@ -40,13 +42,15 @@ function bodies(target) {
40
42
  return [readFileSync(target, "utf8")];
41
43
  }
42
44
 
43
- const targets = process.argv.slice(2);
45
+ const args = process.argv.slice(2);
46
+ const targets = args.filter((a) => !a.startsWith("--"));
47
+ const language = args.find((a) => a.startsWith("--lang="))?.split("=")[1] ?? "en";
44
48
  if (targets.length === 0) {
45
- process.stderr.write("usage: measure-register.mjs <file|dir|json> [more...]\n");
49
+ process.stderr.write("usage: measure-register.mjs <file|dir|json> [more...] [--lang=fr]\n");
46
50
  process.exit(2);
47
51
  }
48
52
 
49
- const m = measureRegister(targets.flatMap(bodies).join("\n\n"));
53
+ const m = measureRegister(targets.flatMap(bodies).join("\n\n"), language);
50
54
  const row = (k, v) => console.log(` ${k.padEnd(16)} ${v.toFixed(1)}`);
51
55
  console.log(`${m.words} words, ${m.sentences} sentences`);
52
56
  row("meanSentence", m.meanSentence);
@@ -26,6 +26,11 @@ const CLI = join(import.meta.dirname, "../bin/heyramzi-slop.js");
26
26
  const FLAGS = ["--register=forum", "--jev", "--shape-block=0.75", "--json"];
27
27
  /** Humans refused, at most: the 2 Nov 2026 gate refused 16.6%, so a change may not raise it. */
28
28
  const MAX_FPR = 0.17;
29
+ /**
30
+ * Ramzi's own rules, kept knowing what they cost humans, so they never count against MAX_FPR.
31
+ * Passive voice: "anything passive tense basically is bad" (9 Nov 2026), on 55 of 267 human replies.
32
+ */
33
+ const HOUSE_STYLE = new Set(["pattern:passive-voice"]);
29
34
  /** Two CLIs at once: four drew Cloudflare's gateway 429 (2 Nov 2026). */
30
35
  const CONCURRENCY = 2;
31
36
 
@@ -47,6 +52,9 @@ async function verdict(row, dir) {
47
52
  const out = await run(process.execPath, args, {
48
53
  maxBuffer: 8 * 1024 * 1024,
49
54
  }).catch((err) => err);
55
+ // A crashed CLI prints nothing on stdout, and JSON.parse("") hid which row and why.
56
+ if (!out.stdout?.trim())
57
+ throw new Error(`${row.id}: the gate printed nothing. ${out.stderr ?? out.message}`);
50
58
  const result = JSON.parse(out.stdout);
51
59
  if (result.jev && !result.jev.ran) throw new Error(`Jev did not run: ${result.jev.reason}`);
52
60
  return { ...row, refused: !result.ok, hits: result.findings.map((f) => `${f.kind}:${f.id}`) };
@@ -81,6 +89,8 @@ const ramzi = judged.filter((r) => r.flagged);
81
89
  const human = judged.filter((r) => !r.bad);
82
90
  const missed = judged.filter((r) => r.bad && !r.refused);
83
91
  const refusedHumans = human.filter((r) => r.refused);
92
+ // The bar reads only the humans a tell refused, not the ones his house style alone refused.
93
+ const toldHumans = refusedHumans.filter((r) => r.hits.some((h) => !HOUSE_STYLE.has(h)));
84
94
 
85
95
  // Which check carries the load, and which one costs the humans.
86
96
  const byHit = {};
@@ -108,6 +118,7 @@ console.log(
108
118
  `\nbad caught ${caught(bad)}/${bad.length} (${pct(caught(bad), bad.length)}), ` +
109
119
  `flagged caught ${caught(ramzi)}/${ramzi.length} (${pct(caught(ramzi), ramzi.length)}), ` +
110
120
  `humans refused ${refusedHumans.length}/${human.length} (${pct(refusedHumans.length, human.length)}), ` +
121
+ `by a tell ${toldHumans.length} (${pct(toldHumans.length, human.length)}), ` +
111
122
  `bar ${pct(MAX_FPR, 1)}`,
112
123
  );
113
124
 
@@ -121,6 +132,4 @@ if (process.argv.includes("--accept")) {
121
132
  console.log(`knownMisses: ${knownMisses.length}`);
122
133
  process.exit(0);
123
134
  }
124
- process.exit(
125
- fresh.length > 0 || refusedHumans.length / Math.max(1, human.length) > MAX_FPR ? 1 : 0,
126
- );
135
+ process.exit(fresh.length > 0 || toldHumans.length / Math.max(1, human.length) > MAX_FPR ? 1 : 0);
package/slop-language.js CHANGED
@@ -98,6 +98,28 @@ export const LISTED_LANGUAGES = new Set(["en", "fr"]);
98
98
  /*
99
99
  * not a page about its author.
100
100
  */
101
+
102
+ /**
103
+ * French person words, read by this ledger and by the spoken register in `register.js`.
104
+ */
105
+ // `\b` treats "é" as a word break, so these lookarounds mark a word edge on any letter.
106
+ // An elided form ("j'ai", "t'as") ends on its apostrophe, so it skips the word-end check.
107
+ // Only j', m' and t' are a person: l', c', d', n', s' and qu' are not.
108
+ function frenchPerson(words, elided) {
109
+ return new RegExp(
110
+ `(?<![\\p{L}\\p{N}_])(?:(?:${words.join("|")})(?![\\p{L}\\p{N}_])|[${elided}]['’](?=\\p{L}))`,
111
+ "giu",
112
+ );
113
+ }
114
+ const FR_FIRST_SINGULAR = ["je", "me", "moi", "mon", "ma", "mes"];
115
+ // "vous" counts beside "tu": the formal "you" is still the reader being spoken to.
116
+ export const FR_SECOND_PERSON = frenchPerson(
117
+ ["tu", "te", "toi", "ton", "ta", "tes", "vous", "votre", "vos"],
118
+ "t",
119
+ );
120
+ // The register leaves "nous" out, like "we" in English: the company voice isn't a person speaking.
121
+ export const FR_FIRST_PERSON = frenchPerson(FR_FIRST_SINGULAR, "jm");
122
+
101
123
  export const PRONOUNS = {
102
124
  en: {
103
125
  // Case-sensitive: a lone `i` is a loop index, `US` a country, and `Annex I` a numeral.
@@ -105,8 +127,9 @@ export const PRONOUNS = {
105
127
  /(?<![\p{L}\p{N}_])(?:(?<!(?:Annex|Article|Title|Chapter|Part|Section|Phase|Tier) )I|[Ww]e|WE|[Mm]y|[Oo]urs?|OUR|[Mm]ine|[Uu]s)(?![\p{L}\p{N}_])/gu,
106
128
  second: /(?<![\p{L}\p{N}_])(?:you|your|yours)(?![\p{L}\p{N}_])/giu,
107
129
  },
130
+ // The ledger counts "nous" as the English one counts "we": a page about its company is about its writer.
108
131
  fr: {
109
- first: /(?<![\p{L}\p{N}_])(?:je|j'|nous|mon|ma|mes|notre|nos|moi|me)(?![\p{L}\p{N}_])/giu,
110
- second: /(?<![\p{L}\p{N}_])(?:vous|votre|vos|tu|ton|ta|tes|toi)(?![\p{L}\p{N}_])/giu,
132
+ first: frenchPerson([...FR_FIRST_SINGULAR, "nous", "notre", "nos"], "jm"),
133
+ second: FR_SECOND_PERSON,
111
134
  },
112
135
  };
package/slop.js CHANGED
@@ -443,7 +443,8 @@ export function slopGate(
443
443
  // A ban list cannot see the fault that produced the 9 Sep 2026 Shorts batch: every script passed the words and still read as somebody else,
444
444
 
445
445
  // because the register was written and the delivery was spoken. `register.js` carries why.
446
- const registerAudit = register ? auditRegister(cleaned.text, register) : null;
446
+ // In the draft's own language: French counted on English words scored 0 contractions on every script.
447
+ const registerAudit = register ? auditRegister(cleaned.text, register, audit.language) : null;
447
448
  // A Short also owes a hook from the library and a counted, reply-ending skeleton.
448
449
  const shortsAudit = register === "shorts" ? auditShorts(cleaned.text) : null;
449
450
  // A register may count only some exact kinds, or one `kind:id`: on Reddit the rest refused most human replies.