@domandigital/craft 0.7.0 → 0.8.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 +11 -0
- package/CHARACTER.md +26 -9
- package/COPY.md +280 -0
- package/README.md +12 -0
- package/dist/{audit-YNODYB3U.js → audit-W57YDZ2K.js} +3 -3
- package/dist/audit.cjs +856 -86
- package/dist/audit.d.cts +2 -0
- package/dist/audit.d.ts +2 -0
- package/dist/audit.js +856 -86
- package/dist/{chunk-IQTZWNEK.js → chunk-35OX6C4H.js} +5 -5
- package/dist/{chunk-3AP4PJMX.js → chunk-CZHRNPDD.js} +854 -77
- package/dist/{chunk-GV3QOTQU.js → chunk-K253ZXB3.js} +4 -4
- package/dist/{chunk-Q54JSNC5.js → chunk-OGSYVCMU.js} +1 -1
- package/dist/{chunk-CU5TZHOV.js → chunk-OVOH7KZY.js} +5 -5
- package/dist/{chunk-OA7SGPN4.js → chunk-Q4MN3OXF.js} +2 -2
- package/dist/{chunk-J2BOAIHJ.js → chunk-ULYKASLA.js} +1 -1
- package/dist/{chunk-YYC4EGER.js → chunk-X65RDW65.js} +126 -11
- package/dist/{cli-MW3JAGX3.js → cli-F7ONSKZS.js} +4 -4
- package/dist/cli-FKJOMOOF.js +15 -0
- package/dist/{cli-6Y5E32FS.js → cli-KA3JDNDH.js} +4 -4
- package/dist/{cli-TM2HWYN7.js → cli-LZ7R6KJM.js} +9 -9
- package/dist/cli-SHLNRHK6.js +16 -0
- package/dist/cli.js +2 -2
- package/dist/index.cjs +974 -105
- package/dist/index.d.cts +80 -4
- package/dist/index.d.ts +80 -4
- package/dist/index.js +967 -105
- package/package.json +2 -1
- package/word-lists.json +12 -3
- package/dist/cli-IQT6QZ6U.js +0 -16
- package/dist/cli-PD43TWX7.js +0 -15
package/dist/index.cjs
CHANGED
|
@@ -38,6 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
ESTATE_VERSION: () => ESTATE_VERSION,
|
|
39
39
|
EXIT_RATIO: () => EXIT_RATIO,
|
|
40
40
|
FINGERPRINT_VERSION: () => FINGERPRINT_VERSION,
|
|
41
|
+
HOUSE: () => HOUSE,
|
|
41
42
|
HOUSE_BUDGET: () => HOUSE_BUDGET,
|
|
42
43
|
HOUSE_TYPE: () => HOUSE_TYPE,
|
|
43
44
|
LIGHTNESS_CURVE: () => LIGHTNESS_CURVE,
|
|
@@ -70,6 +71,7 @@ __export(index_exports, {
|
|
|
70
71
|
accentFork: () => accentFork,
|
|
71
72
|
addSite: () => addSite,
|
|
72
73
|
apcaContrast: () => apcaContrast,
|
|
74
|
+
applyHouseGate: () => applyHouseGate,
|
|
73
75
|
auditSnapshot: () => auditSnapshot,
|
|
74
76
|
catalogueTable: () => catalogueTable,
|
|
75
77
|
characterReport: () => characterReport,
|
|
@@ -77,6 +79,7 @@ __export(index_exports, {
|
|
|
77
79
|
checkPair: () => checkPair,
|
|
78
80
|
checkRestraint: () => checkRestraint,
|
|
79
81
|
choicesOf: () => choicesOf,
|
|
82
|
+
compareFacts: () => compareFacts,
|
|
80
83
|
compareToEstate: () => compareToEstate,
|
|
81
84
|
craftTokens: () => craftTokens,
|
|
82
85
|
deltaEOk: () => deltaEOk,
|
|
@@ -95,11 +98,13 @@ __export(index_exports, {
|
|
|
95
98
|
fluidSpace: () => fluidSpace,
|
|
96
99
|
fluidType: () => fluidType,
|
|
97
100
|
fontClass: () => fontClass,
|
|
101
|
+
formatComparison: () => formatComparison,
|
|
98
102
|
formatHex: () => formatHex,
|
|
99
103
|
formatReport: () => formatReport,
|
|
100
104
|
groundName: () => groundName,
|
|
101
105
|
harvest: () => harvest,
|
|
102
106
|
hexToOklch: () => hexToOklch,
|
|
107
|
+
houseRule: () => houseRule,
|
|
103
108
|
hueName: () => hueName,
|
|
104
109
|
hueSwatch: () => hueSwatch,
|
|
105
110
|
inP3Gamut: () => inP3Gamut,
|
|
@@ -118,6 +123,7 @@ __export(index_exports, {
|
|
|
118
123
|
parseColour: () => parseColour,
|
|
119
124
|
parseHex: () => parseHex,
|
|
120
125
|
propose: () => propose,
|
|
126
|
+
protectedFacts: () => protectedFacts,
|
|
121
127
|
ramp: () => ramp,
|
|
122
128
|
rampFromAnchors: () => rampFromAnchors,
|
|
123
129
|
retrofitPlan: () => retrofitPlan,
|
|
@@ -136,6 +142,7 @@ __export(index_exports, {
|
|
|
136
142
|
typeFeatureTokens: () => typeFeatureTokens,
|
|
137
143
|
typicality: () => typicality,
|
|
138
144
|
validateDirection: () => validateDirection,
|
|
145
|
+
visibleText: () => visibleText,
|
|
139
146
|
wcagContrast: () => wcagContrast,
|
|
140
147
|
wordListsJson: () => wordListsJson
|
|
141
148
|
});
|
|
@@ -1073,7 +1080,7 @@ function checkRestraint(input) {
|
|
|
1073
1080
|
);
|
|
1074
1081
|
}
|
|
1075
1082
|
const families = distinctValues(css, "font-family", props, unresolved).filter(
|
|
1076
|
-
(
|
|
1083
|
+
(f4) => !/\bmonospace\b|\bmono\b/.test(f4)
|
|
1077
1084
|
);
|
|
1078
1085
|
if (families.length > budget.maxFontFamilies) {
|
|
1079
1086
|
push(
|
|
@@ -1397,15 +1404,22 @@ var isProsePath = (path) => /\.(md|markdown|mdx|txt)$/i.test(path);
|
|
|
1397
1404
|
function allText(ctx) {
|
|
1398
1405
|
return [...ctx.blocks.filter((b) => isProsePath(b.path)), ...ctx.strings.filter((b) => !isProsePath(b.path))];
|
|
1399
1406
|
}
|
|
1407
|
+
var LINK = /\b(?:https?:\/\/|www\.)[^\s<>"'`)\]]+|\]\([^)\s]+\)/gi;
|
|
1408
|
+
function linkSpans(text) {
|
|
1409
|
+
return [...text.matchAll(LINK)].map((m) => [m.index ?? 0, (m.index ?? 0) + m[0].length]);
|
|
1410
|
+
}
|
|
1411
|
+
var insideLink = (spans, at) => spans.some(([a, b]) => at >= a && at < b);
|
|
1400
1412
|
function phrases(patterns, label, source = (ctx) => ctx.blocks, skip = () => false) {
|
|
1401
1413
|
return (ctx) => {
|
|
1402
1414
|
const hits = [];
|
|
1403
1415
|
for (const block of source(ctx)) {
|
|
1404
1416
|
const spans = [];
|
|
1417
|
+
const links = linkSpans(block.text);
|
|
1405
1418
|
for (const pattern of patterns) {
|
|
1406
1419
|
const global = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : `${pattern.flags}g`);
|
|
1407
1420
|
for (const m of block.text.matchAll(global)) {
|
|
1408
1421
|
if (skip(block, m[0], m.index ?? 0)) continue;
|
|
1422
|
+
if (insideLink(links, m.index ?? 0)) continue;
|
|
1409
1423
|
spans.push([m.index ?? 0, (m.index ?? 0) + m[0].length, m[0]]);
|
|
1410
1424
|
}
|
|
1411
1425
|
}
|
|
@@ -1446,7 +1460,14 @@ var AI_WORDS = [
|
|
|
1446
1460
|
"moreover",
|
|
1447
1461
|
"navigating",
|
|
1448
1462
|
"ever-evolving",
|
|
1449
|
-
"unparalleled"
|
|
1463
|
+
"unparalleled",
|
|
1464
|
+
// Measured: Kobak et al. 2024 (arXiv 2406.07016) found these 10 to 14 times
|
|
1465
|
+
// above their expected rate in post-ChatGPT abstracts. Academic, so warn only.
|
|
1466
|
+
"underscore",
|
|
1467
|
+
"underscores",
|
|
1468
|
+
"underscoring",
|
|
1469
|
+
"showcasing",
|
|
1470
|
+
"pivotal"
|
|
1450
1471
|
];
|
|
1451
1472
|
var STOCK_PHRASES = [
|
|
1452
1473
|
"in today's digital age",
|
|
@@ -1460,7 +1481,11 @@ var STOCK_PHRASES = [
|
|
|
1460
1481
|
"curated",
|
|
1461
1482
|
"crafted with care",
|
|
1462
1483
|
"tailored to your",
|
|
1463
|
-
"peace of mind"
|
|
1484
|
+
"peace of mind",
|
|
1485
|
+
"so here's",
|
|
1486
|
+
"in an era where",
|
|
1487
|
+
"the future looks bright",
|
|
1488
|
+
"only time will tell"
|
|
1464
1489
|
];
|
|
1465
1490
|
var AI_PHRASES = [
|
|
1466
1491
|
"let's dive in",
|
|
@@ -1593,7 +1618,7 @@ function lineAround(text, index) {
|
|
|
1593
1618
|
var emptyState = (block, match, index = 0) => SIGNED_IN.test(block.path) || DATA_ABSENCE.test(isProsePath(block.path) ? lineAround(block.text, index) : block.text) || DATA_ABSENCE.test(match);
|
|
1594
1619
|
var NO_X_NO_Y = /\bno\s+[\w'’ ]{2,30},\s*no\s+\w/i;
|
|
1595
1620
|
var NO_X_BADGE = /^no\s+[\w'’\- ]{2,28}[.!]?$/i;
|
|
1596
|
-
var EMOJI = /[\u{1F300}-\u{1FAFF}\u{1F1E6}-\u{1F1FF}]+/u;
|
|
1621
|
+
var EMOJI = /(?:[\u{1F300}-\u{1FAFF}\u{1F1E6}-\u{1F1FF}\u2728\u2705\u274C\u274E\u2757\u2753\u26A1\u2B50\u2764]|[\u2600-\u27BF]\uFE0F)+/u;
|
|
1597
1622
|
var placeholderDash = (block) => block.literal === true && /^[\s—]*$/.test(block.text);
|
|
1598
1623
|
function badgeHits(ctx) {
|
|
1599
1624
|
const hits = [];
|
|
@@ -1636,10 +1661,16 @@ var COPY_TELLS = [
|
|
|
1636
1661
|
surface: "copy",
|
|
1637
1662
|
why: "Phrases every generated services page uses. They fill space where a fact should be.",
|
|
1638
1663
|
fix: "Replace the phrase with the fact behind it: a number, a name, a place, a time.",
|
|
1639
|
-
detect: phrases([wordList(STOCK_PHRASES)], quoted),
|
|
1664
|
+
detect: phrases([wordList(STOCK_PHRASES), /\b(?:in|on|along)\s+(?:its|their|his|her)\s+journey\b/i], quoted),
|
|
1640
1665
|
fixtures: {
|
|
1641
|
-
flag: [
|
|
1642
|
-
|
|
1666
|
+
flag: [
|
|
1667
|
+
f("content/home.md", "Take your plumbing to the next level with peace of mind."),
|
|
1668
|
+
f("content/home.md", "We meet each practice where it is in its journey.")
|
|
1669
|
+
],
|
|
1670
|
+
pass: [
|
|
1671
|
+
f("content/home.md", "Gas Safe registered since 2009. Same-day callouts in Brackley."),
|
|
1672
|
+
f("content/home.md", "We mapped the patient journey from booking to aftercare.")
|
|
1673
|
+
]
|
|
1643
1674
|
}
|
|
1644
1675
|
},
|
|
1645
1676
|
{
|
|
@@ -1664,7 +1695,11 @@ var COPY_TELLS = [
|
|
|
1664
1695
|
f("content/home.md", "In today's rapidly evolving market, we help."),
|
|
1665
1696
|
f("content/home.md", "Whether you're a landlord or a tenant, call us.")
|
|
1666
1697
|
],
|
|
1667
|
-
pass: [
|
|
1698
|
+
pass: [
|
|
1699
|
+
f("content/home.md", "Book in three taps. We confirm by text within the hour."),
|
|
1700
|
+
f("content/home.md", "Book at https://example.com/seamless-booking today."),
|
|
1701
|
+
f("content/home.md", "[Book a slot](/seamless-booking) today.")
|
|
1702
|
+
]
|
|
1668
1703
|
}
|
|
1669
1704
|
},
|
|
1670
1705
|
{
|
|
@@ -1813,8 +1848,14 @@ var COPY_TELLS = [
|
|
|
1813
1848
|
fix: "Remove it. Typographic marks are fine: a star for a rating, a middot as a separator, an arrow in a link.",
|
|
1814
1849
|
detect: phrases([new RegExp(EMOJI.source, "u")], (m) => `emoji ${m}`, (ctx) => ctx.strings),
|
|
1815
1850
|
fixtures: {
|
|
1816
|
-
flag: [
|
|
1817
|
-
|
|
1851
|
+
flag: [
|
|
1852
|
+
f("content/home.md", "New treatments this month \u2728\u{1F680}"),
|
|
1853
|
+
f("app/cta.tsx", `export const label = "Book \u{1F680}";`),
|
|
1854
|
+
f("content/home.md", "New treatments this month \u2728"),
|
|
1855
|
+
f("content/home.md", "Same-day callouts \u2705"),
|
|
1856
|
+
f("content/home.md", "Open Sundays \u2600\uFE0F")
|
|
1857
|
+
],
|
|
1858
|
+
pass: [f("content/home.md", "Rated \u2605\u2605\u2605\u2605\u2605 \xB7 Book now \u2192"), f("content/home.md", "\u2713 Gas Safe registered")]
|
|
1818
1859
|
}
|
|
1819
1860
|
},
|
|
1820
1861
|
{
|
|
@@ -1912,6 +1953,695 @@ var COPY_TELLS = [
|
|
|
1912
1953
|
}
|
|
1913
1954
|
}
|
|
1914
1955
|
];
|
|
1956
|
+
var ING_TAIL = /,\s+(?:ensuring|highlighting|underscoring|showcasing|reflecting|demonstrating|emphasi[sz]ing|fostering|cementing|solidifying|reinforcing|symboli[sz]ing|signalling|signaling)\b[^.!?\n]{0,80}/i;
|
|
1957
|
+
var VAGUE_ATTRIBUTION = [
|
|
1958
|
+
/\b(?:studies|research|experts|scientists|surveys|statistics|the data)\s+(?:show|shows|suggest|suggests|agree|say|says|confirm|confirms|prove|proves|indicate|indicates)\b/i,
|
|
1959
|
+
/\b(?:many|most)\s+(?:experts|people|customers|professionals|homeowners)\s+(?:agree|say|believe)\b/i,
|
|
1960
|
+
/\bit\s+is\s+(?:widely|generally|commonly)\s+(?:known|accepted|believed|agreed)\b/i
|
|
1961
|
+
];
|
|
1962
|
+
function sourced(block, _match, index) {
|
|
1963
|
+
const before = block.text.slice(Math.max(0, index - 40), index);
|
|
1964
|
+
if (/(?:\b[A-Z][\w&]*[’']s|\b[A-Z]{2,}[a-z]*)\s+$/.test(before)) return true;
|
|
1965
|
+
const rest = block.text.slice(index, index + 400);
|
|
1966
|
+
const end = rest.search(/[.!?](?:\s|$)/);
|
|
1967
|
+
const sentence = rest.slice(0, end === -1 ? rest.length : end + 16);
|
|
1968
|
+
return /\[\^\w+\]|\]\(https?:|\(source|according to [A-Z]|\bper [A-Z]/.test(sentence);
|
|
1969
|
+
}
|
|
1970
|
+
var CLOSING_SUMMARY = /(?:^|[.!?]\s+|\n\s*|>\s*)(?:Overall|In conclusion|In summary|To sum up|All in all|In short|To summari[sz]e),/;
|
|
1971
|
+
var FALSE_RANGE = [
|
|
1972
|
+
/\bfrom\s+(?:[\w'’-]+\s+){0,3}[\w'’-]+\s+to\s+(?:[\w'’-]+\s+){0,3}[\w'’-]+\s+alike\b/i,
|
|
1973
|
+
/\b(?:everyone|anyone)\s+from\s+(?:[\w'’-]+\s+){0,3}[\w'’-]+\s+to\s+(?:[\w'’-]+\s*){1,4}/i
|
|
1974
|
+
];
|
|
1975
|
+
var RESIDUE = [
|
|
1976
|
+
/\bas an AI(?:\s+language)?\s+(?:model|assistant)\b/i,
|
|
1977
|
+
/(?:^|\n|>)\s*(?:Certainly|Sure|Absolutely|Of course|Great question)[!,.]\s+(?:Here(?:['’]s| is| are)|Below)\b/i,
|
|
1978
|
+
/\bhere(?:['’]s| is)\s+(?:a|an|the|your)\s+(?:revised|rewritten|updated|polished|refined|improved|draft|more concise)\s+(?:version|draft|copy)\b/i,
|
|
1979
|
+
/\blet me know if you(?:['’]d| would) like me to\b/i,
|
|
1980
|
+
/\b(?:my|the) (?:knowledge|training) cut-?off\b|\bas of my last (?:update|training)\b/i,
|
|
1981
|
+
/\bI hope this helps\b/i,
|
|
1982
|
+
// Citation tokens a chat tool leaves in copied text.
|
|
1983
|
+
// A run of them is one paste: "citeturn11search1turn10view0" is one finding.
|
|
1984
|
+
// ChatGPT wraps them in invisible private-use characters (U+E200 to U+E202),
|
|
1985
|
+
// which survive a copy and paste into a CMS: found live, 2026-09-23.
|
|
1986
|
+
/[\uE200-\uE2FF]*(?:cite)?[\uE200-\uE2FF]*(?:turn\d+(?:search|news|view|fetch|file|image)\d+[\uE200-\uE2FF]*)+/,
|
|
1987
|
+
/:?contentReference\[oaicite:\d+\](?:\{index=\d+\})?/,
|
|
1988
|
+
/【\d+(?:[:†][^】]{0,40})?】/
|
|
1989
|
+
];
|
|
1990
|
+
var AI_UTM = /utm_source=(?:chatgpt\.com|chat\.openai\.com|openai|perplexity(?:\.ai)?|claude\.ai|copilot(?:\.microsoft\.com)?|gemini(?:\.google\.com)?)\b/gi;
|
|
1991
|
+
function residueHits(ctx) {
|
|
1992
|
+
const hits = phrases(RESIDUE, quoted, allText)(ctx);
|
|
1993
|
+
for (const file of ctx.files) {
|
|
1994
|
+
for (const m of file.text.matchAll(AI_UTM)) hits.push({ path: file.path, offset: m.index ?? 0, message: `link tracked as copied from a chat assistant: "${m[0]}"` });
|
|
1995
|
+
}
|
|
1996
|
+
return hits;
|
|
1997
|
+
}
|
|
1998
|
+
var PLACEHOLDER = [
|
|
1999
|
+
/\[(?:insert|your|add|company|client|business|customer|name of|placeholder)\b[^\]\n]{0,40}\](?!\()/i,
|
|
2000
|
+
/\blorem ipsum\b/i,
|
|
2001
|
+
/\bTODO_PLACEHOLDER\b/
|
|
2002
|
+
];
|
|
2003
|
+
var PLACEHOLDER_ELEMENT = />\s*(\[(?:insert|your|add|company|client|business|customer|name of|placeholder)\b[^\]\n<]{0,40}\])\s*</gi;
|
|
2004
|
+
function insideQuotes(block, _match, index) {
|
|
2005
|
+
const lineStart = block.text.lastIndexOf("\n", index - 1) + 1;
|
|
2006
|
+
const before = block.text.slice(lineStart, index);
|
|
2007
|
+
const straight = (before.match(/"/g) ?? []).length;
|
|
2008
|
+
const curly = (before.match(/“/g) ?? []).length - (before.match(/”/g) ?? []).length;
|
|
2009
|
+
return straight % 2 === 1 || curly > 0;
|
|
2010
|
+
}
|
|
2011
|
+
function placeholderHits(ctx) {
|
|
2012
|
+
const hits = phrases(PLACEHOLDER, quoted, allText, insideQuotes)(ctx);
|
|
2013
|
+
const seen = new Set(hits.map((h) => `${h.path}:${h.offset}`));
|
|
2014
|
+
for (const file of ctx.files) {
|
|
2015
|
+
if (isProsePath(file.path)) continue;
|
|
2016
|
+
for (const m of file.text.matchAll(PLACEHOLDER_ELEMENT)) {
|
|
2017
|
+
const offset = (m.index ?? 0) + m[0].indexOf(m[1]);
|
|
2018
|
+
if (!seen.has(`${file.path}:${offset}`)) hits.push({ path: file.path, offset, message: quoted(m[1]) });
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
return hits;
|
|
2022
|
+
}
|
|
2023
|
+
var QUESTION_REVEAL = [
|
|
2024
|
+
/\b(?:The|Our|What['’]s the|Here['’]s the)\s+(?:result|catch|secret|answer|difference|best part|twist|kicker|bottom line|upshot)\?\s+[A-Z0-9]/,
|
|
2025
|
+
/\?\s+It means\b/
|
|
2026
|
+
];
|
|
2027
|
+
function inlineLabelHits(ctx) {
|
|
2028
|
+
const hits = [];
|
|
2029
|
+
for (const file of ctx.files) {
|
|
2030
|
+
if (!isProsePath(file.path)) continue;
|
|
2031
|
+
const lines = file.text.split("\n");
|
|
2032
|
+
let run = [];
|
|
2033
|
+
let offset = 0;
|
|
2034
|
+
const flush = () => {
|
|
2035
|
+
if (run.length >= 3) hits.push({ path: file.path, offset: run[0], message: `${run.length} bullets in a row open with a bold label and a colon` });
|
|
2036
|
+
run = [];
|
|
2037
|
+
};
|
|
2038
|
+
for (const line of lines) {
|
|
2039
|
+
const m = /^\s*(?:[-*+]|\d+\.)\s+\*\*[^*]{1,40}:?\*\*:?\s+(\S.*)$/.exec(line);
|
|
2040
|
+
if (m && m[1].trim().split(/\s+/).length <= 6) run.push(offset);
|
|
2041
|
+
else flush();
|
|
2042
|
+
offset += line.length + 1;
|
|
2043
|
+
}
|
|
2044
|
+
flush();
|
|
2045
|
+
}
|
|
2046
|
+
return hits;
|
|
2047
|
+
}
|
|
2048
|
+
var RESEARCH_TELLS = [
|
|
2049
|
+
{
|
|
2050
|
+
id: "chatbot-residue",
|
|
2051
|
+
name: "Chatbot residue",
|
|
2052
|
+
generation: 1,
|
|
2053
|
+
severity: "warn",
|
|
2054
|
+
surface: "copy",
|
|
2055
|
+
why: "'Certainly! Here's a revised version', 'as an AI language model', a citeturn0search0 token, a link tracked utm_source=chatgpt.com: text that exists only because a chat reply was pasted whole. This is evidence, not style.",
|
|
2056
|
+
fix: "Delete the residue. Then read the whole passage again, because the rest of it came from the same paste.",
|
|
2057
|
+
detect: residueHits,
|
|
2058
|
+
fixtures: {
|
|
2059
|
+
flag: [
|
|
2060
|
+
f("content/home.md", "Certainly! Here's a revised version of your home page."),
|
|
2061
|
+
f("content/home.md", "As an AI language model, I cannot visit your salon."),
|
|
2062
|
+
f("content/home.md", "Let me know if you'd like me to shorten it."),
|
|
2063
|
+
f("content/home.md", "Prices start at \xA340 citeturn0search3 for a full set."),
|
|
2064
|
+
f("content/home.md", "Prices start at \xA340. citeturn11search1turn10view0turn2view3"),
|
|
2065
|
+
f("content/home.md", "Prices start at \xA340. \uE200cite\uE202turn11search1\uE202turn10view0\uE201"),
|
|
2066
|
+
f("content/home.md", "Prices start at \xA340 :contentReference[oaicite:2]{index=2} for a full set."),
|
|
2067
|
+
f("content/home.md", "Prices start at \xA340\u30104\u2020source\u3011 for a full set."),
|
|
2068
|
+
f("app/guide.tsx", `export const Guide = () => <a href="https://example.com/guide?utm_source=chatgpt.com">Read the guide</a>;`),
|
|
2069
|
+
f("content/home.md", "Here's a more concise version for the hero.")
|
|
2070
|
+
],
|
|
2071
|
+
pass: [
|
|
2072
|
+
f("content/home.md", "Certainly the busiest week of the year: book early."),
|
|
2073
|
+
f("content/home.md", "Here's the price list for 2026."),
|
|
2074
|
+
f("app/guide.tsx", `export const Guide = () => <a href="https://example.com/guide?utm_source=newsletter">Read the guide</a>;`)
|
|
2075
|
+
]
|
|
2076
|
+
}
|
|
2077
|
+
},
|
|
2078
|
+
{
|
|
2079
|
+
id: "placeholder",
|
|
2080
|
+
name: "Unfilled placeholder",
|
|
2081
|
+
generation: 1,
|
|
2082
|
+
severity: "warn",
|
|
2083
|
+
surface: "copy",
|
|
2084
|
+
why: "'[Insert testimonial]', '[Your Name]', lorem ipsum, TODO_PLACEHOLDER: scaffolding a reader must never see, and the clearest sign a page shipped before anyone read it.",
|
|
2085
|
+
fix: "Fill it from the client or the proof source, or remove the element. Never invent the missing fact to close it.",
|
|
2086
|
+
detect: placeholderHits,
|
|
2087
|
+
fixtures: {
|
|
2088
|
+
flag: [
|
|
2089
|
+
f("content/home.md", "Rated 5 stars by [Insert client name] and others."),
|
|
2090
|
+
f("content/home.md", "Lorem ipsum dolor sit amet."),
|
|
2091
|
+
f("content/home.md", "Rated TODO_PLACEHOLDER: google_rating from our reviews."),
|
|
2092
|
+
f("app/card.tsx", `export const Quote = () => <blockquote>[Insert testimonial here]</blockquote>;`)
|
|
2093
|
+
],
|
|
2094
|
+
pass: [
|
|
2095
|
+
f("content/home.md", "Manage bookings in [your account](/account)."),
|
|
2096
|
+
f("content/guide.md", 'After 90 days, check your ranking for "[your trade] [your town]" on Google.'),
|
|
2097
|
+
f("content/guide.md", "Send a short message: \u201CThanks for choosing [Business Name]! Leave us a review.\u201D"),
|
|
2098
|
+
f("content/home.md", "Rated 4.9 from 212 Google reviews.")
|
|
2099
|
+
]
|
|
2100
|
+
}
|
|
2101
|
+
},
|
|
2102
|
+
{
|
|
2103
|
+
id: "question-reveal",
|
|
2104
|
+
name: "Staged reveal",
|
|
2105
|
+
generation: 2,
|
|
2106
|
+
severity: "warn",
|
|
2107
|
+
surface: "copy",
|
|
2108
|
+
why: "'The result? Faster growth.', 'What does this mean for you? It means...': the writer asks the reader's question for them and answers it. An infomercial hook, and a favourite of generated copy.",
|
|
2109
|
+
fix: "State the answer: 'Most customers book again within six weeks.'",
|
|
2110
|
+
detect: phrases(QUESTION_REVEAL, quoted),
|
|
2111
|
+
fixtures: {
|
|
2112
|
+
flag: [f("content/home.md", "We rebuilt the booking flow. The result? Twice the bookings."), f("content/home.md", "What does this mean for you? It means fewer missed calls.")],
|
|
2113
|
+
pass: [f("content/faq.md", "How long does a set last? About three weeks with gel."), f("content/home.md", "We rebuilt the booking flow, and bookings doubled in a month.")]
|
|
2114
|
+
}
|
|
2115
|
+
},
|
|
2116
|
+
{
|
|
2117
|
+
id: "inline-label-list",
|
|
2118
|
+
name: "Bold-label bullets",
|
|
2119
|
+
generation: 2,
|
|
2120
|
+
severity: "warn",
|
|
2121
|
+
surface: "copy",
|
|
2122
|
+
why: "'**Speed:** Faster pages' three times in a row: a short label restated in a few words, the list shape generated copy defaults to. A definition list, with a real explanation after each label, is not this.",
|
|
2123
|
+
fix: "Drop the labels and write each bullet as the fact: 'Pages load in under a second'. Keep labels only where they help a reader navigate, as in a specification.",
|
|
2124
|
+
detect: inlineLabelHits,
|
|
2125
|
+
fixtures: {
|
|
2126
|
+
flag: [f("content/home.md", "- **Speed:** Faster pages\n- **Security:** Safer data\n- **Support:** Help when you need it\n")],
|
|
2127
|
+
pass: [
|
|
2128
|
+
f("content/home.md", "- Pages load in under a second\n- Card details never touch our server\n- Support by phone until 8pm\n"),
|
|
2129
|
+
f("content/home.md", "- **Speed:** Faster pages\n- **Security:** Safer data\n"),
|
|
2130
|
+
f("content/guide.md", "- **GDC**: The statutory regulator for all dental professionals.\n- **GCC**: The statutory regulator for chiropractors in the UK.\n- **CQC**: The independent regulator of health and social care in England.\n")
|
|
2131
|
+
]
|
|
2132
|
+
}
|
|
2133
|
+
},
|
|
2134
|
+
{
|
|
2135
|
+
id: "ing-tail",
|
|
2136
|
+
name: "Empty -ing tail",
|
|
2137
|
+
generation: 2,
|
|
2138
|
+
severity: "warn",
|
|
2139
|
+
surface: "copy",
|
|
2140
|
+
why: "'..., ensuring peace of mind', '..., highlighting our commitment': a participle tacked on the end that claims significance and names no mechanism. One of the most common shapes in the Wikipedia guide to AI writing.",
|
|
2141
|
+
fix: "Cut the tail, or replace it with the mechanism: 'so you can drop the car off before work'.",
|
|
2142
|
+
detect: phrases([ING_TAIL], (m) => quoted(m.replace(/^,\s*/, ""))),
|
|
2143
|
+
fixtures: {
|
|
2144
|
+
flag: [
|
|
2145
|
+
f("content/home.md", "Every engineer is Gas Safe registered, ensuring complete peace of mind."),
|
|
2146
|
+
f("app/about.tsx", `export const About = () => <p>We have served Brackley since 2009, highlighting our commitment to the town.</p>;`)
|
|
2147
|
+
],
|
|
2148
|
+
pass: [
|
|
2149
|
+
f("content/home.md", "We open at 7am, so you can drop the car off before work."),
|
|
2150
|
+
f("content/home.md", "Engineers arrive by 9, carrying the parts for most boilers.")
|
|
2151
|
+
]
|
|
2152
|
+
}
|
|
2153
|
+
},
|
|
2154
|
+
{
|
|
2155
|
+
id: "vague-attribution",
|
|
2156
|
+
name: "Unnamed source",
|
|
2157
|
+
generation: 1,
|
|
2158
|
+
severity: "warn",
|
|
2159
|
+
surface: "copy",
|
|
2160
|
+
why: "'Studies show', 'experts agree', 'it is widely known': a claim credited to nobody. A reader cannot check it, and the house proof rule forbids a claim nobody can check.",
|
|
2161
|
+
fix: "Name the source and the number ('A 2023 Which? survey of 2,000 drivers found...') or cut the claim.",
|
|
2162
|
+
detect: phrases(VAGUE_ATTRIBUTION, quoted, (ctx) => ctx.blocks, sourced),
|
|
2163
|
+
fixtures: {
|
|
2164
|
+
flag: [
|
|
2165
|
+
f("content/home.md", "Studies show that regular servicing saves money."),
|
|
2166
|
+
f("content/home.md", "Most experts agree a boiler lasts fifteen years."),
|
|
2167
|
+
f("content/home.md", "It is widely known that gel damages nails.")
|
|
2168
|
+
],
|
|
2169
|
+
pass: [
|
|
2170
|
+
f("content/home.md", "A 2023 Which? survey of 2,000 owners found serviced boilers failed half as often."),
|
|
2171
|
+
f("content/home.md", "BrightLocal's research shows that reviews drive 20% of local ranking."),
|
|
2172
|
+
f("content/home.md", "Research shows 62% of consumers avoid a business with wrong hours.[^7]"),
|
|
2173
|
+
f("content/home.md", "Our customers rate us 4.9 from 212 Google reviews.")
|
|
2174
|
+
]
|
|
2175
|
+
}
|
|
2176
|
+
},
|
|
2177
|
+
{
|
|
2178
|
+
id: "closing-summary",
|
|
2179
|
+
name: "Closing summary",
|
|
2180
|
+
generation: 1,
|
|
2181
|
+
severity: "warn",
|
|
2182
|
+
surface: "copy",
|
|
2183
|
+
why: "'Overall,', 'In conclusion,', 'In short,': a paragraph that announces it is summing up, then restates what the reader has just read.",
|
|
2184
|
+
fix: "Cut the summary. End on the last new fact, or on the next step: 'Book a survey and we'll quote within two days'.",
|
|
2185
|
+
detect: phrases([CLOSING_SUMMARY], (m) => quoted(m.replace(/^[.!?>\s]+/, ""))),
|
|
2186
|
+
fixtures: {
|
|
2187
|
+
flag: [
|
|
2188
|
+
f("content/home.md", "We rewire, test and certify.\n\nOverall, we are the right choice for your home."),
|
|
2189
|
+
f("content/home.md", "Prices start at \xA340. In conclusion, we offer great value.")
|
|
2190
|
+
],
|
|
2191
|
+
pass: [f("content/home.md", "We rewire, test and certify.\n\nBook a survey and we'll quote within two days.")]
|
|
2192
|
+
}
|
|
2193
|
+
},
|
|
2194
|
+
{
|
|
2195
|
+
id: "false-range",
|
|
2196
|
+
name: "False range",
|
|
2197
|
+
generation: 1,
|
|
2198
|
+
severity: "warn",
|
|
2199
|
+
surface: "copy",
|
|
2200
|
+
why: "'From first-time buyers to seasoned investors alike' names two ends of no real scale, to sound as if it covers everyone. It describes nobody.",
|
|
2201
|
+
fix: "Say who you actually serve, or cut it. A real range is fine: 'from 9am to 5pm', 'from small repairs to full rewires'.",
|
|
2202
|
+
detect: phrases(FALSE_RANGE, quoted),
|
|
2203
|
+
fixtures: {
|
|
2204
|
+
flag: [
|
|
2205
|
+
f("content/home.md", "We help clients from first-time buyers to seasoned investors alike."),
|
|
2206
|
+
f("content/home.md", "Everyone from students to retirees loves our cakes.")
|
|
2207
|
+
],
|
|
2208
|
+
pass: [
|
|
2209
|
+
f("content/home.md", "Open from 9am to 5pm, Monday to Saturday."),
|
|
2210
|
+
f("content/home.md", "We take on everything from small repairs to full rewires.")
|
|
2211
|
+
]
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
];
|
|
2215
|
+
|
|
2216
|
+
// src/character/tells/density.ts
|
|
2217
|
+
var DOCUMENT = /\.(md|markdown|mdx|txt|html?)$/i;
|
|
2218
|
+
var MIN_WORDS = 400;
|
|
2219
|
+
var WORD = /[A-Za-z0-9£$€][\w'’£$€%.,-]*/g;
|
|
2220
|
+
var countWords = (text) => (text.match(WORD) ?? []).length;
|
|
2221
|
+
function documents(ctx) {
|
|
2222
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
2223
|
+
for (const block of ctx.blocks) {
|
|
2224
|
+
if (!DOCUMENT.test(block.path) || block.literal) continue;
|
|
2225
|
+
const list = byPath.get(block.path) ?? [];
|
|
2226
|
+
list.push(block);
|
|
2227
|
+
byPath.set(block.path, list);
|
|
2228
|
+
}
|
|
2229
|
+
const docs = [];
|
|
2230
|
+
for (const [path, blocks] of byPath) {
|
|
2231
|
+
const text = blocks.map((b) => withoutHeadings(b.text)).join("\n");
|
|
2232
|
+
const words2 = countWords(text);
|
|
2233
|
+
if (words2 >= MIN_WORDS) docs.push({ path, blocks, words: words2 });
|
|
2234
|
+
}
|
|
2235
|
+
return docs;
|
|
2236
|
+
}
|
|
2237
|
+
var withoutHeadings = (text) => text.replace(/^\s{0,3}#{1,6}\s.*$/gm, "");
|
|
2238
|
+
var allowed = (doc2, floor, per1000) => Math.max(floor, Math.floor(doc2.words * per1000 / 1e3));
|
|
2239
|
+
var thousands = (n) => n.toLocaleString("en-GB");
|
|
2240
|
+
function sentences(doc2) {
|
|
2241
|
+
const out = [];
|
|
2242
|
+
for (const block of doc2.blocks) {
|
|
2243
|
+
const text = withoutHeadings(block.text);
|
|
2244
|
+
for (const para of text.matchAll(/[^\n]+(?:\n(?!\s*\n)[^\n]+)*/g)) {
|
|
2245
|
+
const body = para[0];
|
|
2246
|
+
const start = para.index ?? 0;
|
|
2247
|
+
for (const m of body.matchAll(/[^.!?]+[.!?]+["'’”)]*|[^.!?]+$/g)) {
|
|
2248
|
+
const raw = m[0];
|
|
2249
|
+
const trimmed = raw.trim();
|
|
2250
|
+
if (countWords(trimmed) === 0) continue;
|
|
2251
|
+
const lead = raw.length - raw.trimStart().length;
|
|
2252
|
+
out.push({ text: trimmed.replace(/\s+/g, " "), offset: block.offset + start + (m.index ?? 0) + lead });
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
return out;
|
|
2257
|
+
}
|
|
2258
|
+
var RATES = [
|
|
2259
|
+
{ label: "rather than", pattern: /\brather\s+than\b/i, floor: 4, per1000: 0.9, why: "the document's one move" },
|
|
2260
|
+
{ label: "instead of", pattern: /\binstead\s+of\b/i, floor: 4, per1000: 0.7, why: "the reflex swap once 'rather than' is edited out" },
|
|
2261
|
+
{ label: "actually", pattern: /\bactually\b/i, floor: 2, per1000: 0.35, why: "filler, the sentence means the same without it" },
|
|
2262
|
+
{ label: "properly", pattern: /\bproperly\b/i, floor: 3, per1000: 0.4, why: "filler, the sentence means the same without it" },
|
|
2263
|
+
{ label: "genuinely", pattern: /\bgenuinely\b/i, floor: 1, per1000: 0.2, why: "reaching for sincerity: one is emphasis, two is a tic" },
|
|
2264
|
+
{
|
|
2265
|
+
label: "the single ...est",
|
|
2266
|
+
pattern: /\bthe\s+single\s+(?:\w+est|most|\w+\s+most)\b/i,
|
|
2267
|
+
floor: 1,
|
|
2268
|
+
per1000: 0.15,
|
|
2269
|
+
why: "if three things are the single most important, none is"
|
|
2270
|
+
},
|
|
2271
|
+
{ label: "That is / This is opener", pattern: /^(?:That\s+is|That['’]s|This\s+is)\b/, opener: true, floor: 4, per1000: 0.7, why: "pointing back instead of moving on" },
|
|
2272
|
+
{ label: "Every opener", pattern: /^Every\b/, opener: true, floor: 4, per1000: 0.6, why: "the same sweeping opener, again" },
|
|
2273
|
+
{
|
|
2274
|
+
label: "Worth noting opener",
|
|
2275
|
+
pattern: /^(?:Worth\s+(?:knowing|noting|saying|mentioning|remembering)|It(?:['’]s|\s+is)\s+worth\s+(?:knowing|noting|saying|mentioning|remembering))\b/,
|
|
2276
|
+
opener: true,
|
|
2277
|
+
floor: 3,
|
|
2278
|
+
per1000: 0.5,
|
|
2279
|
+
why: "a hedge that lets a sentence start without committing"
|
|
2280
|
+
},
|
|
2281
|
+
{
|
|
2282
|
+
label: "negation-led opener",
|
|
2283
|
+
pattern: /^(?:None\s+of|Not\s+one|Not\s+a\s+single|Nothing|No\s+one|Nobody|Never)\b/,
|
|
2284
|
+
opener: true,
|
|
2285
|
+
floor: 5,
|
|
2286
|
+
per1000: 1,
|
|
2287
|
+
why: "each earns its place once or twice; at twenty the document has one move"
|
|
2288
|
+
},
|
|
2289
|
+
{
|
|
2290
|
+
label: "participle triad",
|
|
2291
|
+
pattern: /\b[a-z]{3,}ed,\s+[a-z]{3,}ed,?\s+and\s+[a-z]{3,}ed\b/i,
|
|
2292
|
+
floor: 3,
|
|
2293
|
+
per1000: 0.6,
|
|
2294
|
+
why: "'researched, written and referenced' is fine once and a cadence in bulk"
|
|
2295
|
+
}
|
|
2296
|
+
];
|
|
2297
|
+
function rateHits(ctx) {
|
|
2298
|
+
const hits = [];
|
|
2299
|
+
for (const doc2 of documents(ctx)) {
|
|
2300
|
+
const list = sentences(doc2);
|
|
2301
|
+
for (const rate of RATES) {
|
|
2302
|
+
const found = [];
|
|
2303
|
+
const global = new RegExp(rate.pattern.source, rate.pattern.flags.replace("g", "") + "g");
|
|
2304
|
+
for (const s of list) {
|
|
2305
|
+
if (rate.opener) {
|
|
2306
|
+
if (rate.pattern.test(s.text)) found.push(s);
|
|
2307
|
+
} else {
|
|
2308
|
+
const n = (s.text.match(global) ?? []).length;
|
|
2309
|
+
for (let k = 0; k < n; k += 1) found.push(s);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
const limit = allowed(doc2, rate.floor, rate.per1000);
|
|
2313
|
+
if (found.length > limit) {
|
|
2314
|
+
hits.push({
|
|
2315
|
+
path: doc2.path,
|
|
2316
|
+
offset: found[limit].offset,
|
|
2317
|
+
message: `"${rate.label}" ${found.length} times in ${thousands(doc2.words)} words (allows ${limit}): ${rate.why}`,
|
|
2318
|
+
excerpt: found[limit].text.slice(0, 120)
|
|
2319
|
+
});
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
return hits;
|
|
2324
|
+
}
|
|
2325
|
+
function aphorismHits(ctx) {
|
|
2326
|
+
const hits = [];
|
|
2327
|
+
for (const doc2 of documents(ctx)) {
|
|
2328
|
+
const found = [];
|
|
2329
|
+
for (const block of doc2.blocks) {
|
|
2330
|
+
let at = 0;
|
|
2331
|
+
for (const line of withoutHeadings(block.text).split("\n")) {
|
|
2332
|
+
const text = line.trim().replace(/^[-*>]\s+/, "");
|
|
2333
|
+
const parts2 = text.match(/[^.!?]+[.!?]+/g) ?? [];
|
|
2334
|
+
if (parts2.length === 2 && parts2.join("").length >= text.length - 1 && parts2.every((p) => countWords(p) >= 2 && countWords(p) <= 7)) {
|
|
2335
|
+
found.push({ text, offset: block.offset + at + line.indexOf(text.charAt(0)) });
|
|
2336
|
+
}
|
|
2337
|
+
at += line.length + 1;
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
const limit = allowed(doc2, 5, 1.2);
|
|
2341
|
+
if (found.length > limit) {
|
|
2342
|
+
hits.push({
|
|
2343
|
+
path: doc2.path,
|
|
2344
|
+
offset: found[limit].offset,
|
|
2345
|
+
message: `${found.length} two-line aphorisms in ${thousands(doc2.words)} words (allows ${limit}). Keep the one that lands hardest`,
|
|
2346
|
+
excerpt: found[limit].text
|
|
2347
|
+
});
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
return hits;
|
|
2351
|
+
}
|
|
2352
|
+
var CONTRACTION = /\b(?:\w+n['’]t|\w+['’](?:re|ve|ll|m|d)|(?:it|that|there|here|what|who|he|she|let|where)['’]s)\b/gi;
|
|
2353
|
+
function contractionHits(ctx) {
|
|
2354
|
+
const hits = [];
|
|
2355
|
+
for (const doc2 of documents(ctx)) {
|
|
2356
|
+
if (doc2.words < 800) continue;
|
|
2357
|
+
const text = doc2.blocks.map((b) => withoutHeadings(b.text)).join("\n");
|
|
2358
|
+
const count2 = (text.match(CONTRACTION) ?? []).length;
|
|
2359
|
+
const rate = count2 * 1e3 / doc2.words;
|
|
2360
|
+
if (rate < 1) {
|
|
2361
|
+
const first = sentences(doc2)[0];
|
|
2362
|
+
hits.push({
|
|
2363
|
+
path: doc2.path,
|
|
2364
|
+
offset: first?.offset ?? 0,
|
|
2365
|
+
message: `${count2} contraction${count2 === 1 ? "" : "s"} in ${thousands(doc2.words)} words. Prose with none reads stiff; formal legal pages are the exception`
|
|
2366
|
+
});
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
return hits;
|
|
2370
|
+
}
|
|
2371
|
+
function rhythmHits(ctx) {
|
|
2372
|
+
const hits = [];
|
|
2373
|
+
for (const doc2 of documents(ctx)) {
|
|
2374
|
+
const list = sentences(doc2);
|
|
2375
|
+
if (list.length < 40) continue;
|
|
2376
|
+
const lengths = list.map((s) => countWords(s.text));
|
|
2377
|
+
const mean = lengths.reduce((a, b) => a + b, 0) / lengths.length;
|
|
2378
|
+
const sd = Math.sqrt(lengths.reduce((a, b) => a + (b - mean) ** 2, 0) / lengths.length);
|
|
2379
|
+
const cv = sd / mean;
|
|
2380
|
+
if (cv < 0.42) {
|
|
2381
|
+
hits.push({
|
|
2382
|
+
path: doc2.path,
|
|
2383
|
+
offset: list[0].offset,
|
|
2384
|
+
message: `${list.length} sentences averaging ${mean.toFixed(1)} words with little variation (spread ${cv.toFixed(2)}, reads metronomic below 0.42)`
|
|
2385
|
+
});
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
return hits;
|
|
2389
|
+
}
|
|
2390
|
+
var normal = (s) => s.toLowerCase().replace(/[’]/g, "'").match(/[a-z0-9£$€'%]+/g) ?? [];
|
|
2391
|
+
function repeatHits(ctx) {
|
|
2392
|
+
const hits = [];
|
|
2393
|
+
const RUN = 9;
|
|
2394
|
+
for (const doc2 of documents(ctx)) {
|
|
2395
|
+
const whole = /* @__PURE__ */ new Map();
|
|
2396
|
+
const runs = /* @__PURE__ */ new Map();
|
|
2397
|
+
for (const s of sentences(doc2)) {
|
|
2398
|
+
const words2 = normal(s.text);
|
|
2399
|
+
if (words2.length < RUN || !/[.!?]["'’”)]*$/.test(s.text)) continue;
|
|
2400
|
+
const key = words2.join(" ");
|
|
2401
|
+
const earlier = whole.get(key);
|
|
2402
|
+
if (earlier) {
|
|
2403
|
+
hits.push({ path: doc2.path, offset: s.offset, message: `the same sentence appears twice (${words2.length} words)`, excerpt: s.text.slice(0, 120) });
|
|
2404
|
+
continue;
|
|
2405
|
+
}
|
|
2406
|
+
whole.set(key, s);
|
|
2407
|
+
let reported = false;
|
|
2408
|
+
for (let i = 0; i + RUN <= words2.length && !reported; i += 1) {
|
|
2409
|
+
const run = words2.slice(i, i + RUN).join(" ");
|
|
2410
|
+
const seen = runs.get(run);
|
|
2411
|
+
if (seen && seen.key !== key) {
|
|
2412
|
+
hits.push({ path: doc2.path, offset: s.offset, message: `shares a ${RUN}-word run with an earlier sentence: "${run}"`, excerpt: s.text.slice(0, 120) });
|
|
2413
|
+
reported = true;
|
|
2414
|
+
} else if (!seen) {
|
|
2415
|
+
runs.set(run, { sentence: s, key });
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
return hits;
|
|
2421
|
+
}
|
|
2422
|
+
function headings(file) {
|
|
2423
|
+
const out = [];
|
|
2424
|
+
for (const m of file.text.matchAll(/^\s{0,3}#{1,6}\s+(.+?)\s*#*\s*$/gm)) {
|
|
2425
|
+
out.push({ text: m[1], offset: (m.index ?? 0) + m[0].indexOf(m[1]), end: (m.index ?? 0) + m[0].length });
|
|
2426
|
+
}
|
|
2427
|
+
for (const m of file.text.matchAll(/<h[1-6]\b[^>]*>([\s\S]*?)<\/h[1-6]>/gi)) {
|
|
2428
|
+
const text = m[1].replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim();
|
|
2429
|
+
if (text) out.push({ text, offset: (m.index ?? 0) + m[0].indexOf(m[1]), end: (m.index ?? 0) + m[0].length });
|
|
2430
|
+
}
|
|
2431
|
+
return out.sort((a, b) => a.offset - b.offset);
|
|
2432
|
+
}
|
|
2433
|
+
function longFiles(ctx) {
|
|
2434
|
+
const docs = new Map(documents(ctx).map((d) => [d.path, d]));
|
|
2435
|
+
return ctx.files.filter((f4) => docs.has(f4.path)).map((file) => ({ file, doc: docs.get(file.path) }));
|
|
2436
|
+
}
|
|
2437
|
+
var HEADING_SHAPES = [
|
|
2438
|
+
["X, and Y", /^[^,]{2,}, and [^,]{2,}$/i],
|
|
2439
|
+
["X, because Y", /^[^,]{2,}, because [^,]{2,}$/i],
|
|
2440
|
+
["comma list", /^[A-Z][\w'’-]*(?:, [\w'’-]+){2,}(?:,? (?:and|or) [\w'’-]+)?\.?$/]
|
|
2441
|
+
];
|
|
2442
|
+
function headingShapeHits(ctx) {
|
|
2443
|
+
const hits = [];
|
|
2444
|
+
for (const { file, doc: doc2 } of longFiles(ctx)) {
|
|
2445
|
+
const found = [];
|
|
2446
|
+
for (const heading of headings(file)) {
|
|
2447
|
+
const shape = HEADING_SHAPES.find(([, re]) => re.test(heading.text));
|
|
2448
|
+
if (shape) found.push({ heading, shape: shape[0] });
|
|
2449
|
+
}
|
|
2450
|
+
const limit = allowed(doc2, 3, 0.5);
|
|
2451
|
+
if (found.length > limit) {
|
|
2452
|
+
hits.push({
|
|
2453
|
+
path: file.path,
|
|
2454
|
+
offset: found[limit].heading.offset,
|
|
2455
|
+
message: `${found.length} headings share one shape (${[...new Set(found.map((f4) => f4.shape))].join(", ")}), allows ${limit}`,
|
|
2456
|
+
excerpt: found[limit].heading.text
|
|
2457
|
+
});
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
return hits;
|
|
2461
|
+
}
|
|
2462
|
+
function headingEchoHits(ctx) {
|
|
2463
|
+
const hits = [];
|
|
2464
|
+
for (const { file } of longFiles(ctx)) {
|
|
2465
|
+
for (const heading of headings(file)) {
|
|
2466
|
+
const words2 = normal(heading.text);
|
|
2467
|
+
if (words2.length < 4) continue;
|
|
2468
|
+
const after = file.text.slice(heading.end, heading.end + 600).trimStart().replace(/^\s*(?:<\/?(?:p|div|section)\b[^>]*>\s*)*/i, "");
|
|
2469
|
+
const opening = normal(after.split(/\n\s*\n/)[0] ?? "").slice(0, words2.length);
|
|
2470
|
+
if (opening.join(" ") === words2.join(" ")) {
|
|
2471
|
+
hits.push({ path: file.path, offset: heading.offset, message: `the heading "${heading.text}" is repeated as the first words under it` });
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
return hits;
|
|
2476
|
+
}
|
|
2477
|
+
var FILLER_WORDS = "boiler van kitchen garden studio market street window roof tile paint brush ladder hedge lawn fence gate shop counter oven bread flour kettle chair table shelf lamp cable socket switch meter valve pipe tap sink drain gutter brick mortar timber plank screw bolt hinge lock key door frame glass mirror towel basin morning evening winter summer spring autumn monday tuesday friday weekend hour minute week month year fitted checked cleaned painted mended booked quoted delivered collected measured sanded sealed wired local quiet small large early late busy bright warm dry".split(" ");
|
|
2478
|
+
function filler(words2, seed = 1, options = {}) {
|
|
2479
|
+
const { contractions = true, uniform } = options;
|
|
2480
|
+
const shape = [5, 17, 9, 24, 6, 13, 31, 8, 11, 4, 20, 15];
|
|
2481
|
+
let state = seed;
|
|
2482
|
+
const next = (n) => {
|
|
2483
|
+
state = (state * 1103515245 + 12345) % 2147483648;
|
|
2484
|
+
return state % n;
|
|
2485
|
+
};
|
|
2486
|
+
const out = [];
|
|
2487
|
+
let count2 = 0;
|
|
2488
|
+
let i = 0;
|
|
2489
|
+
while (count2 < words2) {
|
|
2490
|
+
const length = uniform ?? shape[i % shape.length];
|
|
2491
|
+
const s = [];
|
|
2492
|
+
for (let w = 0; w < length; w += 1) s.push(FILLER_WORDS[next(FILLER_WORDS.length)]);
|
|
2493
|
+
if (contractions && i % 6 === 2) s.splice(1, 0, "we're");
|
|
2494
|
+
s[0] = s[0].charAt(0).toUpperCase() + s[0].slice(1);
|
|
2495
|
+
out.push(`${s.join(" ")}.`);
|
|
2496
|
+
count2 += s.length;
|
|
2497
|
+
i += 1;
|
|
2498
|
+
}
|
|
2499
|
+
const paragraphs = [];
|
|
2500
|
+
for (let p = 0; p < out.length; p += 4) paragraphs.push(out.slice(p, p + 4).join(" "));
|
|
2501
|
+
return paragraphs.join("\n\n");
|
|
2502
|
+
}
|
|
2503
|
+
var f2 = (path, text) => ({ path, text });
|
|
2504
|
+
var doc = (extra, seed = 1) => `${filler(520, seed)}
|
|
2505
|
+
|
|
2506
|
+
${extra}
|
|
2507
|
+
`;
|
|
2508
|
+
var times = (n, sentence) => Array.from({ length: n }, (_, i) => sentence(i)).join(" ");
|
|
2509
|
+
var DENSITY_TELLS = [
|
|
2510
|
+
{
|
|
2511
|
+
id: "phrase-density",
|
|
2512
|
+
name: "Leaned-on phrase",
|
|
2513
|
+
generation: 2,
|
|
2514
|
+
severity: "warn",
|
|
2515
|
+
surface: "copy",
|
|
2516
|
+
why: "'Rather than', 'actually', 'That is...' openers, participle triads: each is ordinary English once, and a document that uses one far above its rate has one move and repeats it.",
|
|
2517
|
+
fix: "Keep the instances that land hardest and vary or cut the rest. Never delete every one: the count is the problem, not the phrase.",
|
|
2518
|
+
detect: rateHits,
|
|
2519
|
+
fixtures: {
|
|
2520
|
+
flag: [
|
|
2521
|
+
f2("content/proposal.md", doc(times(6, (i) => `We fitted boiler ${i} rather than patching it.`))),
|
|
2522
|
+
f2("content/proposal.md", doc(times(6, (i) => `We sealed roof ${i} instead of patching it.`))),
|
|
2523
|
+
f2("content/proposal.md", doc(times(4, (i) => `Room ${i} actually needed a new valve.`))),
|
|
2524
|
+
f2("content/proposal.md", doc(times(5, (i) => `Gate ${i} was properly hung.`))),
|
|
2525
|
+
f2("content/proposal.md", doc(times(3, (i) => `Kitchen ${i} was genuinely tidy.`))),
|
|
2526
|
+
f2("content/proposal.md", doc(times(3, (i) => `Pipe ${i} is the single biggest risk.`))),
|
|
2527
|
+
f2("content/proposal.md", doc(times(6, (i) => `That is why tap ${i} leaks.`))),
|
|
2528
|
+
f2("content/proposal.md", doc(times(6, (i) => `Every tap ${i} gets checked.`))),
|
|
2529
|
+
f2("content/proposal.md", doc(times(5, (i) => `Worth noting: valve ${i} sticks.`))),
|
|
2530
|
+
f2("content/proposal.md", doc(times(7, (i) => `None of room ${i} needed paint.`))),
|
|
2531
|
+
f2("content/proposal.md", doc(times(5, (i) => `Wall ${i} was measured, sanded and sealed.`))),
|
|
2532
|
+
f2("site/index.html", `<html><body><p>${filler(520, 3)}</p><p>${times(6, (i) => `We fitted boiler ${i} rather than patching it.`)}</p></body></html>`)
|
|
2533
|
+
],
|
|
2534
|
+
pass: [
|
|
2535
|
+
f2("content/proposal.md", doc(times(3, (i) => `We fitted boiler ${i} rather than patching it.`))),
|
|
2536
|
+
f2("content/short.md", times(6, (i) => `We fitted boiler ${i} rather than patching it.`)),
|
|
2537
|
+
f2("app/page.tsx", `export const copy = [${Array.from({ length: 40 }, (_, i) => `"We fitted boiler ${i} rather than patching it."`).join(", ")}];`)
|
|
2538
|
+
]
|
|
2539
|
+
}
|
|
2540
|
+
},
|
|
2541
|
+
{
|
|
2542
|
+
id: "aphorism-density",
|
|
2543
|
+
name: "Aphorism cadence",
|
|
2544
|
+
generation: 2,
|
|
2545
|
+
severity: "warn",
|
|
2546
|
+
surface: "copy",
|
|
2547
|
+
why: "Two clipped sentences alone on a line ('All of this already exists. The job is making it findable.') land once. Closing every section, they are a cadence a reader learns to hear.",
|
|
2548
|
+
fix: "Keep the strongest one. Fold the rest into the paragraph above as plain statements.",
|
|
2549
|
+
detect: aphorismHits,
|
|
2550
|
+
fixtures: {
|
|
2551
|
+
flag: [f2("content/proposal.md", doc(Array.from({ length: 7 }, (_, i) => `The site exists. Job ${i} makes it findable.`).join("\n\n")))],
|
|
2552
|
+
pass: [f2("content/proposal.md", doc(Array.from({ length: 3 }, (_, i) => `The site exists. Job ${i} makes it findable.`).join("\n\n")))]
|
|
2553
|
+
}
|
|
2554
|
+
},
|
|
2555
|
+
{
|
|
2556
|
+
id: "contraction-scarcity",
|
|
2557
|
+
name: "No contractions",
|
|
2558
|
+
generation: 1,
|
|
2559
|
+
severity: "warn",
|
|
2560
|
+
surface: "copy",
|
|
2561
|
+
why: "A long document with almost no contractions reads stiff and machine-made. People write 'we're' and 'don't'.",
|
|
2562
|
+
fix: "Contract where you would in speech: 'we are' to 'we're', 'do not' to 'don't'. Formal legal pages are the deliberate exception.",
|
|
2563
|
+
detect: contractionHits,
|
|
2564
|
+
fixtures: {
|
|
2565
|
+
flag: [f2("content/proposal.md", filler(900, 5, { contractions: false }))],
|
|
2566
|
+
pass: [f2("content/proposal.md", filler(900, 5)), f2("content/short.md", filler(500, 5, { contractions: false }))]
|
|
2567
|
+
}
|
|
2568
|
+
},
|
|
2569
|
+
{
|
|
2570
|
+
id: "sentence-rhythm",
|
|
2571
|
+
name: "Metronomic rhythm",
|
|
2572
|
+
generation: 2,
|
|
2573
|
+
severity: "warn",
|
|
2574
|
+
surface: "copy",
|
|
2575
|
+
why: "Sentence after sentence of the same length reads generated. A person's sentences run long, then short, then long again.",
|
|
2576
|
+
fix: "Break one long sentence in two, join two short ones, and let some sentences be flat and plain.",
|
|
2577
|
+
detect: rhythmHits,
|
|
2578
|
+
fixtures: {
|
|
2579
|
+
flag: [f2("content/proposal.md", filler(600, 7, { uniform: 12 }))],
|
|
2580
|
+
pass: [f2("content/proposal.md", filler(600, 7))]
|
|
2581
|
+
}
|
|
2582
|
+
},
|
|
2583
|
+
{
|
|
2584
|
+
id: "repeated-sentence",
|
|
2585
|
+
name: "Repeated sentence",
|
|
2586
|
+
generation: 1,
|
|
2587
|
+
severity: "warn",
|
|
2588
|
+
surface: "copy",
|
|
2589
|
+
why: "The same sentence on two pages, or the same nine words lightly edited, is one of the strongest signs a document was assembled rather than written.",
|
|
2590
|
+
fix: "Say it once, where it matters most, and write the second place fresh.",
|
|
2591
|
+
detect: repeatHits,
|
|
2592
|
+
fixtures: {
|
|
2593
|
+
flag: [
|
|
2594
|
+
f2("content/proposal.md", doc("We check every valve before the engineer leaves the house.\n\nMore here.\n\nWe check every valve before the engineer leaves the house.")),
|
|
2595
|
+
f2("content/proposal.md", doc("We check every valve before the engineer leaves the house.\n\nBy then we check every valve before the engineer leaves the site."))
|
|
2596
|
+
],
|
|
2597
|
+
pass: [f2("content/proposal.md", doc("We check every valve before the engineer leaves the house.\n\nThe engineer leaves once the customer has signed the sheet."))]
|
|
2598
|
+
}
|
|
2599
|
+
},
|
|
2600
|
+
{
|
|
2601
|
+
id: "heading-shape",
|
|
2602
|
+
name: "One heading shape",
|
|
2603
|
+
generation: 2,
|
|
2604
|
+
severity: "warn",
|
|
2605
|
+
surface: "copy",
|
|
2606
|
+
why: "Headings that all share one shape ('X, and Y', 'X, because Y', 'Keep, rewrite, consolidate, retire') read as a template filled in section by section.",
|
|
2607
|
+
fix: "Write each heading for its section. Most should be a plain noun phrase.",
|
|
2608
|
+
detect: headingShapeHits,
|
|
2609
|
+
fixtures: {
|
|
2610
|
+
flag: [
|
|
2611
|
+
f2("content/proposal.md", ["## Fast, and fairly priced", "## Local, and insured", "## Tidy, and quiet", "## Early, and on time", "", filler(520, 9)].join("\n\n")),
|
|
2612
|
+
f2("site/index.html", `<h2>Fast, because we care</h2><h2>Tidy, because it matters</h2><h2>Early, because you asked</h2><h2>Quiet, because neighbours</h2><p>${filler(520, 9)}</p>`),
|
|
2613
|
+
f2("content/proposal.md", ["## Keep, rewrite, retire", "## Fix, paint, seal", "## Book, quote, fit", "## Plan, build, check", "", filler(520, 9)].join("\n\n"))
|
|
2614
|
+
],
|
|
2615
|
+
pass: [f2("content/proposal.md", ["## Pricing", "## Fast, and fairly priced", "## Who we are", "## Areas we cover", "", filler(520, 9)].join("\n\n"))]
|
|
2616
|
+
}
|
|
2617
|
+
},
|
|
2618
|
+
{
|
|
2619
|
+
id: "heading-echo",
|
|
2620
|
+
name: "Heading echoed",
|
|
2621
|
+
generation: 2,
|
|
2622
|
+
severity: "warn",
|
|
2623
|
+
surface: "copy",
|
|
2624
|
+
why: "A heading repeated word for word as the first line under it spends the reader's attention twice on the same words.",
|
|
2625
|
+
fix: "Let the first sentence say something the heading did not.",
|
|
2626
|
+
detect: headingEchoHits,
|
|
2627
|
+
fixtures: {
|
|
2628
|
+
flag: [
|
|
2629
|
+
f2("content/proposal.md", `## We fix boilers the same day
|
|
2630
|
+
|
|
2631
|
+
We fix boilers the same day across Brackley.
|
|
2632
|
+
|
|
2633
|
+
${filler(520, 11)}`),
|
|
2634
|
+
f2("site/index.html", `<h2>We fix boilers the same day</h2>
|
|
2635
|
+
<p>We fix boilers the same day across Brackley.</p><p>${filler(520, 11)}</p>`)
|
|
2636
|
+
],
|
|
2637
|
+
pass: [f2("content/proposal.md", `## We fix boilers the same day
|
|
2638
|
+
|
|
2639
|
+
Call before noon and an engineer is with you by six.
|
|
2640
|
+
|
|
2641
|
+
${filler(520, 11)}`)]
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
];
|
|
1915
2645
|
|
|
1916
2646
|
// src/character/color.ts
|
|
1917
2647
|
var COLOUR = /#[0-9a-fA-F]{8}\b|#[0-9a-fA-F]{6}\b|#[0-9a-fA-F]{3,4}\b|\b(?:rgba?|hsla?|oklch|oklab)\([^)]*\)|\bcolor\(\s*srgb\b[^)]*\)/g;
|
|
@@ -1932,8 +2662,8 @@ function parts(fn) {
|
|
|
1932
2662
|
function hslToRgb(h, s, l) {
|
|
1933
2663
|
const k = (n) => (n + h / 30) % 12;
|
|
1934
2664
|
const a = s * Math.min(l, 1 - l);
|
|
1935
|
-
const
|
|
1936
|
-
return { r:
|
|
2665
|
+
const f4 = (n) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
|
|
2666
|
+
return { r: f4(0), g: f4(8), b: f4(4) };
|
|
1937
2667
|
}
|
|
1938
2668
|
var clamp012 = (n) => Math.min(1, Math.max(0, n));
|
|
1939
2669
|
function parseColour(raw) {
|
|
@@ -2045,7 +2775,7 @@ function firstMatch(text, pattern) {
|
|
|
2045
2775
|
return m ? m.index : -1;
|
|
2046
2776
|
}
|
|
2047
2777
|
var FRAMEWORK_PALETTE = /^--(?:color-)?(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-\d+$|^--tw-/;
|
|
2048
|
-
var
|
|
2778
|
+
var f3 = (path, text) => ({ path, text });
|
|
2049
2779
|
function familyNames(value) {
|
|
2050
2780
|
return value.split(",").map((v) => v.trim().replace(/^["']|["']$/g, "").trim()).filter(Boolean);
|
|
2051
2781
|
}
|
|
@@ -2510,14 +3240,14 @@ var SOURCE_TELLS = [
|
|
|
2510
3240
|
detect: fontTell(REFLEX_FONTS_1),
|
|
2511
3241
|
fixtures: {
|
|
2512
3242
|
flag: [
|
|
2513
|
-
|
|
3243
|
+
f3("app/layout.tsx", `import { Inter } from "next/font/google";
|
|
2514
3244
|
const inter = Inter({ subsets: ["latin"] });`),
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
3245
|
+
f3("index.html", `<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600" rel="stylesheet">`),
|
|
3246
|
+
f3("tailwind.config.js", `fontFamily: { sans: ["Roboto", "sans-serif"] }`),
|
|
3247
|
+
f3("main.ts", `import "@fontsource/montserrat";`),
|
|
3248
|
+
f3("components/A.tsx", `<p className="font-['Open_Sans']">x</p>`)
|
|
2519
3249
|
],
|
|
2520
|
-
pass: [
|
|
3250
|
+
pass: [f3("app/layout.tsx", `import { Bricolage_Grotesque } from "next/font/google";`)]
|
|
2521
3251
|
}
|
|
2522
3252
|
},
|
|
2523
3253
|
{
|
|
@@ -2530,10 +3260,10 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2530
3260
|
fix: "Pick the display face from the client's world (signage, packaging, the trade's lettering) and record why in art-direction.json. If this face really is the right one, declare an exception with the reason and the evidence.",
|
|
2531
3261
|
detect: fontTell(REFLEX_FONTS_2),
|
|
2532
3262
|
fixtures: {
|
|
2533
|
-
flag: [
|
|
3263
|
+
flag: [f3("src/styles.css", `@theme {
|
|
2534
3264
|
--font-sans: "DM Sans", system-ui, sans-serif;
|
|
2535
3265
|
}`)],
|
|
2536
|
-
pass: [
|
|
3266
|
+
pass: [f3("src/styles.css", `@theme {
|
|
2537
3267
|
--font-sans: "Hanken Grotesk", system-ui, sans-serif;
|
|
2538
3268
|
}`)]
|
|
2539
3269
|
}
|
|
@@ -2549,10 +3279,10 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2549
3279
|
detect: violetHits,
|
|
2550
3280
|
fixtures: {
|
|
2551
3281
|
flag: [
|
|
2552
|
-
|
|
2553
|
-
|
|
3282
|
+
f3("components/Hero.tsx", `<a className="rounded-md bg-indigo-600 px-4 py-2 text-white">Book</a>`),
|
|
3283
|
+
f3("app/globals.css", `:root { --accent: #5a35d1; }`)
|
|
2554
3284
|
],
|
|
2555
|
-
pass: [
|
|
3285
|
+
pass: [f3("components/Hero.tsx", `<a className="rounded-md bg-emerald-700 px-4 py-2 text-white">Book</a>`)]
|
|
2556
3286
|
}
|
|
2557
3287
|
},
|
|
2558
3288
|
{
|
|
@@ -2566,10 +3296,10 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2566
3296
|
detect: gradientHits,
|
|
2567
3297
|
fixtures: {
|
|
2568
3298
|
flag: [
|
|
2569
|
-
|
|
2570
|
-
|
|
3299
|
+
f3("components/Hero.tsx", `<section className="bg-gradient-to-r from-blue-600 to-purple-600">`),
|
|
3300
|
+
f3("app/globals.css", `.hero { background: linear-gradient(135deg, #2563eb, #9333ea); }`)
|
|
2571
3301
|
],
|
|
2572
|
-
pass: [
|
|
3302
|
+
pass: [f3("components/Hero.tsx", `<section className="bg-gradient-to-b from-stone-100 to-stone-200">`)]
|
|
2573
3303
|
}
|
|
2574
3304
|
},
|
|
2575
3305
|
{
|
|
@@ -2583,10 +3313,10 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2583
3313
|
detect: gradientTextHits,
|
|
2584
3314
|
fixtures: {
|
|
2585
3315
|
flag: [
|
|
2586
|
-
|
|
2587
|
-
|
|
3316
|
+
f3("components/Hero.tsx", `<h1 className="bg-gradient-to-r from-rose-500 to-amber-500 bg-clip-text text-transparent">`),
|
|
3317
|
+
f3("app/globals.css", `.headline { -webkit-background-clip: text; color: transparent; }`)
|
|
2588
3318
|
],
|
|
2589
|
-
pass: [
|
|
3319
|
+
pass: [f3("components/Hero.tsx", `<h1 className="font-display text-5xl text-ink">`)]
|
|
2590
3320
|
}
|
|
2591
3321
|
},
|
|
2592
3322
|
{
|
|
@@ -2600,10 +3330,10 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2600
3330
|
detect: glassHits,
|
|
2601
3331
|
fixtures: {
|
|
2602
3332
|
flag: [
|
|
2603
|
-
|
|
2604
|
-
|
|
3333
|
+
f3("components/Hero.tsx", `<div className="rounded-2xl bg-white/10 p-8 backdrop-blur-md">`),
|
|
3334
|
+
f3("app/globals.css", `.card { background: rgb(255 255 255 / .1); backdrop-filter: blur(12px); }`)
|
|
2605
3335
|
],
|
|
2606
|
-
pass: [
|
|
3336
|
+
pass: [f3("components/Hero.tsx", `<div className="rounded-sm bg-paper p-8">`)]
|
|
2607
3337
|
}
|
|
2608
3338
|
},
|
|
2609
3339
|
{
|
|
@@ -2616,10 +3346,10 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2616
3346
|
fix: "Follow the hero with the thing only this business has: the work, the place, the person. Put proof where a doubt arises.",
|
|
2617
3347
|
detect: heroThenProofHits,
|
|
2618
3348
|
fixtures: {
|
|
2619
|
-
flag: [
|
|
3349
|
+
flag: [f3("app/page.tsx", `export default function Page() {
|
|
2620
3350
|
return (<main><Hero /><TrustStrip /><Services /></main>);
|
|
2621
3351
|
}`)],
|
|
2622
|
-
pass: [
|
|
3352
|
+
pass: [f3("app/page.tsx", `export default function Page() {
|
|
2623
3353
|
return (<main><Hero /><Workshop /><TrustStrip /></main>);
|
|
2624
3354
|
}`)]
|
|
2625
3355
|
}
|
|
@@ -2635,7 +3365,7 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2635
3365
|
detect: iconGridHits,
|
|
2636
3366
|
fixtures: {
|
|
2637
3367
|
flag: [
|
|
2638
|
-
|
|
3368
|
+
f3(
|
|
2639
3369
|
"components/Features.tsx",
|
|
2640
3370
|
`import { Heart } from "lucide-react";
|
|
2641
3371
|
<div className="grid grid-cols-1 gap-6 md:grid-cols-3">
|
|
@@ -2643,7 +3373,7 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2643
3373
|
</div>`
|
|
2644
3374
|
)
|
|
2645
3375
|
],
|
|
2646
|
-
pass: [
|
|
3376
|
+
pass: [f3("components/Features.tsx", `<ul className="divide-y">
|
|
2647
3377
|
<li className="flex justify-between py-3">Gel manicure <span>\xA332</span></li>
|
|
2648
3378
|
</ul>`)]
|
|
2649
3379
|
}
|
|
@@ -2658,8 +3388,8 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2658
3388
|
fix: `Keep one gated signature moment per page (STANDARD section 7) and let the rest arrive still. The limit here is ${REVEAL_LIMIT} per scan.`,
|
|
2659
3389
|
detect: revealHits,
|
|
2660
3390
|
fixtures: {
|
|
2661
|
-
flag: [
|
|
2662
|
-
pass: [
|
|
3391
|
+
flag: [f3("app/page.tsx", Array.from({ length: REVEAL_LIMIT + 1 }, (_, i) => `<Reveal><Block n={${i}} /></Reveal>`).join("\n"))],
|
|
3392
|
+
pass: [f3("app/page.tsx", `<Reveal><Signature /></Reveal>
|
|
2663
3393
|
<Block />
|
|
2664
3394
|
<Block />`)]
|
|
2665
3395
|
}
|
|
@@ -2674,8 +3404,8 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2674
3404
|
fix: `Choose the shape language on purpose (and record it), then use the pill only where it means something. The limit here is ${PILL_LIMIT} per scan.`,
|
|
2675
3405
|
detect: pillHits,
|
|
2676
3406
|
fixtures: {
|
|
2677
|
-
flag: [
|
|
2678
|
-
pass: [
|
|
3407
|
+
flag: [f3("components/Tags.tsx", Array.from({ length: PILL_LIMIT + 1 }, () => `<span className="rounded-full px-3">tag</span>`).join("\n"))],
|
|
3408
|
+
pass: [f3("components/Tags.tsx", `<span className="rounded-full px-3">tag</span>
|
|
2679
3409
|
<a className="rounded-sm px-4">Book</a>`)]
|
|
2680
3410
|
}
|
|
2681
3411
|
},
|
|
@@ -2689,8 +3419,8 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2689
3419
|
fix: "Delete the primitives nothing imports. Restyle the ones that stay so they belong to this site.",
|
|
2690
3420
|
detect: shadcnHits,
|
|
2691
3421
|
fixtures: {
|
|
2692
|
-
flag: [SHADCN_PRIMITIVES.slice(0, SHADCN_LIMIT).map((name) =>
|
|
2693
|
-
pass: [
|
|
3422
|
+
flag: [SHADCN_PRIMITIVES.slice(0, SHADCN_LIMIT).map((name) => f3(`src/components/ui/${name}.tsx`, `export function X() { return null; }`))],
|
|
3423
|
+
pass: [f3("src/components/ui/button.tsx", `export function Button() { return null; }`)]
|
|
2694
3424
|
}
|
|
2695
3425
|
},
|
|
2696
3426
|
{
|
|
@@ -2704,11 +3434,11 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2704
3434
|
detect: creamHits,
|
|
2705
3435
|
fixtures: {
|
|
2706
3436
|
flag: [
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
3437
|
+
f3("app/globals.css", `body { background-color: #f5efe6; }`),
|
|
3438
|
+
f3("app/page.tsx", `<main className="bg-cream text-ink">`),
|
|
3439
|
+
f3("app/page.tsx", `<main className="bg-[#f7f1e8]">`)
|
|
2710
3440
|
],
|
|
2711
|
-
pass: [
|
|
3441
|
+
pass: [f3("app/globals.css", `body { background-color: #ffffff; }`)]
|
|
2712
3442
|
}
|
|
2713
3443
|
},
|
|
2714
3444
|
{
|
|
@@ -2722,11 +3452,11 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2722
3452
|
detect: italicSerifHits,
|
|
2723
3453
|
fixtures: {
|
|
2724
3454
|
flag: [
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
3455
|
+
f3("components/Hero.tsx", `<h1 className="font-display text-6xl">Nails, <em>reimagined</em></h1>`),
|
|
3456
|
+
f3("components/Hero.tsx", `<span className="font-serif italic">reimagined</span>`),
|
|
3457
|
+
f3("app/globals.css", `.hero h1 { font-style: italic; }`)
|
|
2728
3458
|
],
|
|
2729
|
-
pass: [
|
|
3459
|
+
pass: [f3("components/Hero.tsx", `<h1 className="font-display text-6xl">Nails in Brackley</h1>
|
|
2730
3460
|
<p><em>Walk-ins</em> welcome.</p>`)]
|
|
2731
3461
|
}
|
|
2732
3462
|
},
|
|
@@ -2741,12 +3471,12 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2741
3471
|
detect: eyebrowChipHits,
|
|
2742
3472
|
fixtures: {
|
|
2743
3473
|
flag: [
|
|
2744
|
-
|
|
3474
|
+
f3("components/Hero.tsx", `<span className="inline-flex rounded-full border px-3 py-1 text-xs">Now booking</span>
|
|
2745
3475
|
<h1>Nails in Brackley</h1>`),
|
|
2746
|
-
|
|
3476
|
+
f3("components/Hero.tsx", `<span className={cn("rounded-full px-3 text-xs", "bg-rose-500/10")}>New</span>
|
|
2747
3477
|
<h1>Nails</h1>`)
|
|
2748
3478
|
],
|
|
2749
|
-
pass: [
|
|
3479
|
+
pass: [f3("components/Hero.tsx", `<h1>Nails in Brackley</h1>
|
|
2750
3480
|
<span className="inline-flex rounded-full border px-3 py-1 text-xs">Tag</span>`)]
|
|
2751
3481
|
}
|
|
2752
3482
|
},
|
|
@@ -2760,9 +3490,9 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2760
3490
|
fix: "Use the client's own marks, photography or numerals. If an icon earns its place, set it inline with the text.",
|
|
2761
3491
|
detect: iconTileStackHits,
|
|
2762
3492
|
fixtures: {
|
|
2763
|
-
flag: [
|
|
3493
|
+
flag: [f3("components/Card.tsx", `import { Sparkles } from "lucide-react";
|
|
2764
3494
|
<div className="flex size-10 items-center justify-center rounded-lg bg-violet-100"><Sparkles /></div>`)],
|
|
2765
|
-
pass: [
|
|
3495
|
+
pass: [f3("components/Card.tsx", `import { Sparkles } from "lucide-react";
|
|
2766
3496
|
<p className="flex items-center gap-2"><Sparkles className="size-4" />Aftercare</p>`)]
|
|
2767
3497
|
}
|
|
2768
3498
|
},
|
|
@@ -2776,8 +3506,8 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2776
3506
|
fix: "Lay content out by what it is. If one item matters most, give it the page, not a double-width tile.",
|
|
2777
3507
|
detect: bentoHits,
|
|
2778
3508
|
fixtures: {
|
|
2779
|
-
flag: [
|
|
2780
|
-
pass: [
|
|
3509
|
+
flag: [f3("components/Features.tsx", `<div className="grid grid-cols-3"><div className="md:col-span-2 md:row-span-2" /><div /></div>`)],
|
|
3510
|
+
pass: [f3("components/Features.tsx", `<div className="grid grid-cols-3"><div className="col-span-2" /><div /></div>`)]
|
|
2781
3511
|
}
|
|
2782
3512
|
},
|
|
2783
3513
|
{
|
|
@@ -2791,10 +3521,10 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2791
3521
|
detect: glowHits,
|
|
2792
3522
|
fixtures: {
|
|
2793
3523
|
flag: [
|
|
2794
|
-
|
|
2795
|
-
|
|
3524
|
+
f3("components/Hero.tsx", `<div className="absolute -top-20 left-1/2 h-96 w-96 rounded-full bg-rose-400/30 blur-3xl" />`),
|
|
3525
|
+
f3("app/globals.css", `.hero { background: radial-gradient(circle at top, rgb(244 63 94 / .25), transparent 60%); }`)
|
|
2796
3526
|
],
|
|
2797
|
-
pass: [
|
|
3527
|
+
pass: [f3("components/Hero.tsx", `<div className="absolute inset-0 bg-black/40" />`)]
|
|
2798
3528
|
}
|
|
2799
3529
|
},
|
|
2800
3530
|
{
|
|
@@ -2808,13 +3538,13 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2808
3538
|
detect: gridBackgroundHits,
|
|
2809
3539
|
fixtures: {
|
|
2810
3540
|
flag: [
|
|
2811
|
-
|
|
3541
|
+
f3(
|
|
2812
3542
|
"app/globals.css",
|
|
2813
3543
|
`.hero { background-image: linear-gradient(to right, #e5e5e5 1px, transparent 1px), linear-gradient(to bottom, #e5e5e5 1px, transparent 1px); background-size: 24px 24px; }`
|
|
2814
3544
|
),
|
|
2815
|
-
|
|
3545
|
+
f3("components/Hero.tsx", `<div className="absolute inset-0 bg-[linear-gradient(to_right,#8882_1px,transparent_1px)] bg-[size:24px_24px]" />`)
|
|
2816
3546
|
],
|
|
2817
|
-
pass: [
|
|
3547
|
+
pass: [f3("app/globals.css", `.hero { background-image: url(/shopfront.avif); }`)]
|
|
2818
3548
|
}
|
|
2819
3549
|
},
|
|
2820
3550
|
{
|
|
@@ -2828,10 +3558,10 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2828
3558
|
detect: marqueeHits,
|
|
2829
3559
|
fixtures: {
|
|
2830
3560
|
flag: [
|
|
2831
|
-
|
|
2832
|
-
|
|
3561
|
+
f3("app/globals.css", `@keyframes marquee { from { transform: translateX(0) } to { transform: translateX(-50%) } }`),
|
|
3562
|
+
f3("components/Logos.tsx", `import Marquee from "react-fast-marquee";`)
|
|
2833
3563
|
],
|
|
2834
|
-
pass: [
|
|
3564
|
+
pass: [f3("app/globals.css", `@keyframes fade { from { opacity: 0 } to { opacity: 1 } }`)]
|
|
2835
3565
|
}
|
|
2836
3566
|
},
|
|
2837
3567
|
{
|
|
@@ -2845,10 +3575,10 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2845
3575
|
detect: thinBorderWideShadowHits,
|
|
2846
3576
|
fixtures: {
|
|
2847
3577
|
flag: [
|
|
2848
|
-
|
|
2849
|
-
|
|
3578
|
+
f3("components/Card.tsx", `<div className="rounded-2xl border border-black/5 bg-white shadow-2xl">`),
|
|
3579
|
+
f3("app/globals.css", `.card { border: 1px solid rgb(0 0 0 / .06); box-shadow: 0 20px 48px rgb(0 0 0 / .08); }`)
|
|
2850
3580
|
],
|
|
2851
|
-
pass: [
|
|
3581
|
+
pass: [f3("components/Card.tsx", `<div className="rounded-sm border border-ink bg-white">`)]
|
|
2852
3582
|
}
|
|
2853
3583
|
},
|
|
2854
3584
|
{
|
|
@@ -2862,15 +3592,61 @@ const inter = Inter({ subsets: ["latin"] });`),
|
|
|
2862
3592
|
detect: introHits,
|
|
2863
3593
|
fixtures: {
|
|
2864
3594
|
flag: [
|
|
2865
|
-
|
|
3595
|
+
f3("components/IntroCinematic.tsx", `const seen = sessionStorage.getItem("intro");
|
|
2866
3596
|
export function IntroCinematic() { return <AnimatePresence /> }`),
|
|
2867
|
-
|
|
3597
|
+
f3("app/page.tsx", `<><Preloader /><Hero /></>`)
|
|
2868
3598
|
],
|
|
2869
|
-
pass: [
|
|
3599
|
+
pass: [f3("components/Introduction.md", `An introduction to the studio.`)]
|
|
2870
3600
|
}
|
|
2871
3601
|
}
|
|
2872
3602
|
];
|
|
2873
3603
|
|
|
3604
|
+
// src/character/house.ts
|
|
3605
|
+
var HOUSE = {
|
|
3606
|
+
"em-dash": { tier: "block", label: "em dash, use a full stop or a comma" },
|
|
3607
|
+
emoji: { tier: "block", label: "emoji" },
|
|
3608
|
+
"not-just-but": { tier: "block", label: "contrastive negation. The template is the tell, not the sentiment. Say the positive claim" },
|
|
3609
|
+
"no-x-no-y": {
|
|
3610
|
+
tier: "block",
|
|
3611
|
+
label: '"No X, no Y" list. Defining the brand by what it is not, itemised, is the same template as contrastive negation'
|
|
3612
|
+
},
|
|
3613
|
+
"no-x-badge": { tier: "block", label: 'standalone "No X" badge. Reads as a slapped-on kicker, and worse when reused across pieces' },
|
|
3614
|
+
"ai-phrase": { tier: "block", label: "AI tell" },
|
|
3615
|
+
"plainer-word": { tier: "block", label: "a plainer word exists. Name the mechanism instead" },
|
|
3616
|
+
"plain-english": { tier: "block", label: 'use "properly explained"' },
|
|
3617
|
+
buzzword: { tier: "block", label: "forbidden phrase" },
|
|
3618
|
+
"negative-reassurance": { tier: "block", label: "negative reassurance, say what they get" },
|
|
3619
|
+
"review-phrase": { tier: "review", label: "review tier" },
|
|
3620
|
+
"ai-vocabulary": { tier: "review", label: "AI vocabulary" },
|
|
3621
|
+
"stock-phrase": { tier: "review", label: "stock phrase" },
|
|
3622
|
+
"hollow-imperative": { tier: "review", label: "hollow imperative" },
|
|
3623
|
+
"rhetorical-opener": { tier: "review", label: "rhetorical question opener" },
|
|
3624
|
+
"staccato-triplet": { tier: "review", label: "staccato triplet" },
|
|
3625
|
+
"where-x-meets-y": { tier: "review", label: "'where X meets Y'" },
|
|
3626
|
+
"ing-tail": { tier: "review", label: "empty -ing tail" },
|
|
3627
|
+
"vague-attribution": { tier: "review", label: "unnamed source" },
|
|
3628
|
+
"closing-summary": { tier: "review", label: "closing summary" },
|
|
3629
|
+
"false-range": { tier: "review", label: "false range" },
|
|
3630
|
+
// The first candidate for block: evidence of a pasted chat reply, not a
|
|
3631
|
+
// matter of style. Blocks once its estate hits have been read (ROADMAP.md).
|
|
3632
|
+
"chatbot-residue": { tier: "review", label: "chatbot residue" },
|
|
3633
|
+
"placeholder": { tier: "review", label: "unfilled placeholder" },
|
|
3634
|
+
"question-reveal": { tier: "review", label: "staged reveal" },
|
|
3635
|
+
"inline-label-list": { tier: "review", label: "bold-label bullets" },
|
|
3636
|
+
"phrase-density": { tier: "review", label: "density" },
|
|
3637
|
+
"aphorism-density": { tier: "review", label: "density" },
|
|
3638
|
+
"contraction-scarcity": { tier: "review", label: "density" },
|
|
3639
|
+
"sentence-rhythm": { tier: "review", label: "density" },
|
|
3640
|
+
"repeated-sentence": { tier: "review", label: "repetition" },
|
|
3641
|
+
"heading-shape": { tier: "review", label: "headings" },
|
|
3642
|
+
"heading-echo": { tier: "review", label: "headings" },
|
|
3643
|
+
// Banned only "when vague", per the rules. Too noisy for a sweep.
|
|
3644
|
+
"vague-word": { tier: "explicit", label: "vague" }
|
|
3645
|
+
};
|
|
3646
|
+
function houseRule(id, name = id) {
|
|
3647
|
+
return HOUSE[id] ?? { tier: "review", label: name };
|
|
3648
|
+
}
|
|
3649
|
+
|
|
2874
3650
|
// src/character/parse.ts
|
|
2875
3651
|
var MARKUP = /\.(tsx|jsx|html?|astro|vue|svelte|mdx)$/i;
|
|
2876
3652
|
var SCRIPT = /\.(ts|js|mjs|cjs)$/i;
|
|
@@ -3335,8 +4111,8 @@ var oklchOf = (value) => parseColour(value)?.oklch ?? null;
|
|
|
3335
4111
|
function reflexFonts(list) {
|
|
3336
4112
|
const wanted = new Map(list.map((n) => [n.toLowerCase(), n]));
|
|
3337
4113
|
return (s) => {
|
|
3338
|
-
const total = s.fonts.reduce((n,
|
|
3339
|
-
const display = s.fonts.reduce((n,
|
|
4114
|
+
const total = s.fonts.reduce((n, f4) => n + f4.chars, 0) || 1;
|
|
4115
|
+
const display = s.fonts.reduce((n, f4) => n + f4.displayChars, 0) || 1;
|
|
3340
4116
|
const hits = [];
|
|
3341
4117
|
const seen = /* @__PURE__ */ new Set();
|
|
3342
4118
|
const h1 = s.headings.find((h) => h.level === 1);
|
|
@@ -3537,8 +4313,8 @@ var RENDERED_PATHS = {
|
|
|
3537
4313
|
};
|
|
3538
4314
|
|
|
3539
4315
|
// src/character/check.ts
|
|
3540
|
-
var CATALOGUE_VERSION = "2026.09.
|
|
3541
|
-
var CATALOGUE = [...SOURCE_TELLS, ...COPY_TELLS].map(
|
|
4316
|
+
var CATALOGUE_VERSION = "2026.09.6";
|
|
4317
|
+
var CATALOGUE = [...SOURCE_TELLS, ...COPY_TELLS, ...RESEARCH_TELLS, ...DENSITY_TELLS].map(
|
|
3542
4318
|
(t) => RENDERED_PATHS[t.id] ? { ...t, rendered: RENDERED_PATHS[t.id] } : t
|
|
3543
4319
|
);
|
|
3544
4320
|
function tellById(id) {
|
|
@@ -3573,7 +4349,8 @@ function toFinding(tell, hit2, texts) {
|
|
|
3573
4349
|
line: texts.has(hit2.path) ? lineAt(text, hit2.offset) : 0,
|
|
3574
4350
|
excerpt: hit2.excerpt ?? excerptAt(text, hit2.offset),
|
|
3575
4351
|
message: hit2.message,
|
|
3576
|
-
fix: tell.fix
|
|
4352
|
+
fix: tell.fix,
|
|
4353
|
+
...tell.surface === "copy" ? { house: houseRule(tell.id, tell.name).tier } : {}
|
|
3577
4354
|
};
|
|
3578
4355
|
}
|
|
3579
4356
|
function report(tells, files, run, options) {
|
|
@@ -3626,6 +4403,10 @@ function report(tells, files, run, options) {
|
|
|
3626
4403
|
}
|
|
3627
4404
|
};
|
|
3628
4405
|
}
|
|
4406
|
+
function applyHouseGate(result) {
|
|
4407
|
+
const findings = result.findings.map((f4) => f4.house === "block" ? { ...f4, severity: "block" } : f4);
|
|
4408
|
+
return { ...result, findings, summary: { ...result.summary, blocking: findings.filter((f4) => f4.severity === "block").length } };
|
|
4409
|
+
}
|
|
3629
4410
|
function scanSource(files, options = {}) {
|
|
3630
4411
|
const ctx = { files: files.map(parseFile) };
|
|
3631
4412
|
const tells = CATALOGUE.filter((t) => t.surface === "source");
|
|
@@ -3685,15 +4466,15 @@ function wordListsJson() {
|
|
|
3685
4466
|
function formatReport(report2, title) {
|
|
3686
4467
|
const lines = [];
|
|
3687
4468
|
let current = "";
|
|
3688
|
-
for (const
|
|
3689
|
-
if (
|
|
3690
|
-
current =
|
|
3691
|
-
lines.push("",
|
|
4469
|
+
for (const f4 of report2.findings) {
|
|
4470
|
+
if (f4.path !== current) {
|
|
4471
|
+
current = f4.path;
|
|
4472
|
+
lines.push("", f4.path);
|
|
3692
4473
|
}
|
|
3693
|
-
lines.push(` ${String(
|
|
3694
|
-
lines.push(` ${
|
|
4474
|
+
lines.push(` ${String(f4.line).padStart(4)} ${f4.tell} (gen ${f4.generation}, ${f4.severity}) ${f4.message}`);
|
|
4475
|
+
lines.push(` ${f4.excerpt}`);
|
|
3695
4476
|
}
|
|
3696
|
-
const fixes = new Map(report2.findings.map((
|
|
4477
|
+
const fixes = new Map(report2.findings.map((f4) => [f4.tell, f4.fix]));
|
|
3697
4478
|
if (fixes.size > 0) {
|
|
3698
4479
|
lines.push("", "What to do instead:");
|
|
3699
4480
|
for (const [tell, fix] of fixes) lines.push(` ${tell}: ${fix}`);
|
|
@@ -3716,6 +4497,87 @@ function formatReport(report2, title) {
|
|
|
3716
4497
|
return lines.join("\n").replace(/^\n/, "");
|
|
3717
4498
|
}
|
|
3718
4499
|
|
|
4500
|
+
// src/character/facts.ts
|
|
4501
|
+
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)?)";
|
|
4502
|
+
var PATTERNS = [
|
|
4503
|
+
["url", /\bhttps?:\/\/[^\s<>"'`)\]]+|\bwww\.[^\s<>"'`)\]]+/gi],
|
|
4504
|
+
["email", /\b[\w.+-]+@[\w-]+(?:\.[\w-]+)+\b/g],
|
|
4505
|
+
["phone", /(?:\+44\s?\(?0?\)?\s?|\b0)\d(?:[\s-]?\d){8,9}\b/g],
|
|
4506
|
+
["postcode", /\b[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}\b/g],
|
|
4507
|
+
["money", /[£$€]\s?\d[\d,]*(?:\.\d{1,2})?(?:\s?(?:k|m|bn)\b)?|\b\d[\d,]*(?:\.\d{1,2})?\s?(?:pounds|GBP)\b/gi],
|
|
4508
|
+
["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")],
|
|
4509
|
+
["time", /\b\d{1,2}(?:[:.]\d{2})?\s?(?:am|pm)\b|\b\d{1,2}:\d{2}\b/gi],
|
|
4510
|
+
["number", /\b\d[\d,]*(?:\.\d+)?%?|\b\d+(?:\.\d+)?\s?(?:per ?cent)\b/gi]
|
|
4511
|
+
];
|
|
4512
|
+
var NAME = /[A-Z][a-zA-Z’'&-]*[a-zA-Z](?:\s+(?:of|and|&|the)?\s*[A-Z][a-zA-Z’'&-]*[a-zA-Z])*/g;
|
|
4513
|
+
var normalise = (kind, value) => {
|
|
4514
|
+
const v = value.trim();
|
|
4515
|
+
if (kind === "phone") return v.replace(/[^\d+]/g, "").replace(/^\+44\(?0?\)?/, "0").replace(/^\+44/, "0");
|
|
4516
|
+
if (kind === "money" || kind === "number") return v.replace(/[\s,]/g, "").toLowerCase();
|
|
4517
|
+
if (kind === "postcode") return v.replace(/\s/g, "").toUpperCase();
|
|
4518
|
+
if (kind === "url") return v.replace(/[.,;:]+$/, "").toLowerCase();
|
|
4519
|
+
return v.replace(/\s+/g, " ").toLowerCase();
|
|
4520
|
+
};
|
|
4521
|
+
function visibleText(file) {
|
|
4522
|
+
const prose = /\.(md|markdown|mdx|txt)$/i.test(file.path);
|
|
4523
|
+
return (prose ? extractCopy(file) : extractStrings(file)).map((b) => b.text).join("\n");
|
|
4524
|
+
}
|
|
4525
|
+
function protectedFacts(text) {
|
|
4526
|
+
const facts = [];
|
|
4527
|
+
let rest = text;
|
|
4528
|
+
const mask = (start, length) => {
|
|
4529
|
+
rest = rest.slice(0, start) + " ".repeat(length) + rest.slice(start + length);
|
|
4530
|
+
};
|
|
4531
|
+
for (const [kind, pattern] of PATTERNS) {
|
|
4532
|
+
for (const m of [...rest.matchAll(pattern)]) {
|
|
4533
|
+
const value = m[0].replace(/[.,;:]+$/, "");
|
|
4534
|
+
facts.push({ kind, value, key: `${kind}:${normalise(kind, value)}` });
|
|
4535
|
+
mask(m.index ?? 0, m[0].length);
|
|
4536
|
+
}
|
|
4537
|
+
}
|
|
4538
|
+
const lines = rest.split("\n");
|
|
4539
|
+
for (const line of lines) {
|
|
4540
|
+
if (/^\s{0,3}#{1,6}\s/.test(line)) continue;
|
|
4541
|
+
for (const m of line.matchAll(NAME)) {
|
|
4542
|
+
const at = m.index ?? 0;
|
|
4543
|
+
const before = line.slice(0, at).trimEnd();
|
|
4544
|
+
const opensSentence = before === "" || /[.!?:"“(>*-]$/.test(before) || /^\s*(?:[-*+]|\d+\.)$/.test(before);
|
|
4545
|
+
const word = m[0];
|
|
4546
|
+
const acronym = /^[A-Z]{2,}$/.test(word);
|
|
4547
|
+
if (opensSentence && !acronym && !/\s/.test(word)) continue;
|
|
4548
|
+
if (word === "I") continue;
|
|
4549
|
+
facts.push({ kind: "name", value: word, key: `name:${normalise("name", word)}` });
|
|
4550
|
+
}
|
|
4551
|
+
}
|
|
4552
|
+
return facts;
|
|
4553
|
+
}
|
|
4554
|
+
var unique = (facts) => [...new Map(facts.map((f4) => [f4.key, f4])).values()];
|
|
4555
|
+
function compareFacts(before, after) {
|
|
4556
|
+
const a = unique(protectedFacts(before));
|
|
4557
|
+
const b = unique(protectedFacts(after));
|
|
4558
|
+
const inA = new Set(a.map((f4) => f4.key));
|
|
4559
|
+
const inB = new Set(b.map((f4) => f4.key));
|
|
4560
|
+
return {
|
|
4561
|
+
before: a.length,
|
|
4562
|
+
after: b.length,
|
|
4563
|
+
lost: a.filter((f4) => !inB.has(f4.key)),
|
|
4564
|
+
added: b.filter((f4) => !inA.has(f4.key))
|
|
4565
|
+
};
|
|
4566
|
+
}
|
|
4567
|
+
function formatComparison(result, beforePath, afterPath) {
|
|
4568
|
+
const lines = [`craft copy compare: ${beforePath} -> ${afterPath}`, ` ${result.before} protected facts before, ${result.after} after`];
|
|
4569
|
+
if (result.lost.length) {
|
|
4570
|
+
lines.push("", ` Lost (${result.lost.length}): restore each, or say why it went`);
|
|
4571
|
+
for (const f4 of result.lost) lines.push(` ${f4.kind.padEnd(9)} ${f4.value}`);
|
|
4572
|
+
}
|
|
4573
|
+
if (result.added.length) {
|
|
4574
|
+
lines.push("", ` Added (${result.added.length}): each needs a source, or it is invented`);
|
|
4575
|
+
for (const f4 of result.added) lines.push(` ${f4.kind.padEnd(9)} ${f4.value}`);
|
|
4576
|
+
}
|
|
4577
|
+
if (!result.lost.length && !result.added.length) lines.push("", " Every fact kept, nothing added.");
|
|
4578
|
+
return lines.join("\n");
|
|
4579
|
+
}
|
|
4580
|
+
|
|
3719
4581
|
// src/fingerprint/index.ts
|
|
3720
4582
|
var FINGERPRINT_VERSION = 1;
|
|
3721
4583
|
var CHROMATIC = 0.03;
|
|
@@ -3851,8 +4713,8 @@ function tellFor(key, value) {
|
|
|
3851
4713
|
}
|
|
3852
4714
|
if (key === "display" || key === "body") {
|
|
3853
4715
|
const name = normaliseFamily(value).toLowerCase();
|
|
3854
|
-
if (REFLEX_FONTS_1.some((
|
|
3855
|
-
if (REFLEX_FONTS_2.some((
|
|
4716
|
+
if (REFLEX_FONTS_1.some((f4) => f4.toLowerCase() === name)) return "reflex-font";
|
|
4717
|
+
if (REFLEX_FONTS_2.some((f4) => f4.toLowerCase() === name)) return "reflex-font-2";
|
|
3856
4718
|
}
|
|
3857
4719
|
return null;
|
|
3858
4720
|
}
|
|
@@ -4219,11 +5081,11 @@ function sharedChoices(target2, runs) {
|
|
|
4219
5081
|
}
|
|
4220
5082
|
return out.sort((a, b) => b.runs - a.runs);
|
|
4221
5083
|
}
|
|
4222
|
-
var REFLEX_1 = new Set(REFLEX_FONTS_1.map((
|
|
4223
|
-
var REFLEX_2 = new Set(REFLEX_FONTS_2.map((
|
|
5084
|
+
var REFLEX_1 = new Set(REFLEX_FONTS_1.map((f4) => f4.toLowerCase()));
|
|
5085
|
+
var REFLEX_2 = new Set(REFLEX_FONTS_2.map((f4) => f4.toLowerCase()));
|
|
4224
5086
|
function knownFor(kind, value, sample) {
|
|
4225
5087
|
if (kind === "face") return REFLEX_1.has(value.toLowerCase()) ? "reflex-font" : REFLEX_2.has(value.toLowerCase()) ? "reflex-font-2" : null;
|
|
4226
|
-
if (kind === "accent" && value === "violet") return sample.some((
|
|
5088
|
+
if (kind === "accent" && value === "violet") return sample.some((f4) => f4.accent && isAiViolet(f4.accent)) ? "ai-violet" : null;
|
|
4227
5089
|
if (kind === "ground" && value === "cream") return "cream-palette";
|
|
4228
5090
|
if (kind === "shape" && value === "pill") return "pill-everything";
|
|
4229
5091
|
if (kind === "motion" && value === "reveals most sections") return "reveal-everywhere";
|
|
@@ -4306,7 +5168,7 @@ function harvest(models, options = {}) {
|
|
|
4306
5168
|
};
|
|
4307
5169
|
runs.forEach((r, i) => {
|
|
4308
5170
|
const c = choicesOf(r.fingerprint);
|
|
4309
|
-
for (const
|
|
5171
|
+
for (const f4 of /* @__PURE__ */ new Set([...c.display, ...c.body])) add("face", f4, i, r.brief);
|
|
4310
5172
|
add("accent", c.accent[0], i, r.brief);
|
|
4311
5173
|
add("ground", c.ground[0], i, r.brief);
|
|
4312
5174
|
add("shape", c.shape[0], i, r.brief);
|
|
@@ -4445,30 +5307,30 @@ var PART_AREA = {
|
|
|
4445
5307
|
};
|
|
4446
5308
|
var DEFAULTS = /^(?:ground )?(?:white|grey)(?: ground)?$|no scroll reveals|no reveals|accent (?:none|neutral)|^no buttons|shape no buttons/;
|
|
4447
5309
|
function designFindings(findings, copyTells) {
|
|
4448
|
-
return (findings?.findings ?? []).filter((
|
|
5310
|
+
return (findings?.findings ?? []).filter((f4) => !copyTells.has(f4.tell));
|
|
4449
5311
|
}
|
|
4450
5312
|
function characterReport(input, copyTells = /* @__PURE__ */ new Set()) {
|
|
4451
5313
|
const actions = [];
|
|
4452
5314
|
const signals = [];
|
|
4453
5315
|
if (input.findings) {
|
|
4454
5316
|
const design = designFindings(input.findings, copyTells);
|
|
4455
|
-
const distinct = [...new Set(design.map((
|
|
5317
|
+
const distinct = [...new Set(design.map((f4) => f4.tell))];
|
|
4456
5318
|
signals.push({
|
|
4457
5319
|
id: "tells",
|
|
4458
5320
|
raised: distinct.length >= TELL_HEAVY,
|
|
4459
5321
|
detail: `${distinct.length} distinct design tell${distinct.length === 1 ? "" : "s"}${distinct.length ? `: ${distinct.join(", ")}` : ""}`
|
|
4460
5322
|
});
|
|
4461
5323
|
const seen = /* @__PURE__ */ new Set();
|
|
4462
|
-
for (const
|
|
4463
|
-
if (seen.has(
|
|
4464
|
-
seen.add(
|
|
4465
|
-
const map = TELL_AREA[
|
|
4466
|
-
const both = design.some((g) => g.tell ===
|
|
4467
|
-
actions.push({ area: map.area, what:
|
|
4468
|
-
}
|
|
4469
|
-
const copy = (input.findings.findings ?? []).filter((
|
|
5324
|
+
for (const f4 of design) {
|
|
5325
|
+
if (seen.has(f4.tell)) continue;
|
|
5326
|
+
seen.add(f4.tell);
|
|
5327
|
+
const map = TELL_AREA[f4.tell] ?? { area: "effects" };
|
|
5328
|
+
const both = design.some((g) => g.tell === f4.tell && g.line === 0) && design.some((g) => g.tell === f4.tell && g.line > 0);
|
|
5329
|
+
actions.push({ area: map.area, what: f4.fix, why: `${f4.name} (${f4.tell}, gen ${f4.generation})${both ? ", in source and on the page" : ""}`, priority: both ? 1 : 2, choice: map.choice });
|
|
5330
|
+
}
|
|
5331
|
+
const copy = (input.findings.findings ?? []).filter((f4) => copyTells.has(f4.tell));
|
|
4470
5332
|
const byTell = /* @__PURE__ */ new Map();
|
|
4471
|
-
for (const
|
|
5333
|
+
for (const f4 of copy) byTell.set(f4.tell, [...byTell.get(f4.tell) ?? [], f4]);
|
|
4472
5334
|
for (const [tell, list] of byTell) {
|
|
4473
5335
|
actions.push({ area: "copy", what: list[0].fix, why: `${list[0].name} (${tell}), ${list.length} place${list.length === 1 ? "" : "s"}, first at ${list[0].path}${list[0].line ? `:${list[0].line}` : ""}`, priority: 3 });
|
|
4474
5336
|
}
|
|
@@ -4533,9 +5395,9 @@ function characterReport(input, copyTells = /* @__PURE__ */ new Set()) {
|
|
|
4533
5395
|
same.priority = Math.min(same.priority, a.priority);
|
|
4534
5396
|
} else merged.push({ ...a });
|
|
4535
5397
|
}
|
|
4536
|
-
const
|
|
4537
|
-
|
|
4538
|
-
return { site: input.site, verdict, summary, signals, actions:
|
|
5398
|
+
const unique2 = merged.filter((a, i) => merged.findIndex((b) => b.area === a.area && b.what === a.what) === i);
|
|
5399
|
+
unique2.sort((a, b) => a.priority - b.priority || order.indexOf(a.area) - order.indexOf(b.area));
|
|
5400
|
+
return { site: input.site, verdict, summary, signals, actions: unique2 };
|
|
4539
5401
|
}
|
|
4540
5402
|
function areaOfShared(part) {
|
|
4541
5403
|
if (/headline|body$/.test(part)) return "type";
|
|
@@ -4626,6 +5488,7 @@ function retrofitPlan(report2, direction) {
|
|
|
4626
5488
|
ESTATE_VERSION,
|
|
4627
5489
|
EXIT_RATIO,
|
|
4628
5490
|
FINGERPRINT_VERSION,
|
|
5491
|
+
HOUSE,
|
|
4629
5492
|
HOUSE_BUDGET,
|
|
4630
5493
|
HOUSE_TYPE,
|
|
4631
5494
|
LIGHTNESS_CURVE,
|
|
@@ -4658,6 +5521,7 @@ function retrofitPlan(report2, direction) {
|
|
|
4658
5521
|
accentFork,
|
|
4659
5522
|
addSite,
|
|
4660
5523
|
apcaContrast,
|
|
5524
|
+
applyHouseGate,
|
|
4661
5525
|
auditSnapshot,
|
|
4662
5526
|
catalogueTable,
|
|
4663
5527
|
characterReport,
|
|
@@ -4665,6 +5529,7 @@ function retrofitPlan(report2, direction) {
|
|
|
4665
5529
|
checkPair,
|
|
4666
5530
|
checkRestraint,
|
|
4667
5531
|
choicesOf,
|
|
5532
|
+
compareFacts,
|
|
4668
5533
|
compareToEstate,
|
|
4669
5534
|
craftTokens,
|
|
4670
5535
|
deltaEOk,
|
|
@@ -4683,11 +5548,13 @@ function retrofitPlan(report2, direction) {
|
|
|
4683
5548
|
fluidSpace,
|
|
4684
5549
|
fluidType,
|
|
4685
5550
|
fontClass,
|
|
5551
|
+
formatComparison,
|
|
4686
5552
|
formatHex,
|
|
4687
5553
|
formatReport,
|
|
4688
5554
|
groundName,
|
|
4689
5555
|
harvest,
|
|
4690
5556
|
hexToOklch,
|
|
5557
|
+
houseRule,
|
|
4691
5558
|
hueName,
|
|
4692
5559
|
hueSwatch,
|
|
4693
5560
|
inP3Gamut,
|
|
@@ -4706,6 +5573,7 @@ function retrofitPlan(report2, direction) {
|
|
|
4706
5573
|
parseColour,
|
|
4707
5574
|
parseHex,
|
|
4708
5575
|
propose,
|
|
5576
|
+
protectedFacts,
|
|
4709
5577
|
ramp,
|
|
4710
5578
|
rampFromAnchors,
|
|
4711
5579
|
retrofitPlan,
|
|
@@ -4724,6 +5592,7 @@ function retrofitPlan(report2, direction) {
|
|
|
4724
5592
|
typeFeatureTokens,
|
|
4725
5593
|
typicality,
|
|
4726
5594
|
validateDirection,
|
|
5595
|
+
visibleText,
|
|
4727
5596
|
wcagContrast,
|
|
4728
5597
|
wordListsJson
|
|
4729
5598
|
});
|