@heyramzi/lint 2.16.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.
- package/bin/heyramzi-slop.js +2 -2
- package/package.json +2 -1
- package/register-email.js +44 -0
- package/register.d.ts +3 -1
- package/register.js +8 -1
- package/slop.js +4 -1
package/bin/heyramzi-slop.js
CHANGED
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyramzi/lint",
|
|
3
|
-
"version": "2.
|
|
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
|
-
|
|
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.
|