mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-20 18:16:30 +03:00
Overhaul /anti-patterns with visuals, detection layers, and LLM rules
Three additions to the anti-patterns catalog page, all sourced from a
new content/site/anti-patterns-catalog.js file so the user's parallel
edits to src/detect-antipatterns.mjs don't conflict with display metadata.
1. Detection layer badge per rule. Three layers:
cli - static analysis or jsdom. Runs from `npx impeccable detect`
on files, no browser required. 23 of 25 current rules.
browser - needs real browser layout (getBoundingClientRect).
Runs via the browser extension or Puppeteer, not the
plain CLI. Only 2 rules: cramped-padding and line-length,
as documented in tests/detect-antipatterns-browser.test.mjs.
llm - no deterministic detector. Flagged by /critique's LLM
review pass. 13 rules live only in the skill's DON'T list.
Each card renders a mono pill with the layer label, color-coded per
layer (neutral mist for CLI, blue tint for browser, amber tint for LLM).
The How-to-read legend grows a dl explaining what each layer means.
2. Inline visual example per detected rule. All 25 detection rules get
a ~140px tall preview area at the top of the card showing the bad
pattern as live HTML (cream background, self-contained inline styles).
Visuals for side-tab, gradient-text, dark-glow, nested-cards, and the
rest let you see what the detector is actually flagging. LLM-only
rules ship without visuals for now; their card bodies take the full
card height.
3. LLM-only rules merged into the sections. Parsed out from
source/skills/impeccable/SKILL.md DON'T lines that the detector
doesn't cover: Syne, monospace-as-technical, dark-mode-default,
everything-in-cards, identical-card-grids, hero-metric-layout,
glassmorphism, sparkline-decoration, generic-drop-shadows,
modal-reflex, every-button-primary, redundant-headers,
mobile-amputation. Each renders like a detection rule card but
shows the 'LLM only' layer badge and has no rule id chip. They
slot into the same section groups as detected rules (Interaction
and Responsive sections added to the section order so these get
real headings).
- scripts/lib/sub-pages-data.js: imports the catalog, enriches
detected rules with { layer, visual }, appends LLM_ONLY_RULES with
layer: 'llm'. Re-exports LAYER_LABELS and LAYER_DESCRIPTIONS for
the generator.
- scripts/build-sub-pages.js: renderRuleCard adds the visual block
and the layer badge; LLM rules drop the rule id chip since their id
is just an internal slug. groupRulesBySection now extends the
primary order with whatever extra sections rules reference.
- public/css/sub-pages.css: .rule-card now has a .rule-card-visual
preview area on top with border-bottom, body section below. New
.rule-card-layer pill styling per layer. Layer legend dl using a
2-column grid for badge -> description.
Dev server serves 38 total cards (25 detected + 13 LLM) across 8
sections: Visual Details, Typography, Color & Contrast, Layout & Space,
Motion, Interaction, Responsive, General quality.
This commit is contained in:
+106
-3
@@ -729,13 +729,12 @@ main#main {
|
||||
}
|
||||
|
||||
.rule-card {
|
||||
padding: var(--spacing-md);
|
||||
background: var(--color-paper);
|
||||
border: 1px solid var(--color-mist);
|
||||
border-radius: 8px;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
overflow: hidden;
|
||||
transition: border-color var(--duration-fast) var(--ease-out);
|
||||
}
|
||||
|
||||
@@ -743,12 +742,44 @@ main#main {
|
||||
border-color: var(--color-ash);
|
||||
}
|
||||
|
||||
/* Visual example preview at the top of each card. */
|
||||
.rule-card-visual {
|
||||
position: relative;
|
||||
height: 140px;
|
||||
background: var(--color-cream);
|
||||
border-bottom: 1px solid var(--color-mist);
|
||||
overflow: hidden;
|
||||
/* The inline demo snippets often contain text they don't want to
|
||||
inherit from the card; isolate their context with `all: revert`
|
||||
on children via .rule-card-visual-inner. */
|
||||
}
|
||||
|
||||
.rule-card-visual-inner {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: var(--spacing-md);
|
||||
/* Prevent the inline snippet's styles from bleeding outside the box. */
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.rule-card-body {
|
||||
padding: var(--spacing-md);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.rule-card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--spacing-sm);
|
||||
margin-bottom: 2px;
|
||||
min-height: 18px;
|
||||
}
|
||||
|
||||
.rule-card-id {
|
||||
@@ -761,6 +792,13 @@ main#main {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.rule-card-badges {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.rule-card-category {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.625rem;
|
||||
@@ -781,6 +819,71 @@ main#main {
|
||||
background: var(--color-mist);
|
||||
}
|
||||
|
||||
/* Detection layer badge: CLI, Browser, or LLM only. */
|
||||
.rule-card-layer {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.625rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.1em;
|
||||
padding: 3px 8px;
|
||||
border-radius: 99px;
|
||||
border: 1px solid var(--color-mist);
|
||||
}
|
||||
|
||||
.rule-card-layer[data-layer="cli"] {
|
||||
color: var(--color-charcoal);
|
||||
border-color: var(--color-mist);
|
||||
background: var(--color-paper);
|
||||
}
|
||||
|
||||
.rule-card-layer[data-layer="browser"] {
|
||||
color: oklch(40% 0.12 230);
|
||||
border-color: oklch(90% 0.05 230);
|
||||
background: oklch(97% 0.02 230);
|
||||
}
|
||||
|
||||
.rule-card-layer[data-layer="llm"] {
|
||||
color: oklch(45% 0.15 45);
|
||||
border-color: oklch(92% 0.08 45);
|
||||
background: oklch(98% 0.03 45);
|
||||
}
|
||||
|
||||
/* Layer legend dl inside the How-to-read block. */
|
||||
.anti-patterns-legend-layers {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-sm);
|
||||
margin-top: var(--spacing-md);
|
||||
}
|
||||
|
||||
.anti-patterns-legend-layers > div {
|
||||
display: grid;
|
||||
grid-template-columns: 90px 1fr;
|
||||
gap: var(--spacing-md);
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.anti-patterns-legend-layers dt {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.anti-patterns-legend-layers dd {
|
||||
margin: 0;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.55;
|
||||
color: var(--color-charcoal);
|
||||
}
|
||||
|
||||
.anti-patterns-legend-layers dd code {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.8125rem;
|
||||
background: var(--color-cream);
|
||||
border: 1px solid var(--color-mist);
|
||||
padding: 1px 6px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.rule-card-name {
|
||||
font-family: var(--font-body);
|
||||
font-size: 1rem;
|
||||
|
||||
Reference in New Issue
Block a user