mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-11 21:57:14 +03:00
Hero code scans read index.html when start recorded no artifact; painted-note regex learns 'geometry', 'leader lines', 'thumbnail'
A sol build named its two carburetor drawings 'countable ... geometry' chrome regions, drew them in inline SVG, and the SVG ban never ran because state.artifact was null. AI-assisted (Claude Code).
This commit is contained in:
@@ -581,7 +581,13 @@ export function gateHero(state, { buildPath = HERO_REPRO, specPath = SPEC_PATH,
|
||||
if (otherContradicted.length > Math.max(1, Math.floor(report.regions.length / 3))) reasons.push(`${otherContradicted.length} of ${report.regions.length} regions contradicted: ${otherContradicted.map((r) => r.id).join(', ')}`);
|
||||
// A CSS-drawn organic contour sitting on a raster region's box is the plate
|
||||
// replaced by code, whatever the pixels score.
|
||||
const artifactFile = artifact || state.artifact || null;
|
||||
// A start with --direction records no artifact; the page is still there.
|
||||
// Read index.html (or the one .html at the root) so the code scans run.
|
||||
let artifactFile = artifact || state.artifact || null;
|
||||
if (!artifactFile || !fs.existsSync(artifactFile)) {
|
||||
if (fs.existsSync('index.html')) artifactFile = 'index.html';
|
||||
else { try { const htmls = fs.readdirSync('.').filter((f) => /\.html?$/i.test(f)); if (htmls.length === 1) artifactFile = htmls[0]; } catch { /* leave */ } }
|
||||
}
|
||||
if (artifactFile && fs.existsSync(artifactFile) && specForRefs) {
|
||||
const organic = organicClipRegions(artifactFile, specForRefs);
|
||||
for (const r of organic) reasons.push(`artifact draws an organic clip-path (${r.snippet}) inside raster region ${r.id}'s box; that region ships as its plate, never as a polygon`);
|
||||
|
||||
@@ -88,7 +88,7 @@ function paletteOf(img) {
|
||||
}
|
||||
|
||||
/** Words in a region note that name painted material rather than code-drawn UI. */
|
||||
export const PAINTED_NOTE = /\b(diagram|drawing|drawn|illustration|illustrations|illustrated|figure|schematic|exploded|photo|photos|photograph\w*|picture|painting|painted|render|rendered|rendering|artwork|engraving|etching|linework|line art|texture|textured|textures|grain|fabric|halftone|watercolou?r|sketch|sketched|blueprint|technical geometry|carburetor geometry|product shot|hero image|3d)\b/i;
|
||||
export const PAINTED_NOTE = /\b(diagram|drawing|drawn|illustration|illustrations|illustrated|figure|schematic|exploded|photo|photos|photograph\w*|picture|painting|painted|render|rendered|rendering|artwork|engraving|etching|linework|line art|texture|textured|textures|grain|fabric|halftone|watercolou?r|sketch|sketched|blueprint|geometry|leader lines?|callout lines?|thumbnail|silhouette|product shot|hero image|3d)\b/i;
|
||||
|
||||
/** A text/control/chrome region larger than this fraction of the comp is a column, not an element. */
|
||||
export const MAX_CODE_REGION_AREA = 0.25;
|
||||
|
||||
Reference in New Issue
Block a user