@domandigital/craft 0.13.0 → 0.14.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/CHANGELOG.md +6 -0
- package/CHARACTER.md +59 -11
- package/COPY.md +5 -0
- package/dist/{audit-5TYDYRXV.js → audit-6WHR7ZTV.js} +3 -2
- package/dist/audit.cjs +669 -92
- package/dist/audit.d.cts +15 -1
- package/dist/audit.d.ts +15 -1
- package/dist/audit.js +669 -92
- package/dist/{chunk-3VTPI7BU.js → chunk-3OTKMKJQ.js} +65 -91
- package/dist/{chunk-IMB4V34S.js → chunk-7T5WR74C.js} +7 -7
- package/dist/{chunk-GMVXADJ6.js → chunk-GQVEYTBY.js} +698 -89
- package/dist/{chunk-ZZ5CKOJP.js → chunk-OOZOEWGD.js} +1 -1
- package/dist/{chunk-K2BZN4GA.js → chunk-PBK6SYH5.js} +7 -7
- package/dist/{chunk-ZLDA2SYB.js → chunk-Q7ILL2HV.js} +47 -6
- package/dist/chunk-QYBAVU3P.js +6 -0
- package/dist/{chunk-CZDOMIVS.js → chunk-WUACK2HX.js} +2 -1
- package/dist/{chunk-ESCVTKPN.js → chunk-XVBR2UPH.js} +6 -6
- package/dist/{cli-BKJMLD3H.js → cli-3CGUKXY4.js} +6 -5
- package/dist/{cli-DRKAMFAH.js → cli-O3CDSONO.js} +7 -6
- package/dist/{cli-J5ECRCD4.js → cli-WG3UJNUF.js} +12 -11
- package/dist/{cli-N2IDXH7W.js → cli-WSHPSWVU.js} +7 -6
- package/dist/{cli-ILH7OO5G.js → cli-Z2IQG3LC.js} +5 -4
- package/dist/cli.js +3 -2
- package/dist/index.cjs +780 -225
- package/dist/index.d.cts +165 -3
- package/dist/index.d.ts +165 -3
- package/dist/index.js +763 -225
- package/dist/migrate-VIFAYIBM.js +9 -0
- package/package.json +1 -1
- package/word-lists.json +1 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SNAPSHOT_VERSION
|
|
3
|
+
} from "./chunk-QYBAVU3P.js";
|
|
4
|
+
|
|
1
5
|
// src/character/parse.ts
|
|
2
6
|
var MARKUP = /\.(tsx|jsx|html?|astro|vue|svelte|mdx)$/i;
|
|
3
7
|
var SCRIPT = /\.(ts|js|mjs|cjs)$/i;
|
|
@@ -329,9 +333,6 @@ function extractStrings(file) {
|
|
|
329
333
|
return [];
|
|
330
334
|
}
|
|
331
335
|
|
|
332
|
-
// src/snapshot/types.ts
|
|
333
|
-
var SNAPSHOT_VERSION = 2;
|
|
334
|
-
|
|
335
336
|
// src/color/oklch.ts
|
|
336
337
|
var clamp01 = (n) => n < 0 ? 0 : n > 1 ? 1 : n;
|
|
337
338
|
function srgbToLinear(c) {
|
|
@@ -1659,8 +1660,8 @@ function sharedChoices(target, runs) {
|
|
|
1659
1660
|
const out = [];
|
|
1660
1661
|
for (const [part, values] of Object.entries(mine)) {
|
|
1661
1662
|
for (const value of values) {
|
|
1662
|
-
const
|
|
1663
|
-
if (
|
|
1663
|
+
const count4 = all.filter((c) => c[part].includes(value)).length;
|
|
1664
|
+
if (count4 / runs.length >= 0.25) out.push({ part, value, runs: count4, of: runs.length });
|
|
1664
1665
|
}
|
|
1665
1666
|
}
|
|
1666
1667
|
return out.sort((a, b) => b.runs - a.runs);
|
|
@@ -2898,14 +2899,14 @@ function contractionHits(ctx) {
|
|
|
2898
2899
|
for (const doc2 of documents(ctx)) {
|
|
2899
2900
|
if (doc2.words < 800) continue;
|
|
2900
2901
|
const text = doc2.blocks.map((b) => withoutHeadings(b.text)).join("\n");
|
|
2901
|
-
const
|
|
2902
|
-
const rate =
|
|
2902
|
+
const count4 = (text.match(CONTRACTION) ?? []).length;
|
|
2903
|
+
const rate = count4 * 1e3 / doc2.words;
|
|
2903
2904
|
if (rate < 1) {
|
|
2904
2905
|
const first = sentences(doc2)[0];
|
|
2905
2906
|
hits.push({
|
|
2906
2907
|
path: doc2.path,
|
|
2907
2908
|
offset: first?.offset ?? 0,
|
|
2908
|
-
message: `${
|
|
2909
|
+
message: `${count4} contraction${count4 === 1 ? "" : "s"} in ${thousands(doc2.words)} words. Prose with none reads stiff; formal legal pages are the exception`
|
|
2909
2910
|
});
|
|
2910
2911
|
}
|
|
2911
2912
|
}
|
|
@@ -3028,16 +3029,16 @@ function filler(words, seed = 1, options = {}) {
|
|
|
3028
3029
|
return state % n;
|
|
3029
3030
|
};
|
|
3030
3031
|
const out = [];
|
|
3031
|
-
let
|
|
3032
|
+
let count4 = 0;
|
|
3032
3033
|
let i = 0;
|
|
3033
|
-
while (
|
|
3034
|
+
while (count4 < words) {
|
|
3034
3035
|
const length = uniform ?? shape[i % shape.length];
|
|
3035
3036
|
const s = [];
|
|
3036
3037
|
for (let w = 0; w < length; w += 1) s.push(FILLER_WORDS[next(FILLER_WORDS.length)]);
|
|
3037
3038
|
if (contractions && i % 6 === 2) s.splice(1, 0, "we're");
|
|
3038
3039
|
s[0] = s[0].charAt(0).toUpperCase() + s[0].slice(1);
|
|
3039
3040
|
out.push(`${s.join(" ")}.`);
|
|
3040
|
-
|
|
3041
|
+
count4 += s.length;
|
|
3041
3042
|
i += 1;
|
|
3042
3043
|
}
|
|
3043
3044
|
const paragraphs = [];
|
|
@@ -3195,66 +3196,6 @@ ${filler(520, 11)}`)]
|
|
|
3195
3196
|
}
|
|
3196
3197
|
];
|
|
3197
3198
|
|
|
3198
|
-
// src/character/house.ts
|
|
3199
|
-
var HOUSE = {
|
|
3200
|
-
"em-dash": { tier: "block", label: "em dash, use a full stop or a comma" },
|
|
3201
|
-
emoji: { tier: "block", label: "emoji" },
|
|
3202
|
-
"not-just-but": { tier: "block", label: "contrastive negation. The template is the tell, not the sentiment. Say the positive claim" },
|
|
3203
|
-
"no-x-no-y": {
|
|
3204
|
-
tier: "block",
|
|
3205
|
-
label: '"No X, no Y" list. Defining the brand by what it is not, itemised, is the same template as contrastive negation'
|
|
3206
|
-
},
|
|
3207
|
-
"no-x-badge": { tier: "block", label: 'standalone "No X" badge. Reads as a slapped-on kicker, and worse when reused across pieces' },
|
|
3208
|
-
"ai-phrase": { tier: "block", label: "AI tell" },
|
|
3209
|
-
"plainer-word": { tier: "block", label: "a plainer word exists. Name the mechanism instead" },
|
|
3210
|
-
"plain-english": { tier: "block", label: 'use "properly explained"' },
|
|
3211
|
-
buzzword: { tier: "block", label: "forbidden phrase" },
|
|
3212
|
-
"negative-reassurance": { tier: "block", label: "negative reassurance, say what they get" },
|
|
3213
|
-
// Evidence of a pasted chat reply, not a matter of style. Moved from review
|
|
3214
|
-
// on 2026-09-24 after its estate hits were read (ROADMAP.md): 15 of 15 real.
|
|
3215
|
-
"chatbot-residue": { tier: "block", label: "chatbot residue. A chat reply was pasted in: remove it, and source or cut the claim it backed" },
|
|
3216
|
-
"review-phrase": { tier: "review", label: "review tier" },
|
|
3217
|
-
"ai-vocabulary": { tier: "review", label: "AI vocabulary" },
|
|
3218
|
-
"stock-phrase": { tier: "review", label: "stock phrase" },
|
|
3219
|
-
"hollow-imperative": { tier: "review", label: "hollow imperative" },
|
|
3220
|
-
"rhetorical-opener": { tier: "review", label: "rhetorical question opener" },
|
|
3221
|
-
"staccato-triplet": { tier: "review", label: "staccato triplet" },
|
|
3222
|
-
"where-x-meets-y": { tier: "review", label: "'where X meets Y'" },
|
|
3223
|
-
"ing-tail": { tier: "review", label: "empty -ing tail" },
|
|
3224
|
-
"vague-attribution": { tier: "review", label: "unnamed source" },
|
|
3225
|
-
"closing-summary": { tier: "review", label: "closing summary" },
|
|
3226
|
-
"false-range": { tier: "review", label: "false range" },
|
|
3227
|
-
"placeholder": { tier: "review", label: "unfilled placeholder" },
|
|
3228
|
-
// Every estate hit so far is real (38 in five DD articles, 2026-09-24), but
|
|
3229
|
-
// a proposal can honestly say "the attached research". Review until measured there.
|
|
3230
|
-
"prompt-context": { tier: "review", label: "prompt context: the model naming its own inputs" },
|
|
3231
|
-
"question-reveal": { tier: "review", label: "staged reveal" },
|
|
3232
|
-
"inline-label-list": { tier: "review", label: "bold-label bullets" },
|
|
3233
|
-
"phrase-density": { tier: "review", label: "density" },
|
|
3234
|
-
"aphorism-density": { tier: "review", label: "density" },
|
|
3235
|
-
"contraction-scarcity": { tier: "review", label: "density" },
|
|
3236
|
-
"sentence-rhythm": { tier: "review", label: "density" },
|
|
3237
|
-
"repeated-sentence": { tier: "review", label: "repetition" },
|
|
3238
|
-
"heading-shape": { tier: "review", label: "headings" },
|
|
3239
|
-
"heading-echo": { tier: "review", label: "headings" },
|
|
3240
|
-
// Banned only "when vague", per the rules. Too noisy for a sweep.
|
|
3241
|
-
"vague-word": { tier: "explicit", label: "vague" }
|
|
3242
|
-
};
|
|
3243
|
-
function houseRule(id, name = id) {
|
|
3244
|
-
return HOUSE[id] ?? { tier: "review", label: name };
|
|
3245
|
-
}
|
|
3246
|
-
var HOUSE_LOCKED = "the house blocking tier cannot be lowered by a repo. A genuine one-off takes copy-ok on its line; a rule that is wrong is changed in craft's house.ts and COPY.md";
|
|
3247
|
-
function holdHouseBlocks(exceptions, severity) {
|
|
3248
|
-
const blocks = (tell) => HOUSE[tell]?.tier === "block";
|
|
3249
|
-
const refusedSeverity = Object.entries(severity).filter(([tell, o]) => blocks(tell) && o.level !== "block").map(([tell]) => tell);
|
|
3250
|
-
return {
|
|
3251
|
-
exceptions: exceptions.filter((e) => !blocks(e.tell)),
|
|
3252
|
-
refused: exceptions.filter((e) => blocks(e.tell)),
|
|
3253
|
-
severity: Object.fromEntries(Object.entries(severity).filter(([tell]) => !refusedSeverity.includes(tell))),
|
|
3254
|
-
refusedSeverity
|
|
3255
|
-
};
|
|
3256
|
-
}
|
|
3257
|
-
|
|
3258
3199
|
// src/snapshot/fixture.ts
|
|
3259
3200
|
function makeSnapshot(patch = {}) {
|
|
3260
3201
|
const base = {
|
|
@@ -3324,6 +3265,666 @@ function makeSnapshot(patch = {}) {
|
|
|
3324
3265
|
return out;
|
|
3325
3266
|
}
|
|
3326
3267
|
|
|
3268
|
+
// src/character/facts.ts
|
|
3269
|
+
var MONTH = "(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)";
|
|
3270
|
+
var PATTERNS = [
|
|
3271
|
+
["url", /\bhttps?:\/\/[^\s<>"'`)\]]+|\bwww\.[^\s<>"'`)\]]+/gi],
|
|
3272
|
+
["email", /\b[\w.+-]+@[\w-]+(?:\.[\w-]+)+\b/g],
|
|
3273
|
+
["phone", /(?:\+44\s?\(?0?\)?\s?|\b0)\d(?:[\s-]?\d){8,9}\b/g],
|
|
3274
|
+
["postcode", /\b[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}\b/g],
|
|
3275
|
+
["money", /[£$€]\s?\d[\d,]*(?:\.\d{1,2})?(?:\s?(?:k|m|bn)\b)?|\b\d[\d,]*(?:\.\d{1,2})?\s?(?:pounds|GBP)\b/gi],
|
|
3276
|
+
["date", new RegExp(`\\b\\d{1,2}(?:st|nd|rd|th)?\\s+${MONTH}\\b(?:\\s+\\d{4})?|\\b${MONTH}\\s+\\d{1,2}(?:st|nd|rd|th)?\\b(?:,?\\s+\\d{4})?|\\b${MONTH}\\s+\\d{4}\\b|\\b\\d{1,2}\\/\\d{1,2}\\/\\d{2,4}\\b|\\b(?:19|20)\\d{2}\\b`, "g")],
|
|
3277
|
+
["time", /\b\d{1,2}(?:[:.]\d{2})?\s?(?:am|pm)\b|\b\d{1,2}:\d{2}\b/gi],
|
|
3278
|
+
["number", /\b\d[\d,]*(?:\.\d+)?%?|\b\d+(?:\.\d+)?\s?(?:per ?cent)\b/gi]
|
|
3279
|
+
];
|
|
3280
|
+
var NAME = /[A-Z][a-zA-Z’'&-]*[a-zA-Z](?:\s+(?:of|and|&|the)?\s*[A-Z][a-zA-Z’'&-]*[a-zA-Z])*/g;
|
|
3281
|
+
var normalise = (kind, value) => {
|
|
3282
|
+
const v = value.trim();
|
|
3283
|
+
if (kind === "phone") return v.replace(/[^\d+]/g, "").replace(/^\+44\(?0?\)?/, "0").replace(/^\+44/, "0");
|
|
3284
|
+
if (kind === "money" || kind === "number") return v.replace(/[\s,]/g, "").toLowerCase();
|
|
3285
|
+
if (kind === "postcode") return v.replace(/\s/g, "").toUpperCase();
|
|
3286
|
+
if (kind === "url") return v.replace(/[.,;:]+$/, "").toLowerCase();
|
|
3287
|
+
return v.replace(/\s+/g, " ").toLowerCase();
|
|
3288
|
+
};
|
|
3289
|
+
function visibleText(file) {
|
|
3290
|
+
const prose = /\.(md|markdown|mdx|txt)$/i.test(file.path);
|
|
3291
|
+
return (prose ? extractCopy(file) : extractStrings(file)).map((b) => b.text).join("\n");
|
|
3292
|
+
}
|
|
3293
|
+
function protectedFacts(text) {
|
|
3294
|
+
const facts = [];
|
|
3295
|
+
let rest = text;
|
|
3296
|
+
const mask = (start, length) => {
|
|
3297
|
+
rest = rest.slice(0, start) + " ".repeat(length) + rest.slice(start + length);
|
|
3298
|
+
};
|
|
3299
|
+
for (const [kind, pattern] of PATTERNS) {
|
|
3300
|
+
for (const m of [...rest.matchAll(pattern)]) {
|
|
3301
|
+
const value = m[0].replace(/[.,;:]+$/, "");
|
|
3302
|
+
facts.push({ kind, value, key: `${kind}:${normalise(kind, value)}` });
|
|
3303
|
+
mask(m.index ?? 0, m[0].length);
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
const lines = rest.split("\n");
|
|
3307
|
+
for (const line of lines) {
|
|
3308
|
+
if (/^\s{0,3}#{1,6}\s/.test(line)) continue;
|
|
3309
|
+
for (const m of line.matchAll(NAME)) {
|
|
3310
|
+
const at = m.index ?? 0;
|
|
3311
|
+
const before = line.slice(0, at).trimEnd();
|
|
3312
|
+
const opensSentence = before === "" || /[.!?:"“(>*-]$/.test(before) || /^\s*(?:[-*+]|\d+\.)$/.test(before);
|
|
3313
|
+
const word = m[0];
|
|
3314
|
+
const acronym = /^[A-Z]{2,}$/.test(word);
|
|
3315
|
+
if (opensSentence && !acronym && !/\s/.test(word)) continue;
|
|
3316
|
+
if (word === "I") continue;
|
|
3317
|
+
facts.push({ kind: "name", value: word, key: `name:${normalise("name", word)}` });
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
return facts;
|
|
3321
|
+
}
|
|
3322
|
+
var unique = (facts) => [...new Map(facts.map((f4) => [f4.key, f4])).values()];
|
|
3323
|
+
function compareFacts(before, after) {
|
|
3324
|
+
const a = unique(protectedFacts(before));
|
|
3325
|
+
const b = unique(protectedFacts(after));
|
|
3326
|
+
const inA = new Set(a.map((f4) => f4.key));
|
|
3327
|
+
const inB = new Set(b.map((f4) => f4.key));
|
|
3328
|
+
return {
|
|
3329
|
+
before: a.length,
|
|
3330
|
+
after: b.length,
|
|
3331
|
+
lost: a.filter((f4) => !inB.has(f4.key)),
|
|
3332
|
+
added: b.filter((f4) => !inA.has(f4.key))
|
|
3333
|
+
};
|
|
3334
|
+
}
|
|
3335
|
+
function formatComparison(result, beforePath, afterPath) {
|
|
3336
|
+
const lines = [`craft copy compare: ${beforePath} -> ${afterPath}`, ` ${result.before} protected facts before, ${result.after} after`];
|
|
3337
|
+
if (result.lost.length) {
|
|
3338
|
+
lines.push("", ` Lost (${result.lost.length}): restore each, or say why it went`);
|
|
3339
|
+
for (const f4 of result.lost) lines.push(` ${f4.kind.padEnd(9)} ${f4.value}`);
|
|
3340
|
+
}
|
|
3341
|
+
if (result.added.length) {
|
|
3342
|
+
lines.push("", ` Added (${result.added.length}): each needs a source, or it is invented`);
|
|
3343
|
+
for (const f4 of result.added) lines.push(` ${f4.kind.padEnd(9)} ${f4.value}`);
|
|
3344
|
+
}
|
|
3345
|
+
if (!result.lost.length && !result.added.length) lines.push("", " Every fact kept, nothing added.");
|
|
3346
|
+
return lines.join("\n");
|
|
3347
|
+
}
|
|
3348
|
+
|
|
3349
|
+
// src/character/specificity.ts
|
|
3350
|
+
var TRADE_NOUNS = [
|
|
3351
|
+
// heating, plumbing, electrical
|
|
3352
|
+
"boiler",
|
|
3353
|
+
"radiator",
|
|
3354
|
+
"combi",
|
|
3355
|
+
"cylinder",
|
|
3356
|
+
"thermostat",
|
|
3357
|
+
"underfloor heating",
|
|
3358
|
+
"heat pump",
|
|
3359
|
+
"solar panel",
|
|
3360
|
+
"plumbing",
|
|
3361
|
+
"plumber",
|
|
3362
|
+
"leak",
|
|
3363
|
+
"toilet",
|
|
3364
|
+
"shower",
|
|
3365
|
+
"bathroom",
|
|
3366
|
+
"wet room",
|
|
3367
|
+
"drain",
|
|
3368
|
+
"fuse board",
|
|
3369
|
+
"fuseboard",
|
|
3370
|
+
"consumer unit",
|
|
3371
|
+
"rewire",
|
|
3372
|
+
"socket",
|
|
3373
|
+
"ev charger",
|
|
3374
|
+
"electrician",
|
|
3375
|
+
"gas engineer",
|
|
3376
|
+
"power flush",
|
|
3377
|
+
"landlord certificate",
|
|
3378
|
+
"eicr",
|
|
3379
|
+
// building and outside
|
|
3380
|
+
"extension",
|
|
3381
|
+
"loft conversion",
|
|
3382
|
+
"loft",
|
|
3383
|
+
"kitchen",
|
|
3384
|
+
"roof",
|
|
3385
|
+
"roofer",
|
|
3386
|
+
"gutter",
|
|
3387
|
+
"chimney",
|
|
3388
|
+
"driveway",
|
|
3389
|
+
"patio",
|
|
3390
|
+
"fence",
|
|
3391
|
+
"fencing",
|
|
3392
|
+
"decking",
|
|
3393
|
+
"window",
|
|
3394
|
+
"conservatory",
|
|
3395
|
+
"plastering",
|
|
3396
|
+
"plasterer",
|
|
3397
|
+
"render",
|
|
3398
|
+
"brickwork",
|
|
3399
|
+
"bricklayer",
|
|
3400
|
+
"tiling",
|
|
3401
|
+
"tiler",
|
|
3402
|
+
"flooring",
|
|
3403
|
+
"carpet",
|
|
3404
|
+
"joinery",
|
|
3405
|
+
"joiner",
|
|
3406
|
+
"carpenter",
|
|
3407
|
+
"staircase",
|
|
3408
|
+
"damp",
|
|
3409
|
+
"scaffolding",
|
|
3410
|
+
"garage conversion",
|
|
3411
|
+
"lawn",
|
|
3412
|
+
"hedge",
|
|
3413
|
+
"tree surgery",
|
|
3414
|
+
"stump",
|
|
3415
|
+
"landscaping",
|
|
3416
|
+
"gardener",
|
|
3417
|
+
"gate",
|
|
3418
|
+
"locksmith",
|
|
3419
|
+
"pest control",
|
|
3420
|
+
"wasp",
|
|
3421
|
+
"cleaning",
|
|
3422
|
+
"oven",
|
|
3423
|
+
"end of tenancy",
|
|
3424
|
+
// vehicles
|
|
3425
|
+
"mot",
|
|
3426
|
+
"tyre",
|
|
3427
|
+
"brake",
|
|
3428
|
+
"clutch",
|
|
3429
|
+
"cambelt",
|
|
3430
|
+
"exhaust",
|
|
3431
|
+
"gearbox",
|
|
3432
|
+
"valeting",
|
|
3433
|
+
// personal and health
|
|
3434
|
+
"haircut",
|
|
3435
|
+
"skin fade",
|
|
3436
|
+
"beard",
|
|
3437
|
+
"barber",
|
|
3438
|
+
"balayage",
|
|
3439
|
+
"nails",
|
|
3440
|
+
"lashes",
|
|
3441
|
+
"massage",
|
|
3442
|
+
"physio",
|
|
3443
|
+
"physiotherapy",
|
|
3444
|
+
"osteopath",
|
|
3445
|
+
"chiropractor",
|
|
3446
|
+
"dentist",
|
|
3447
|
+
"dental",
|
|
3448
|
+
"implant",
|
|
3449
|
+
"brace",
|
|
3450
|
+
"invisalign",
|
|
3451
|
+
"hygienist",
|
|
3452
|
+
"optician",
|
|
3453
|
+
"eye test",
|
|
3454
|
+
"vet",
|
|
3455
|
+
"grooming",
|
|
3456
|
+
"dog walking",
|
|
3457
|
+
"personal trainer",
|
|
3458
|
+
"yoga",
|
|
3459
|
+
"pilates",
|
|
3460
|
+
// professional
|
|
3461
|
+
"accountant",
|
|
3462
|
+
"tax return",
|
|
3463
|
+
"bookkeeping",
|
|
3464
|
+
"payroll",
|
|
3465
|
+
"vat",
|
|
3466
|
+
"self assessment",
|
|
3467
|
+
"solicitor",
|
|
3468
|
+
"conveyancing",
|
|
3469
|
+
"probate",
|
|
3470
|
+
"divorce",
|
|
3471
|
+
"lasting power of attorney",
|
|
3472
|
+
"mortgage",
|
|
3473
|
+
"surveyor",
|
|
3474
|
+
"architect",
|
|
3475
|
+
"planning permission",
|
|
3476
|
+
"building regulations",
|
|
3477
|
+
// web and digital, for the agency's own pages
|
|
3478
|
+
"website",
|
|
3479
|
+
"web design",
|
|
3480
|
+
"seo",
|
|
3481
|
+
"hosting",
|
|
3482
|
+
"google business profile",
|
|
3483
|
+
"online shop",
|
|
3484
|
+
"ecommerce",
|
|
3485
|
+
// food and hospitality
|
|
3486
|
+
"breakfast",
|
|
3487
|
+
"lunch",
|
|
3488
|
+
"dinner",
|
|
3489
|
+
"coffee",
|
|
3490
|
+
"bakery",
|
|
3491
|
+
"cake",
|
|
3492
|
+
"catering",
|
|
3493
|
+
"wedding",
|
|
3494
|
+
"venue"
|
|
3495
|
+
];
|
|
3496
|
+
var STOCK_FIGURES = [
|
|
3497
|
+
/\b24\s?\/\s?7\b/gi,
|
|
3498
|
+
/\b24[\s-]hours?\b/gi,
|
|
3499
|
+
/\b1[01]0\s?%/g,
|
|
3500
|
+
/\b(?:5|five)[\s-]?star\b/gi,
|
|
3501
|
+
/#\s?1\b/g,
|
|
3502
|
+
/\bno\.?\s?1\b/gi,
|
|
3503
|
+
/\b365\s+days\b/gi
|
|
3504
|
+
];
|
|
3505
|
+
var NOT_NAMES = new Set(
|
|
3506
|
+
"a an the and of for to in on at by with your you our we us it get free quote quotes call now today book booking contact learn more read see view explore discover start started home about services service quality trusted trust expert experts expertise professional professionals best solutions solution digital team welcome why choose how works local reliable affordable fast friendly premium leading excellence excellent results success growth business businesses customer customers client clients care support help new our story mission vision values innovation innovative modern simple easy smart better great amazing perfect ultimate transform elevate empower unlock experience experienced dedicated passionate committed tailored bespoke seamless peace mind can do all every everything more less here there this that what who where when need needs make difference satisfaction guaranteed".split(" ")
|
|
3507
|
+
);
|
|
3508
|
+
var BRIEF_STOP = new Set(
|
|
3509
|
+
"a an the and or of for to in on at by with from who that which what their they them its it is are was were be been being has have had do does did can will would should could may might must this these those there here as into over under business company small local family run based owned services service provides provide offering offers people customers clients home homes house houses area areas around near across nearby town city county village uk".split(" ")
|
|
3510
|
+
);
|
|
3511
|
+
var WORD2 = /[A-Za-z0-9£$€][\w'’£$€%.,-]*/g;
|
|
3512
|
+
var countWords2 = (text) => (text.match(WORD2) ?? []).length;
|
|
3513
|
+
var escape2 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3514
|
+
var termPattern = (term) => new RegExp(`(?<![\\w\xA3$\u20AC])${term.split(/\s+/).map(escape2).join("[\\s-]+")}(?:s|es)?(?![\\w])`, "i");
|
|
3515
|
+
var TRADE_PATTERNS = TRADE_NOUNS.map((t) => [t, termPattern(t)]);
|
|
3516
|
+
var SMALL_WORDS = /* @__PURE__ */ new Set(["a", "an", "the", "and", "or", "of", "in", "on", "at", "to", "for", "by", "with", "from"]);
|
|
3517
|
+
function caseless(line) {
|
|
3518
|
+
const words = line.match(/[A-Za-z][A-Za-z’'-]*/g) ?? [];
|
|
3519
|
+
const letters = words.filter((w) => w.length >= 2);
|
|
3520
|
+
if (letters.length >= 3 && letters.filter((w) => w === w.toUpperCase()).length / letters.length >= 0.6) return "shout";
|
|
3521
|
+
const content = letters.filter((w) => !SMALL_WORDS.has(w.toLowerCase()));
|
|
3522
|
+
if (content.length >= 3 && content.filter((w) => /^[A-Z]/.test(w)).length / content.length >= 0.8) return "title";
|
|
3523
|
+
return null;
|
|
3524
|
+
}
|
|
3525
|
+
var maskStock = (text) => STOCK_FIGURES.reduce((t, re) => t.replace(re, (m) => " ".repeat(m.length)), text);
|
|
3526
|
+
function briefTerms(brief) {
|
|
3527
|
+
const terms = /* @__PURE__ */ new Set();
|
|
3528
|
+
for (const w of brief.match(/[A-Za-z][A-Za-z’'&-]*/g) ?? []) {
|
|
3529
|
+
const lower = w.toLowerCase();
|
|
3530
|
+
if (/^[A-Z]/.test(w) && w.length >= 3 && !BRIEF_STOP.has(lower) && !NOT_NAMES.has(lower)) terms.add(lower);
|
|
3531
|
+
}
|
|
3532
|
+
for (const [term, re] of TRADE_PATTERNS) if (re.test(brief)) terms.add(term);
|
|
3533
|
+
for (const f4 of protectedFacts(maskStock(brief))) if (f4.kind !== "name") terms.add(f4.value.toLowerCase());
|
|
3534
|
+
return [...terms];
|
|
3535
|
+
}
|
|
3536
|
+
function specifics(text, brief) {
|
|
3537
|
+
const found = /* @__PURE__ */ new Map();
|
|
3538
|
+
const add = (kind, value) => {
|
|
3539
|
+
const key = value.toLowerCase().replace(/\s+/g, " ").trim();
|
|
3540
|
+
if (key && !found.has(key)) found.set(key, { kind, value, key });
|
|
3541
|
+
};
|
|
3542
|
+
for (const raw of text.split("\n")) {
|
|
3543
|
+
const line = maskStock(raw);
|
|
3544
|
+
if (!line.trim()) continue;
|
|
3545
|
+
const capitals = caseless(line);
|
|
3546
|
+
for (const f4 of protectedFacts(line)) {
|
|
3547
|
+
if (f4.kind === "name") {
|
|
3548
|
+
if (capitals === "shout") continue;
|
|
3549
|
+
if (capitals === "title") {
|
|
3550
|
+
for (const acronym of f4.value.match(/\b[A-Z]{2,}\b/g) ?? []) add("name", acronym);
|
|
3551
|
+
continue;
|
|
3552
|
+
}
|
|
3553
|
+
const words = f4.value.split(/\s+/);
|
|
3554
|
+
const named = (w) => !NOT_NAMES.has(w.toLowerCase()) && w !== "&";
|
|
3555
|
+
const first = words.findIndex(named);
|
|
3556
|
+
if (first === -1) continue;
|
|
3557
|
+
const last = words.length - 1 - [...words].reverse().findIndex(named);
|
|
3558
|
+
add("name", words.slice(first, last + 1).join(" "));
|
|
3559
|
+
continue;
|
|
3560
|
+
}
|
|
3561
|
+
add(f4.kind, f4.value);
|
|
3562
|
+
}
|
|
3563
|
+
for (const [term, re] of TRADE_PATTERNS) {
|
|
3564
|
+
const m = re.exec(line);
|
|
3565
|
+
if (m) add("trade", term);
|
|
3566
|
+
}
|
|
3567
|
+
}
|
|
3568
|
+
if (brief) {
|
|
3569
|
+
for (const term of briefTerms(brief)) {
|
|
3570
|
+
if ([...found.keys()].some((k) => k === term || k.split(" ").includes(term))) continue;
|
|
3571
|
+
if (termPattern(term).test(text)) add("brief", term);
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
return [...found.values()];
|
|
3575
|
+
}
|
|
3576
|
+
function specificity(text, brief) {
|
|
3577
|
+
const list = specifics(text, brief);
|
|
3578
|
+
const words = countWords2(text);
|
|
3579
|
+
const trade = list.filter((s) => s.kind === "trade").length;
|
|
3580
|
+
const hard = list.length - trade;
|
|
3581
|
+
return {
|
|
3582
|
+
words,
|
|
3583
|
+
specifics: list,
|
|
3584
|
+
hard,
|
|
3585
|
+
trade,
|
|
3586
|
+
perHundred: words ? Math.round(list.length / words * 1e3) / 10 : 0,
|
|
3587
|
+
generic: hard === 0 && trade < 2
|
|
3588
|
+
};
|
|
3589
|
+
}
|
|
3590
|
+
var NOT_SERVICE_ROLES = /* @__PURE__ */ new Set(["testimonials", "team", "faq", "contact", "logos", "stats", "cta-band", "footer-cta", "marquee"]);
|
|
3591
|
+
var SERVICE_ROLES = /* @__PURE__ */ new Set(["features", "process", "pricing", "cards"]);
|
|
3592
|
+
var SERVICE_LABEL = /\bservices?\b|\bwhat we (?:do|fix|offer|make|build)\b|\bhow we\b|\bour work\b|\bwe (?:fix|fit|install|repair|build|offer|make)\b/i;
|
|
3593
|
+
function sentencesOf(blocks) {
|
|
3594
|
+
const out = [];
|
|
3595
|
+
for (const block of blocks) {
|
|
3596
|
+
for (const m of block.matchAll(/[^.!?]+[.!?]*/g)) {
|
|
3597
|
+
const s = m[0].trim();
|
|
3598
|
+
if (countWords2(s) >= 3) out.push(s);
|
|
3599
|
+
}
|
|
3600
|
+
}
|
|
3601
|
+
return [...new Set(out)];
|
|
3602
|
+
}
|
|
3603
|
+
function pageCopy(snapshot) {
|
|
3604
|
+
const withText2 = snapshot.sections.filter((s) => s.text);
|
|
3605
|
+
if (!snapshot.firstScreenText && withText2.length === 0) return null;
|
|
3606
|
+
const hero = [...snapshot.firstScreenText ?? [], ...snapshot.sections.filter((s) => s.kind === "hero").flatMap((s) => s.text ?? [])];
|
|
3607
|
+
const services = snapshot.sections.filter((s) => s.kind !== "hero" && !NOT_SERVICE_ROLES.has(s.role ?? s.kind)).filter((s) => SERVICE_ROLES.has(s.role ?? s.kind) || SERVICE_LABEL.test(s.label)).flatMap((s) => s.text ?? []);
|
|
3608
|
+
const all = [...snapshot.firstScreenText ?? [], ...withText2.flatMap((s) => s.text ?? [])];
|
|
3609
|
+
return { url: snapshot.url, hero: sentencesOf(hero), services: sentencesOf(services), all };
|
|
3610
|
+
}
|
|
3611
|
+
function side(page, other, brief) {
|
|
3612
|
+
const otherKeys = new Set(specifics(other.all.join("\n"), brief).map((s) => s.key));
|
|
3613
|
+
const sentences2 = [.../* @__PURE__ */ new Set([...page.hero, ...page.services])];
|
|
3614
|
+
const interchangeable = sentences2.filter((s) => !specifics(s, brief).some((x) => !otherKeys.has(x.key)));
|
|
3615
|
+
return {
|
|
3616
|
+
url: page.url,
|
|
3617
|
+
sentences: sentences2.length,
|
|
3618
|
+
interchangeable,
|
|
3619
|
+
share: sentences2.length ? Math.round(interchangeable.length / sentences2.length * 1e3) / 1e3 : null,
|
|
3620
|
+
perHundred: specificity(sentences2.join("\n"), brief).perHundred
|
|
3621
|
+
};
|
|
3622
|
+
}
|
|
3623
|
+
function compareCompetitor(ours, competitor, brief) {
|
|
3624
|
+
return { ours: side(ours, competitor, brief), competitor: side(competitor, ours, brief), brief: Boolean(brief) };
|
|
3625
|
+
}
|
|
3626
|
+
var pctOf = (share) => share === null ? "no sentences" : `${Math.round(share * 100)}%`;
|
|
3627
|
+
function formatCompetitor(result) {
|
|
3628
|
+
const row = (label, s) => ` ${label.padEnd(11)} ${s.interchangeable.length} of ${s.sentences} (${pctOf(s.share)}), ${s.perHundred} specifics per 100 words`;
|
|
3629
|
+
const lines = [
|
|
3630
|
+
`craft copy compare: ${result.ours.url} against ${result.competitor.url}`,
|
|
3631
|
+
" Hero and service sentences holding nothing the other page does not also say:",
|
|
3632
|
+
row("ours", result.ours),
|
|
3633
|
+
row("competitor", result.competitor)
|
|
3634
|
+
];
|
|
3635
|
+
if (result.brief) lines.push(" The brief's own terms were recognised on both pages.");
|
|
3636
|
+
if (result.ours.interchangeable.length) {
|
|
3637
|
+
lines.push("", " Interchangeable on ours: add the job, the place, the price or the name only this business has");
|
|
3638
|
+
for (const s of result.ours.interchangeable.slice(0, 12)) lines.push(` "${s.length > 110 ? `${s.slice(0, 107)}...` : s}"`);
|
|
3639
|
+
if (result.ours.interchangeable.length > 12) lines.push(` and ${result.ours.interchangeable.length - 12} more`);
|
|
3640
|
+
} else {
|
|
3641
|
+
lines.push("", " Every hero and service sentence on ours holds something the competitor does not say.");
|
|
3642
|
+
}
|
|
3643
|
+
return lines.join("\n");
|
|
3644
|
+
}
|
|
3645
|
+
|
|
3646
|
+
// src/character/tells/specificity.ts
|
|
3647
|
+
var count = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
3648
|
+
var snapHit = (s, message, excerpt) => ({ path: s.url, offset: 0, message, excerpt: excerpt ?? message });
|
|
3649
|
+
var ENTITIES = { amp: "&", nbsp: " ", rsquo: "\u2019", lsquo: "\u2018", ldquo: "\u201C", rdquo: "\u201D", quot: '"', apos: "'", "#39": "'", pound: "\xA3" };
|
|
3650
|
+
function literalText(inner) {
|
|
3651
|
+
const t = inner.replace(/\{\s*(["'`])\s*\1\s*\}/g, " ").replace(/<br\s*\/?>/gi, " ").replace(/<[^>]+>/g, " ");
|
|
3652
|
+
if (/[{}]/.test(t)) return null;
|
|
3653
|
+
return t.replace(/&(#?\w+);/g, (m, e) => ENTITIES[e] ?? m).replace(/\s+/g, " ").trim();
|
|
3654
|
+
}
|
|
3655
|
+
var HOME_FILE = /(?:^|\/)app\/(?:\([^/]+\)\/)*page\.(?:tsx|jsx|mdx)$|(?:^|\/)pages\/index\.(?:tsx|jsx|astro|vue|mdx)$|(?:^|\/)routes\/(?:\([^/]+\)\/)*\+page\.svelte$|^(?:(?:public|src|site|www)\/)?index\.html?$|(?:^|\/)[\w-]*(?:hero|home)[\w-]*\.(?:tsx|jsx|astro|vue|svelte|html?)$/i;
|
|
3656
|
+
var HOME_URL = /^https?:\/\/[^/?#]+(?:\/(?:[a-z]{2}(?:-[a-z]{2})?\/?)?(?:index\.html?)?)?(?:[?#].*)?$/i;
|
|
3657
|
+
var H1 = /<h1\b[^>]*>([\s\S]*?)<\/h1>/gi;
|
|
3658
|
+
var NEXT_P = /<p\b[^>]*>([\s\S]*?)<\/p>/i;
|
|
3659
|
+
function headlines(ctx) {
|
|
3660
|
+
const out = [];
|
|
3661
|
+
for (const file of ctx.files) {
|
|
3662
|
+
if (fileKind(file.path) !== "markup" || !HOME_FILE.test(file.path)) continue;
|
|
3663
|
+
for (const m of file.text.matchAll(H1)) {
|
|
3664
|
+
const h1 = literalText(m[1]);
|
|
3665
|
+
if (!h1) continue;
|
|
3666
|
+
const after = file.text.slice((m.index ?? 0) + m[0].length, (m.index ?? 0) + m[0].length + 1200);
|
|
3667
|
+
const p = NEXT_P.exec(after);
|
|
3668
|
+
const sub = p ? literalText(p[1]) : null;
|
|
3669
|
+
out.push({ path: file.path, offset: m.index ?? 0, h1, text: [h1, sub].filter(Boolean).join("\n") });
|
|
3670
|
+
}
|
|
3671
|
+
}
|
|
3672
|
+
return out;
|
|
3673
|
+
}
|
|
3674
|
+
var GENERIC_MESSAGE = "the headline and the line under it name nothing particular: no place, name, number, price or job";
|
|
3675
|
+
var STANDING_CLAIM = /(?<![\w#])(?:trusted|reliable|reputable|award[- ]winning|top[- ]rated|best[- ]rated|highly (?:rated|recommended|experienced|skilled|qualified)|fully (?:qualified|certified|accredited|licensed|insured)|(?:qualified|certified|accredited|approved|registered|experienced|expert) (?:engineers?|electricians?|plumbers?|builders?|technicians?|installers?|team|tradesmen|professionals?|staff)|(?:years|decades) of experience|(?:5|five)[- ]star (?:service|rated|reviews?)|(?:happy|satisfied) (?:customers|clients)|(?:customers|clients) (?:love|trust|recommend)|number one|no\.? ?1|#1)(?![\w])/i;
|
|
3676
|
+
var PROOF_NAMES = [
|
|
3677
|
+
"Gas Safe",
|
|
3678
|
+
"NICEIC",
|
|
3679
|
+
"NAPIT",
|
|
3680
|
+
"ELECSA",
|
|
3681
|
+
"Stroma",
|
|
3682
|
+
"TrustMark",
|
|
3683
|
+
"Which? Trusted Trader",
|
|
3684
|
+
"Checkatrade",
|
|
3685
|
+
"TrustATrader",
|
|
3686
|
+
"Rated People",
|
|
3687
|
+
"MyBuilder",
|
|
3688
|
+
"Federation of Master Builders",
|
|
3689
|
+
"FMB",
|
|
3690
|
+
"Guild of Master Craftsmen",
|
|
3691
|
+
"OFTEC",
|
|
3692
|
+
"HETAS",
|
|
3693
|
+
"CIPHE",
|
|
3694
|
+
"APHC",
|
|
3695
|
+
"CHAS",
|
|
3696
|
+
"SafeContractor",
|
|
3697
|
+
"Constructionline",
|
|
3698
|
+
"FENSA",
|
|
3699
|
+
"CERTASS",
|
|
3700
|
+
"MCS",
|
|
3701
|
+
"RECC",
|
|
3702
|
+
"BPEC",
|
|
3703
|
+
"City & Guilds",
|
|
3704
|
+
"NVQ",
|
|
3705
|
+
"CSCS",
|
|
3706
|
+
"Worcester Bosch",
|
|
3707
|
+
"Vaillant",
|
|
3708
|
+
"Viessmann",
|
|
3709
|
+
"BAFE",
|
|
3710
|
+
"NSI",
|
|
3711
|
+
"SSAIB",
|
|
3712
|
+
"BPCA",
|
|
3713
|
+
"RICS",
|
|
3714
|
+
"CIOB",
|
|
3715
|
+
"RIBA",
|
|
3716
|
+
"ICAEW",
|
|
3717
|
+
"ACCA",
|
|
3718
|
+
"CIMA",
|
|
3719
|
+
"SRA",
|
|
3720
|
+
"Law Society",
|
|
3721
|
+
"GDC",
|
|
3722
|
+
"GMC",
|
|
3723
|
+
"HCPC",
|
|
3724
|
+
"CQC",
|
|
3725
|
+
"Ofsted",
|
|
3726
|
+
"ISO 9001",
|
|
3727
|
+
"ISO 27001",
|
|
3728
|
+
"Cyber Essentials",
|
|
3729
|
+
"Companies House",
|
|
3730
|
+
"FCA",
|
|
3731
|
+
"Trustpilot",
|
|
3732
|
+
"Feefo",
|
|
3733
|
+
"Reviews.io",
|
|
3734
|
+
"Yell",
|
|
3735
|
+
"Houzz"
|
|
3736
|
+
];
|
|
3737
|
+
var escape3 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3738
|
+
var PROOF_NAME = new RegExp(`(?<![\\w])(?:${PROOF_NAMES.map(escape3).join("|")})(?![\\w])`);
|
|
3739
|
+
var PROOF_NAME_ANY_CASE = new RegExp(PROOF_NAME.source, "i");
|
|
3740
|
+
var PROOF_PATTERNS = [
|
|
3741
|
+
PROOF_NAME,
|
|
3742
|
+
/\bGoogle (?:reviews?|rating)\b|\breviews? on Google\b/i,
|
|
3743
|
+
// A rating or a count of reviews: "4.9 out of 5", "rated 5", "212 reviews".
|
|
3744
|
+
/\b[1-5](?:\.\d)?\s?(?:\/\s?5|out of 5)\b|\brated\s+[1-5](?:\.\d)?\b|★{3,}|\b\d[\d,]*\+?\s+(?:verified\s+)?(?:reviews|ratings)\b/i,
|
|
3745
|
+
// A registration or licence number.
|
|
3746
|
+
/\b(?:reg(?:istration|istered)?|licen[cs]e|membership|company)\s*(?:no\.?|number|#)\s*:?\s*[A-Z0-9-]{4,}/i
|
|
3747
|
+
];
|
|
3748
|
+
var isQuote = (block) => /^["“]/.test(block) && block.split(/\s+/).length >= 8 || /^[—–-]\s*[A-Z]/.test(block);
|
|
3749
|
+
function sectionHasProof(s, section, index) {
|
|
3750
|
+
if ((section.role ?? section.kind) === "testimonials") return true;
|
|
3751
|
+
const text = section.text ?? [];
|
|
3752
|
+
if (text.some((b) => isQuote(b) || PROOF_PATTERNS.some((re) => re.test(b)))) return true;
|
|
3753
|
+
return (s.images ?? []).some((i) => i.section === index && i.role === "logo" && PROOF_NAME_ANY_CASE.test(`${i.alt ?? ""} ${i.src}`));
|
|
3754
|
+
}
|
|
3755
|
+
function unprovenClaims(s) {
|
|
3756
|
+
const proof = s.sections.map((section, i) => sectionHasProof(s, section, i));
|
|
3757
|
+
const out = [];
|
|
3758
|
+
s.sections.forEach((section, i) => {
|
|
3759
|
+
if (!section.text || proof[i] || proof[i - 1] || proof[i + 1]) return;
|
|
3760
|
+
for (const sentence of sentencesOf(section.text)) {
|
|
3761
|
+
const m = STANDING_CLAIM.exec(sentence);
|
|
3762
|
+
if (m) out.push({ claim: m[0], sentence, section: section.label });
|
|
3763
|
+
}
|
|
3764
|
+
});
|
|
3765
|
+
return out;
|
|
3766
|
+
}
|
|
3767
|
+
var withText = (texts, patch = () => ({})) => {
|
|
3768
|
+
const base = makeSnapshot();
|
|
3769
|
+
return { ...base, sections: base.sections.map((sec, i) => ({ ...sec, text: texts[i] ?? [], ...patch(i) })) };
|
|
3770
|
+
};
|
|
3771
|
+
var CLAIM_TEXT = ["What we fix", "Our fully qualified engineers are trusted by homeowners across the county."];
|
|
3772
|
+
var SPECIFICITY_COPY_TELLS = [
|
|
3773
|
+
{
|
|
3774
|
+
id: "generic-hero-claim",
|
|
3775
|
+
name: "Headline that fits any business",
|
|
3776
|
+
generation: 1,
|
|
3777
|
+
severity: "warn",
|
|
3778
|
+
surface: "copy",
|
|
3779
|
+
why: "The first thing a visitor reads on the home page names no place, no person, no price and no job, so it would fit every competitor's site unchanged. A model writes it when it has nothing particular to say.",
|
|
3780
|
+
fix: 'Put what only this business can say on the first screen: the job, the town, a price, the name. "Boilers fixed the same day in Brackley" beats "Quality you can trust".',
|
|
3781
|
+
detect: (ctx) => headlines(ctx).filter((h) => specificity(h.text).generic).map((h) => ({ path: h.path, offset: h.offset, message: GENERIC_MESSAGE, excerpt: h.h1 })),
|
|
3782
|
+
fixtures: {
|
|
3783
|
+
flag: [
|
|
3784
|
+
{ path: "app/page.tsx", text: '<section>\n <h1 className="text-6xl">Quality you can trust</h1>\n <p>We deliver reliable solutions tailored to your needs.</p>\n</section>' },
|
|
3785
|
+
// Shouted and Title Case: its capitals are not names, and its figures are stock.
|
|
3786
|
+
{ path: "index.html", text: "<h1>YOUR VISION, OUR EXPERTISE</h1>\n<p>24/7 Support And 100% Satisfaction Guaranteed For Every Customer</p>" }
|
|
3787
|
+
],
|
|
3788
|
+
pass: [
|
|
3789
|
+
{ path: "app/page.tsx", text: '<h1 className="text-6xl">Boilers fixed the same day in Brackley</h1>' },
|
|
3790
|
+
// A stock headline rescued by the line under it.
|
|
3791
|
+
{ path: "index.html", text: "<h1>Quality you can trust</h1>\n<p>Gas Safe registered engineers in Northampton since 2009.</p>" },
|
|
3792
|
+
// Two trade nouns say what the business does.
|
|
3793
|
+
{ path: "index.html", text: "<h1>Plumbing and boiler repairs</h1>" },
|
|
3794
|
+
// The words come from data: nothing to read.
|
|
3795
|
+
{ path: "app/page.tsx", text: '<h1 className="text-6xl">{site.headline}</h1>' },
|
|
3796
|
+
// Another page's headline is a label, not the site's claim.
|
|
3797
|
+
{ path: "app/privacy/page.tsx", text: "<h1>Privacy policy</h1>\n<p>This policy explains how we use your data.</p>" }
|
|
3798
|
+
]
|
|
3799
|
+
},
|
|
3800
|
+
rendered: {
|
|
3801
|
+
detect: (s) => {
|
|
3802
|
+
if (!s.firstScreenText || !HOME_URL.test(s.url)) return [];
|
|
3803
|
+
const text = s.firstScreenText.join("\n");
|
|
3804
|
+
if (!text.trim() || !specificity(text).generic) return [];
|
|
3805
|
+
const h1 = s.headings.find((h) => h.level === 1 && h.top < s.viewport.height);
|
|
3806
|
+
return [snapHit(s, `the first screen names nothing particular: no place, name, number, price or job`, h1?.text ?? s.firstScreenText[0])];
|
|
3807
|
+
},
|
|
3808
|
+
fixtures: {
|
|
3809
|
+
flag: [
|
|
3810
|
+
makeSnapshot({ firstScreenText: ["Quality you can trust", "We deliver reliable solutions tailored to your needs."], headings: [{ ...makeSnapshot().headings[0], text: "Quality you can trust" }] }),
|
|
3811
|
+
makeSnapshot({ firstScreenText: ["YOUR VISION, OUR EXPERTISE", "24/7 support. 100% satisfaction. 5-star service."] })
|
|
3812
|
+
],
|
|
3813
|
+
pass: [
|
|
3814
|
+
makeSnapshot(),
|
|
3815
|
+
makeSnapshot({ firstScreenText: ["Boilers fixed the same day in Brackley", "From \xA385, with the part on the van."] }),
|
|
3816
|
+
makeSnapshot({ firstScreenText: ["Quality plumbing you can trust", "Boilers, radiators and underfloor heating."] }),
|
|
3817
|
+
// A first screen that is a picture and nothing else is not judged on its words.
|
|
3818
|
+
makeSnapshot({ firstScreenText: [] }),
|
|
3819
|
+
// Nor is any page but the home page.
|
|
3820
|
+
makeSnapshot({ url: "https://example.test/privacy", firstScreenText: ["Privacy policy", "This policy explains how we use your data."] })
|
|
3821
|
+
]
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
}
|
|
3825
|
+
];
|
|
3826
|
+
var SPECIFICITY_RENDERED_TELLS = [
|
|
3827
|
+
{
|
|
3828
|
+
id: "unproven-claim",
|
|
3829
|
+
name: "Claim with no proof next to it",
|
|
3830
|
+
generation: 1,
|
|
3831
|
+
severity: "warn",
|
|
3832
|
+
surface: "rendered",
|
|
3833
|
+
why: `"Trusted", "fully qualified" and "award-winning" ask the visitor to take the business's word for it. A page built with no reviews and no registration number makes the claim anyway, with nothing beside it.`,
|
|
3834
|
+
fix: "Put the proof where the claim is: the Gas Safe or NICEIC number, the named review with its town, the rating and where it was left. Or cut the claim.",
|
|
3835
|
+
rendered: {
|
|
3836
|
+
detect: (s) => {
|
|
3837
|
+
if (!s.sections.some((x) => x.text)) return [];
|
|
3838
|
+
const found = unprovenClaims(s);
|
|
3839
|
+
if (found.length === 0) return [];
|
|
3840
|
+
const first = found[0];
|
|
3841
|
+
const where = first.section ? `"${first.section}"` : "an unnamed section";
|
|
3842
|
+
return [snapHit(s, `${count(found.length, "claim")} with no review or accreditation within one section: "${first.claim}" in ${where}`, first.sentence)];
|
|
3843
|
+
},
|
|
3844
|
+
fixtures: {
|
|
3845
|
+
flag: [
|
|
3846
|
+
withText([["Boilers fixed the same day in Brackley"], CLAIM_TEXT]),
|
|
3847
|
+
// Proof two sections away is not next to the claim.
|
|
3848
|
+
withText([["Boilers fixed the same day in Brackley"], CLAIM_TEXT, ["Recent jobs"], ["\u201CThey turned up on time and fixed the boiler in an hour.\u201D", "Sam, Brackley"]], (i) => i === 3 ? { role: "testimonials" } : {})
|
|
3849
|
+
],
|
|
3850
|
+
pass: [
|
|
3851
|
+
makeSnapshot(),
|
|
3852
|
+
withText([["Boilers fixed the same day in Brackley"], ["Our fully qualified engineers are Gas Safe registered, number 123456."]]),
|
|
3853
|
+
withText([["Boilers fixed the same day in Brackley"], CLAIM_TEXT, ["What customers said"]], (i) => i === 2 ? { role: "testimonials" } : {}),
|
|
3854
|
+
withText([["Rated 4.9 out of 5 from 212 reviews on Google"], CLAIM_TEXT]),
|
|
3855
|
+
{
|
|
3856
|
+
...withText([["Boilers fixed the same day in Brackley"], CLAIM_TEXT]),
|
|
3857
|
+
images: [{ src: "https://example.test/img/gas-safe-register.svg", host: "example.test", width: 96, height: 96, top: 1200, role: "logo", alt: "Gas Safe Register", decorative: false, section: 1, background: false }]
|
|
3858
|
+
}
|
|
3859
|
+
]
|
|
3860
|
+
}
|
|
3861
|
+
}
|
|
3862
|
+
}
|
|
3863
|
+
];
|
|
3864
|
+
|
|
3865
|
+
// src/character/house.ts
|
|
3866
|
+
var HOUSE = {
|
|
3867
|
+
"em-dash": { tier: "block", label: "em dash, use a full stop or a comma" },
|
|
3868
|
+
emoji: { tier: "block", label: "emoji" },
|
|
3869
|
+
"not-just-but": { tier: "block", label: "contrastive negation. The template is the tell, not the sentiment. Say the positive claim" },
|
|
3870
|
+
"no-x-no-y": {
|
|
3871
|
+
tier: "block",
|
|
3872
|
+
label: '"No X, no Y" list. Defining the brand by what it is not, itemised, is the same template as contrastive negation'
|
|
3873
|
+
},
|
|
3874
|
+
"no-x-badge": { tier: "block", label: 'standalone "No X" badge. Reads as a slapped-on kicker, and worse when reused across pieces' },
|
|
3875
|
+
"ai-phrase": { tier: "block", label: "AI tell" },
|
|
3876
|
+
"plainer-word": { tier: "block", label: "a plainer word exists. Name the mechanism instead" },
|
|
3877
|
+
"plain-english": { tier: "block", label: 'use "properly explained"' },
|
|
3878
|
+
buzzword: { tier: "block", label: "forbidden phrase" },
|
|
3879
|
+
"negative-reassurance": { tier: "block", label: "negative reassurance, say what they get" },
|
|
3880
|
+
// Evidence of a pasted chat reply, not a matter of style. Moved from review
|
|
3881
|
+
// on 2026-09-24 after its estate hits were read (ROADMAP.md): 15 of 15 real.
|
|
3882
|
+
"chatbot-residue": { tier: "block", label: "chatbot residue. A chat reply was pasted in: remove it, and source or cut the claim it backed" },
|
|
3883
|
+
"review-phrase": { tier: "review", label: "review tier" },
|
|
3884
|
+
"ai-vocabulary": { tier: "review", label: "AI vocabulary" },
|
|
3885
|
+
"stock-phrase": { tier: "review", label: "stock phrase" },
|
|
3886
|
+
"hollow-imperative": { tier: "review", label: "hollow imperative" },
|
|
3887
|
+
"rhetorical-opener": { tier: "review", label: "rhetorical question opener" },
|
|
3888
|
+
"staccato-triplet": { tier: "review", label: "staccato triplet" },
|
|
3889
|
+
"where-x-meets-y": { tier: "review", label: "'where X meets Y'" },
|
|
3890
|
+
"ing-tail": { tier: "review", label: "empty -ing tail" },
|
|
3891
|
+
"vague-attribution": { tier: "review", label: "unnamed source" },
|
|
3892
|
+
"closing-summary": { tier: "review", label: "closing summary" },
|
|
3893
|
+
"false-range": { tier: "review", label: "false range" },
|
|
3894
|
+
"placeholder": { tier: "review", label: "unfilled placeholder" },
|
|
3895
|
+
// Every estate hit so far is real (38 in five DD articles, 2026-09-24), but
|
|
3896
|
+
// a proposal can honestly say "the attached research". Review until measured there.
|
|
3897
|
+
"prompt-context": { tier: "review", label: "prompt context: the model naming its own inputs" },
|
|
3898
|
+
"question-reveal": { tier: "review", label: "staged reveal" },
|
|
3899
|
+
"inline-label-list": { tier: "review", label: "bold-label bullets" },
|
|
3900
|
+
"phrase-density": { tier: "review", label: "density" },
|
|
3901
|
+
"aphorism-density": { tier: "review", label: "density" },
|
|
3902
|
+
"contraction-scarcity": { tier: "review", label: "density" },
|
|
3903
|
+
"sentence-rhythm": { tier: "review", label: "density" },
|
|
3904
|
+
"repeated-sentence": { tier: "review", label: "repetition" },
|
|
3905
|
+
"heading-shape": { tier: "review", label: "headings" },
|
|
3906
|
+
"heading-echo": { tier: "review", label: "headings" },
|
|
3907
|
+
// A threshold on a count, not a named pattern: a person decides whether the
|
|
3908
|
+
// headline needed a particular. Review until its estate hits are read.
|
|
3909
|
+
"generic-hero-claim": { tier: "review", label: "headline that fits any business" },
|
|
3910
|
+
// Banned only "when vague", per the rules. Too noisy for a sweep.
|
|
3911
|
+
"vague-word": { tier: "explicit", label: "vague" }
|
|
3912
|
+
};
|
|
3913
|
+
function houseRule(id, name = id) {
|
|
3914
|
+
return HOUSE[id] ?? { tier: "review", label: name };
|
|
3915
|
+
}
|
|
3916
|
+
var HOUSE_LOCKED = "the house blocking tier cannot be lowered by a repo. A genuine one-off takes copy-ok on its line; a rule that is wrong is changed in craft's house.ts and COPY.md";
|
|
3917
|
+
function holdHouseBlocks(exceptions, severity) {
|
|
3918
|
+
const blocks = (tell) => HOUSE[tell]?.tier === "block";
|
|
3919
|
+
const refusedSeverity = Object.entries(severity).filter(([tell, o]) => blocks(tell) && o.level !== "block").map(([tell]) => tell);
|
|
3920
|
+
return {
|
|
3921
|
+
exceptions: exceptions.filter((e) => !blocks(e.tell)),
|
|
3922
|
+
refused: exceptions.filter((e) => blocks(e.tell)),
|
|
3923
|
+
severity: Object.fromEntries(Object.entries(severity).filter(([tell]) => !refusedSeverity.includes(tell))),
|
|
3924
|
+
refusedSeverity
|
|
3925
|
+
};
|
|
3926
|
+
}
|
|
3927
|
+
|
|
3327
3928
|
// src/snapshot/rendered.ts
|
|
3328
3929
|
var hit = (s, message, excerpt) => ({ path: s.url, offset: 0, message, excerpt: excerpt ?? message });
|
|
3329
3930
|
var pct = (n) => `${Math.round(n * 100)}%`;
|
|
@@ -3387,7 +3988,7 @@ function blueToPurple(s) {
|
|
|
3387
3988
|
}
|
|
3388
3989
|
return hits;
|
|
3389
3990
|
}
|
|
3390
|
-
var
|
|
3991
|
+
var count2 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
3391
3992
|
var RENDERED_PATHS = {
|
|
3392
3993
|
"reflex-font": {
|
|
3393
3994
|
detect: reflexFonts(REFLEX_FONTS_1),
|
|
@@ -3425,11 +4026,11 @@ var RENDERED_PATHS = {
|
|
|
3425
4026
|
}
|
|
3426
4027
|
},
|
|
3427
4028
|
"gradient-text": {
|
|
3428
|
-
detect: (s) => s.effects.gradientText > 0 ? [hit(s, `${
|
|
4029
|
+
detect: (s) => s.effects.gradientText > 0 ? [hit(s, `${count2(s.effects.gradientText, "heading")} painted with a gradient`)] : [],
|
|
3429
4030
|
fixtures: { flag: [makeSnapshot({ effects: { gradientText: 1 } })], pass: [makeSnapshot()] }
|
|
3430
4031
|
},
|
|
3431
4032
|
"glass-panel": {
|
|
3432
|
-
detect: (s) => s.effects.glass > 0 ? [hit(s, `${
|
|
4033
|
+
detect: (s) => s.effects.glass > 0 ? [hit(s, `${count2(s.effects.glass, "translucent blurred panel")}`)] : [],
|
|
3433
4034
|
fixtures: { flag: [makeSnapshot({ effects: { glass: 2 } })], pass: [makeSnapshot()] }
|
|
3434
4035
|
},
|
|
3435
4036
|
"cream-palette": {
|
|
@@ -3507,7 +4108,7 @@ var RENDERED_PATHS = {
|
|
|
3507
4108
|
detect: (s) => {
|
|
3508
4109
|
const radial = s.effects.gradients.filter((g) => g.radial).length;
|
|
3509
4110
|
const n = s.effects.glows + radial;
|
|
3510
|
-
return n > 0 ? [hit(s, `${
|
|
4111
|
+
return n > 0 ? [hit(s, `${count2(n, "soft glow")} behind the content`)] : [];
|
|
3511
4112
|
},
|
|
3512
4113
|
fixtures: {
|
|
3513
4114
|
flag: [makeSnapshot({ effects: { glows: 1 } }), makeSnapshot({ effects: { gradients: [{ stops: ["rgba(99, 102, 241, 0.3)", "rgba(0, 0, 0, 0)"], area: 9e5, radial: true }] } })],
|
|
@@ -3515,11 +4116,11 @@ var RENDERED_PATHS = {
|
|
|
3515
4116
|
}
|
|
3516
4117
|
},
|
|
3517
4118
|
"grid-background": {
|
|
3518
|
-
detect: (s) => s.effects.gridBackgrounds > 0 ? [hit(s, `${
|
|
4119
|
+
detect: (s) => s.effects.gridBackgrounds > 0 ? [hit(s, `${count2(s.effects.gridBackgrounds, "graph-paper background")}`)] : [],
|
|
3519
4120
|
fixtures: { flag: [makeSnapshot({ effects: { gridBackgrounds: 1 } })], pass: [makeSnapshot()] }
|
|
3520
4121
|
},
|
|
3521
4122
|
marquee: {
|
|
3522
|
-
detect: (s) => s.effects.marquees > 0 ? [hit(s, `${
|
|
4123
|
+
detect: (s) => s.effects.marquees > 0 ? [hit(s, `${count2(s.effects.marquees, "endless scrolling strip")}`)] : [],
|
|
3523
4124
|
fixtures: { flag: [makeSnapshot({ effects: { marquees: 1 } })], pass: [makeSnapshot()] }
|
|
3524
4125
|
},
|
|
3525
4126
|
"thin-border-wide-shadow": {
|
|
@@ -3770,7 +4371,7 @@ var picture = (patch = {}) => ({
|
|
|
3770
4371
|
var withImages = (images) => ({ ...makeSnapshot(), images });
|
|
3771
4372
|
var AI_XMP = { digitalSourceType: "trainedAlgorithmicMedia", source: "xmp", c2pa: false, bytes: 48e3 };
|
|
3772
4373
|
var NOTHING = { digitalSourceType: null, source: null, c2pa: false, bytes: 48e3 };
|
|
3773
|
-
var
|
|
4374
|
+
var count3 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
3774
4375
|
var IMAGERY_TELLS = [
|
|
3775
4376
|
{
|
|
3776
4377
|
id: "stock-photo",
|
|
@@ -3785,7 +4386,7 @@ var IMAGERY_TELLS = [
|
|
|
3785
4386
|
const found = (s.images ?? []).filter((i) => i.role === "photo" || i.role === "illustration").map((i) => ({ image: i, from: stockSource(i) })).filter((x) => x.from);
|
|
3786
4387
|
if (found.length === 0) return [];
|
|
3787
4388
|
const names = [...new Set(found.map((x) => x.from))].join(", ");
|
|
3788
|
-
return [hit3(s, `${
|
|
4389
|
+
return [hit3(s, `${count3(found.length, "picture")} from ${names}`, found[0].image.src)];
|
|
3789
4390
|
},
|
|
3790
4391
|
fixtures: {
|
|
3791
4392
|
flag: [
|
|
@@ -3810,7 +4411,7 @@ var IMAGERY_TELLS = [
|
|
|
3810
4411
|
const found = (s.images ?? []).filter((i) => i.role === "avatar").map((i) => ({ image: i, from: stockAvatarSource(i) })).filter((x) => x.from);
|
|
3811
4412
|
if (found.length === 0) return [];
|
|
3812
4413
|
const names = [...new Set(found.map((x) => x.from))].join(", ");
|
|
3813
|
-
return [hit3(s, `${
|
|
4414
|
+
return [hit3(s, `${count3(found.length, "portrait")} from ${names}`, found[0].image.src)];
|
|
3814
4415
|
},
|
|
3815
4416
|
fixtures: {
|
|
3816
4417
|
flag: [
|
|
@@ -3835,7 +4436,7 @@ var IMAGERY_TELLS = [
|
|
|
3835
4436
|
if (found.length === 0) return [];
|
|
3836
4437
|
const first = found[0].provenance;
|
|
3837
4438
|
const where = first.source === "xmp" ? "its XMP metadata" : first.source === "c2pa" ? "its Content Credentials" : "its metadata";
|
|
3838
|
-
return [hit3(s, `${
|
|
4439
|
+
return [hit3(s, `${count3(found.length, "image")} labelled as made by a generative model (${first.digitalSourceType} in ${where})`, found[0].src)];
|
|
3839
4440
|
},
|
|
3840
4441
|
fixtures: {
|
|
3841
4442
|
flag: [
|
|
@@ -3860,7 +4461,7 @@ var IMAGERY_TELLS = [
|
|
|
3860
4461
|
if (!s.images || s.sections.length < 4) return [];
|
|
3861
4462
|
if (s.images.some((i) => i.role === "photo")) return [];
|
|
3862
4463
|
const icons = s.images.filter((i) => i.role === "icon" || i.role === "illustration").length;
|
|
3863
|
-
return [hit3(s, `no photograph on the page${icons ? `: ${
|
|
4464
|
+
return [hit3(s, `no photograph on the page${icons ? `: ${count3(icons, "icon or illustration", "icons and illustrations")} instead` : ""}`)];
|
|
3864
4465
|
},
|
|
3865
4466
|
fixtures: {
|
|
3866
4467
|
flag: [
|
|
@@ -3875,11 +4476,13 @@ var IMAGERY_TELLS = [
|
|
|
3875
4476
|
];
|
|
3876
4477
|
|
|
3877
4478
|
// src/character/check.ts
|
|
3878
|
-
var CATALOGUE_VERSION = "2026.09.
|
|
4479
|
+
var CATALOGUE_VERSION = "2026.09.12";
|
|
3879
4480
|
var CATALOGUE = [
|
|
3880
4481
|
...[...SOURCE_TELLS, ...COPY_TELLS, ...RESEARCH_TELLS, ...DENSITY_TELLS].map((t) => RENDERED_PATHS[t.id] ? { ...t, rendered: RENDERED_PATHS[t.id] } : t),
|
|
4482
|
+
...SPECIFICITY_COPY_TELLS,
|
|
3881
4483
|
...RENDERED_TELLS,
|
|
3882
|
-
...IMAGERY_TELLS
|
|
4484
|
+
...IMAGERY_TELLS,
|
|
4485
|
+
...SPECIFICITY_RENDERED_TELLS
|
|
3883
4486
|
];
|
|
3884
4487
|
function tellById(id) {
|
|
3885
4488
|
return CATALOGUE.find((t) => t.id === id);
|
|
@@ -3956,7 +4559,7 @@ function report(tells, files, run, options) {
|
|
|
3956
4559
|
catalogueVersion: CATALOGUE_VERSION,
|
|
3957
4560
|
findings,
|
|
3958
4561
|
rejectedExceptions: rejected,
|
|
3959
|
-
excepted: [...excepted].map(([e,
|
|
4562
|
+
excepted: [...excepted].map(([e, count4]) => ({ tell: e.tell, because: e.because, count: count4 })),
|
|
3960
4563
|
suppressed,
|
|
3961
4564
|
summary: {
|
|
3962
4565
|
files: files.length,
|
|
@@ -4001,13 +4604,19 @@ export {
|
|
|
4001
4604
|
isCream,
|
|
4002
4605
|
REFLEX_FONTS_1,
|
|
4003
4606
|
REFLEX_FONTS_2,
|
|
4004
|
-
houseRule,
|
|
4005
|
-
HOUSE_LOCKED,
|
|
4006
|
-
holdHouseBlocks,
|
|
4007
4607
|
fileKind,
|
|
4008
4608
|
extractCopy,
|
|
4009
4609
|
extractStrings,
|
|
4010
|
-
|
|
4610
|
+
visibleText,
|
|
4611
|
+
protectedFacts,
|
|
4612
|
+
compareFacts,
|
|
4613
|
+
formatComparison,
|
|
4614
|
+
pageCopy,
|
|
4615
|
+
compareCompetitor,
|
|
4616
|
+
formatCompetitor,
|
|
4617
|
+
houseRule,
|
|
4618
|
+
HOUSE_LOCKED,
|
|
4619
|
+
holdHouseBlocks,
|
|
4011
4620
|
normaliseFamily,
|
|
4012
4621
|
fingerprint,
|
|
4013
4622
|
fingerprintDistance,
|