@heyramzi/lint 2.15.0 → 2.17.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.
@@ -257,7 +257,7 @@ const paths = args.filter((a) => !a.startsWith("--"));
257
257
 
258
258
  if (paths.length === 0) {
259
259
  process.stderr.write(
260
- "usage: heyramzi-slop <file|dir|-> [more...] [--all] [--fix] [--json] [--jev [--shape-block=0.6-1]] [--quiet] [--register=spoken|shorts|written|forum [--thread=post.md]] [--only=kind|id,...] [--patterns=module.mjs]\n",
260
+ "usage: heyramzi-slop <file|dir|-> [more...] [--all] [--fix] [--json] [--jev [--shape-block=0.6-1]] [--quiet] [--register=spoken|shorts|written|forum|email [--thread=post.md]] [--only=kind|id,...] [--patterns=module.mjs]\n",
261
261
  );
262
262
  process.exit(2);
263
263
  }
@@ -271,7 +271,7 @@ const registerFlag = args.find((a) => a.startsWith("--register"));
271
271
 
272
272
  // That is the worst thing a gate can do: silence a caller reads as a pass.
273
273
  if (registerFlag && !registerFlag.includes("=")) {
274
- process.stderr.write("--register takes a value: --register=spoken|shorts|written|forum\n");
274
+ process.stderr.write("--register takes a value: --register=spoken|shorts|written|forum|email\n");
275
275
  process.exit(2);
276
276
  }
277
277
  const register = registerFlag ? registerFlag.split("=")[1] : undefined;
@@ -37,6 +37,8 @@ export const patternsCommaClauses = [
37
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
38
  // A list's last item ("a, b, and c") has no pronoun subject after the and, so it passes.
39
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,
40
42
  name: "Comma-and clause",
41
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.',
42
44
  example:
@@ -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.15.0",
3
+ "version": "2.17.0",
4
4
  "description": "Shared oxlint rules, base config and gates for Studio projects",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -55,6 +55,7 @@
55
55
  "template-braces.js",
56
56
  "register.js",
57
57
  "register.d.ts",
58
+ "register-email.js",
58
59
  "repo-rules.js",
59
60
  "repo-rules",
60
61
  "scripts",
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The email register: how long a typed email may run, and how a draft is known to be one.
3
+ */
4
+
5
+ /*
6
+ * Ramzi, 19 Nov 2026, on a 190-word Tella support reply the gate passed: "way too long and verbose and has not enough line breaks".
7
+ */
8
+
9
+ /*
10
+ * The 50-word rewrite he wanted ran one idea per line, so these bands fail the first and pass the second (register-email.test.mjs).
11
+ */
12
+ export const EMAIL = {
13
+ label: "email",
14
+ source: "the Tella reply Ramzi rejected on 19 Nov 2026 and his 50-word rewrite",
15
+ bands: {
16
+ paragraphSentences: { max: 2 },
17
+ paragraphWords: { max: 35 },
18
+ words: { max: 90 },
19
+ },
20
+ cut: {
21
+ paragraphSentences:
22
+ "one idea per line, a blank line between; cut the why the reader didn't ask for",
23
+ paragraphWords: "one idea per line; cut the why the reader didn't ask for",
24
+ words: "keep the ask and the one useful fact; cut the investigation",
25
+ },
26
+ };
27
+
28
+ const GREETING = /^(?:hi|hello|hey|bonjour|salut)\b/i;
29
+ const NAME_LINE = /^\p{Lu}[\p{L}'’-]*(?:\s+\p{Lu}[\p{L}'’-]*){0,2}$/u;
30
+
31
+ /** A draft that opens on a greeting and signs off with a name in its last 2 lines is an email. */
32
+ export function looksLikeEmail(text) {
33
+ const filled = text
34
+ .split("\n")
35
+ .map((l) => l.trim())
36
+ .filter(Boolean);
37
+ return (
38
+ GREETING.test(filled[0] ?? "") &&
39
+ filled
40
+ .slice(1)
41
+ .slice(-2)
42
+ .some((l) => NAME_LINE.test(l))
43
+ );
44
+ }
package/register.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type RegisterName = "spoken" | "shorts" | "dialogue" | "written" | "forum";
1
+ export type RegisterName = "spoken" | "shorts" | "dialogue" | "written" | "forum" | "email";
2
2
 
