mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-16 08:06:24 +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:
@@ -14,6 +14,13 @@ import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
import { readSourceFiles, parseFrontmatter } from './utils.js';
|
||||
import {
|
||||
DETECTION_LAYERS,
|
||||
VISUAL_EXAMPLES,
|
||||
LLM_ONLY_RULES,
|
||||
} from '../../content/site/anti-patterns-catalog.js';
|
||||
|
||||
export { LAYER_LABELS, LAYER_DESCRIPTIONS } from '../../content/site/anti-patterns-catalog.js';
|
||||
|
||||
/**
|
||||
* Skills that should be excluded from the index and not get a detail page.
|
||||
@@ -33,7 +40,6 @@ const SKILL_CATEGORIES = {
|
||||
// CREATE - build something new
|
||||
impeccable: 'create',
|
||||
shape: 'create',
|
||||
overdrive: 'create',
|
||||
// EVALUATE - review and assess
|
||||
critique: 'evaluate',
|
||||
audit: 'evaluate',
|
||||
@@ -46,6 +52,7 @@ const SKILL_CATEGORIES = {
|
||||
bolder: 'refine',
|
||||
quieter: 'refine',
|
||||
onboard: 'refine',
|
||||
overdrive: 'refine',
|
||||
// SIMPLIFY - reduce and clarify
|
||||
distill: 'simplify',
|
||||
clarify: 'simplify',
|
||||
@@ -191,8 +198,19 @@ export async function buildSubPageData(rootDir) {
|
||||
for (const cat of CATEGORY_ORDER) skillsByCategory[cat] = [];
|
||||
for (const skill of skills) skillsByCategory[skill.category].push(skill);
|
||||
|
||||
// Anti-pattern rules, grouped for the index.
|
||||
const rules = readAntipatternRules(rootDir);
|
||||
// Anti-pattern rules, enriched with catalog metadata and merged with
|
||||
// LLM-only rules from the skill's DON'T list.
|
||||
const detectedRules = readAntipatternRules(rootDir).map((r) => ({
|
||||
...r,
|
||||
layer: DETECTION_LAYERS[r.id] || 'cli',
|
||||
visual: VISUAL_EXAMPLES[r.id] || null,
|
||||
}));
|
||||
const llmRules = LLM_ONLY_RULES.map((r) => ({
|
||||
...r,
|
||||
layer: 'llm',
|
||||
visual: VISUAL_EXAMPLES[r.id] || null,
|
||||
}));
|
||||
const rules = [...detectedRules, ...llmRules];
|
||||
|
||||
// Tutorials: each required file in content/site/tutorials/.
|
||||
const tutorialsDir = path.join(contentDir, 'tutorials');
|
||||
|
||||
Reference in New Issue
Block a user