3
3
  /** One band. `minWords` leaves a text shorter than that ungraded on it, because the rate is noise there. */
4
4
  export type RegisterBand = { min?: number; max?: number; minWords?: number };
@@ -9,6 +9,8 @@ export type RegisterSpec = {
9
9
  bands: Record<string, RegisterBand>;
10
10
  /** The `auditSlop` finding kinds, or single `kind:id`s, `slopGate` keeps for this register. Absent keeps every kind. */
11
11
  exact?: string[];
12
+ /** Per band, what to cut when it fails, appended to the finding. */
13
+ cut?: Record<string, string>;
12
14
  };
13
15
 
14
16
  export type RegisterMeasurement = {
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 { EMAIL } from "#lint/register-email.js";
25
26
  import { FR_FIRST_PERSON, FR_SECOND_PERSON } from "#lint/slop-language.js";
26
27
  import { withoutCode } from "#lint/slop-views.js";
27
28
 
@@ -354,6 +355,8 @@ REGISTERS.forum = {
354
355
  exact: ["dash", "pattern:comma-and-you-can", "pattern:the-one-doing", "pattern:passive-voice"],
355
356
  };
356
357
 
358
+ REGISTERS.email = EMAIL;
359
+
357
360
  /**
358
361
  * The bands per language. English is `REGISTERS`. A register missing from a language's table
359
362
  * isn't graded in that language, and `auditRegister` says so instead of failing French copy on
@@ -408,10 +411,13 @@ export const LANGUAGE_REGISTERS = {
408
411
  unbrokenWords: REGISTERS.forum.bands.unbrokenWords,
409
412
  },
410
413
  },
414
+ // Counts of words, lines and paragraphs, so the English numbers hold in French.
415
+ email: EMAIL,
411
416
  },
412
417
  };
413
418
 
414
419
  const DIRECTION = {
420
+ words: "words in the whole body",
415
421
  meanSentence: "words per sentence",
416
422
  lengthVariation: "spread of sentence length, SD over mean",
417
423
  fragmentShare: "% of sentences of 4 words or fewer",
@@ -488,10 +494,11 @@ export function auditRegister(text, register = "spoken", language = "en") {
488
494
  : Number.isFinite(value)
489
495
  ? value.toFixed(1)
490
496
  : "no first person";
497
+ const cut = spec.cut?.[key] ? `: ${spec.cut[key]}` : "";
491
498
  findings.push({
492
499
  kind: "register",
493
500
  id: key,
494
- detail: `${shown} ${MEASURES[language].names?.[key] ?? DIRECTION[key]}, ${spec.label} wants ${want}`,
501
+ detail: `${shown} ${MEASURES[language].names?.[key] ?? DIRECTION[key]}, ${spec.label} wants ${want}${cut}`,
495
502
  });
496
503
  }
497
504
 
package/slop.js CHANGED
@@ -42,6 +42,7 @@ import { phrases, words } from "#lint/data/slop-words.js";
42
42
  import { artifacts } from "#lint/data/slop/artifacts.js";
43
43
  import { patterns } from "#lint/data/slop/patterns.js";
44
44
  import { auditRegister, keepsExact } from "#lint/register.js";
45
+ import { looksLikeEmail } from "#lint/register-email.js";
45
46
  import { isClean, markupLines, stripInvisibles, stripMarkup } from "#lint/slop-clean.js";
46
47
  import { everyHit, firstWord, hitLines } from "#lint/slop-lines.js";
47
48
  import {
@@ -444,7 +445,9 @@ export function slopGate(
444
445
 
445
446
  // because the register was written and the delivery was spoken. `register.js` carries why.
446
447
  // 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;
448
+ // `draft-reply.py` passes no register, so an email is graded by its shape: the Tella reply passed unflagged, 19 Nov 2026.
449
+ const graded = register ?? (looksLikeEmail(cleaned.text) ? "email" : undefined);
450
+ const registerAudit = graded ? auditRegister(cleaned.text, graded, audit.language) : null;
448
451
  // A Short also owes a hook from the library and a counted, reply-ending skeleton.
449
452
  const shortsAudit = register === "shorts" ? auditShorts(cleaned.text) : null;
450
453
  // A register may count only some exact kinds, or one `kind:id`: on Reddit the rest refused most human replies.