lazycodex-ai 5.1.40 → 5.1.41
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/dist/cli/index.js +38 -15
- package/dist/cli-node/index.js +38 -15
- package/package.json +1 -1
- package/packages/lsp-daemon/dist/cli.js +10 -0
- package/packages/lsp-daemon/dist/client.js +10 -0
- package/packages/lsp-daemon/dist/index.js +10 -0
- package/packages/lsp-tools-mcp/dist/cli.js +10 -0
- package/packages/lsp-tools-mcp/dist/lsp/manager.js +10 -0
- package/packages/lsp-tools-mcp/dist/mcp.js +10 -0
- package/packages/lsp-tools-mcp/dist/tools.js +10 -0
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +16 -0
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +3 -3
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +10 -0
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +12 -12
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +1 -1
- package/packages/omo-codex/plugin/skills/frontend/SKILL.md +6 -6
- package/packages/omo-codex/plugin/skills/frontend/references/design/README.md +2 -2
- package/packages/omo-codex/plugin/skills/frontend/references/perfection/README.md +2 -2
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/declarations.ts +22 -13
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/findings.ts +7 -6
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/lint.ts +18 -24
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/markup.ts +14 -7
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/selector.ts +5 -1
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/tailwind.ts +32 -14
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/check-accent-stripes.ts +1 -1
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/inline-ok.tsx +1 -0
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/neutral-and-flat.css +1 -1
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/tailwind-ok.tsx +5 -2
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/uniform-and-rings.css +2 -2
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/accent-outlines.css +4 -0
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/accent-outlines.tsx +8 -0
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/{negative → positive}/flat-stripe-side.tsx +3 -1
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/report-callouts.html +8 -0
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/square-surfaces.css +8 -0
- package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +10 -2
- package/packages/omo-codex/plugin/skills/ulw-research/references/deliverable-phase.md +10 -0
- package/packages/omo-codex/plugin/skills/ulw-research/references/report-visualization.md +23 -0
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +18 -2
- package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +1 -1
- package/packages/shared-skills/skills/frontend/SKILL.md +6 -6
- package/packages/shared-skills/skills/frontend/references/design/README.md +2 -2
- package/packages/shared-skills/skills/frontend/references/perfection/README.md +2 -2
- package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/declarations.ts +22 -13
- package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/findings.ts +7 -6
- package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/lint.ts +18 -24
- package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/markup.ts +14 -7
- package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/selector.ts +5 -1
- package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/tailwind.ts +32 -14
- package/packages/shared-skills/skills/frontend/scripts/perfection/check-accent-stripes.test.ts +15 -6
- package/packages/shared-skills/skills/frontend/scripts/perfection/check-accent-stripes.ts +1 -1
- package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/inline-ok.tsx +1 -0
- package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/neutral-and-flat.css +1 -1
- package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/tailwind-ok.tsx +5 -2
- package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/uniform-and-rings.css +2 -2
- package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/accent-outlines.css +4 -0
- package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/accent-outlines.tsx +8 -0
- package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/{negative → positive}/flat-stripe-side.tsx +3 -1
- package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/report-callouts.html +8 -0
- package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/square-surfaces.css +8 -0
- package/packages/shared-skills/skills/ulw-research/SKILL.md +10 -2
- package/packages/shared-skills/skills/ulw-research/references/deliverable-phase.md +10 -0
- package/packages/shared-skills/skills/ulw-research/references/report-visualization.md +23 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// omo-codex-install:
|
|
2
|
+
// omo-codex-install:b93c8a23ccfb735feb527d0eb908268e037e0bf2991d36923501d67a335c7f6e:6062641acd173ed604879322dfb8008ad35f96a8286ebc8dfecd7cc90bd35467
|
|
3
3
|
var __esm = (fn, res, err) => () => {
|
|
4
4
|
if (fn)
|
|
5
5
|
try {
|
|
@@ -10036,7 +10036,7 @@ var package_default;
|
|
|
10036
10036
|
var init_package = __esm(() => {
|
|
10037
10037
|
package_default = {
|
|
10038
10038
|
name: "@oh-my-opencode/omo-codex",
|
|
10039
|
-
version: "5.1.
|
|
10039
|
+
version: "5.1.41",
|
|
10040
10040
|
type: "module",
|
|
10041
10041
|
private: true,
|
|
10042
10042
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -19486,6 +19486,19 @@ var OmoHarnessIdSchema = _enum(OMO_CONFIG_HARNESS_IDS);
|
|
|
19486
19486
|
var OMO_CONFIG_LEGACY_HARNESS_ALIASES = { senpi: "native" };
|
|
19487
19487
|
var OMO_CONFIG_LEGACY_HARNESS_IDS = Object.keys(OMO_CONFIG_LEGACY_HARNESS_ALIASES);
|
|
19488
19488
|
|
|
19489
|
+
// packages/omo-config-core/src/schema/memory-agreements.ts
|
|
19490
|
+
var OMO_MEMORY_AGREEMENTS_DEFAULTS = { enabled: true, needs_human_threshold: 3, max_items: 64 };
|
|
19491
|
+
var OmoMemoryAgreementsSchema = object({
|
|
19492
|
+
enabled: boolean2().default(OMO_MEMORY_AGREEMENTS_DEFAULTS.enabled),
|
|
19493
|
+
needs_human_threshold: number2().int().min(1).default(OMO_MEMORY_AGREEMENTS_DEFAULTS.needs_human_threshold),
|
|
19494
|
+
max_items: number2().int().min(8).max(256).default(OMO_MEMORY_AGREEMENTS_DEFAULTS.max_items)
|
|
19495
|
+
}).strict();
|
|
19496
|
+
var OmoMemoryAgreementsLayerSchema = object({
|
|
19497
|
+
enabled: boolean2().optional(),
|
|
19498
|
+
needs_human_threshold: number2().int().min(1).optional(),
|
|
19499
|
+
max_items: number2().int().min(8).max(256).optional()
|
|
19500
|
+
}).strict();
|
|
19501
|
+
|
|
19489
19502
|
// packages/omo-config-core/src/schema/memory.ts
|
|
19490
19503
|
var OmoMemoryReflectionTriggerSchema = object({
|
|
19491
19504
|
step_count: number2().int().nonnegative().default(25),
|
|
@@ -19629,6 +19642,7 @@ var OmoMemoryAgentOverridesSchema = object({
|
|
|
19629
19642
|
facts: OmoMemoryFactsLayerSchema.optional(),
|
|
19630
19643
|
dream: OmoMemoryDreamLayerSchema.optional(),
|
|
19631
19644
|
people: OmoMemoryPeopleLayerSchema.optional(),
|
|
19645
|
+
agreements: OmoMemoryAgreementsLayerSchema.optional(),
|
|
19632
19646
|
soul: OmoMemorySoulLayerSchema.optional(),
|
|
19633
19647
|
write_notice: OmoMemoryWriteNoticeLayerSchema.optional(),
|
|
19634
19648
|
sync: OmoMemorySyncLayerSchema.optional(),
|
|
@@ -19659,6 +19673,7 @@ var OmoMemorySettingsSchema = object({
|
|
|
19659
19673
|
auto_select_max_chars: 150000
|
|
19660
19674
|
}),
|
|
19661
19675
|
people: OmoMemoryPeopleSchema.default({ enabled: true, max_entries: 40, max_entry_chars: 200 }),
|
|
19676
|
+
agreements: OmoMemoryAgreementsSchema.default(OMO_MEMORY_AGREEMENTS_DEFAULTS),
|
|
19662
19677
|
soul: OmoMemorySoulSchema.default({ edit_notice: true }),
|
|
19663
19678
|
write_notice: OmoMemoryWriteNoticeSchema.default({ enabled: true }),
|
|
19664
19679
|
sync: OmoMemorySyncSchema.default({ enabled: true }),
|
|
@@ -19685,6 +19700,7 @@ var OmoMemorySettingsLayerSchema = object({
|
|
|
19685
19700
|
facts: OmoMemoryFactsLayerSchema.optional(),
|
|
19686
19701
|
dream: OmoMemoryDreamLayerSchema.optional(),
|
|
19687
19702
|
people: OmoMemoryPeopleLayerSchema.optional(),
|
|
19703
|
+
agreements: OmoMemoryAgreementsLayerSchema.optional(),
|
|
19688
19704
|
soul: OmoMemorySoulLayerSchema.optional(),
|
|
19689
19705
|
write_notice: OmoMemoryWriteNoticeLayerSchema.optional(),
|
|
19690
19706
|
sync: OmoMemorySyncLayerSchema.optional(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: frontend
|
|
3
|
-
description: "Builds, styles, and polishes web UI
|
|
3
|
+
description: "Builds, styles, and polishes anything drawn with HTML, CSS, or SVG: web UI, pages, components, HTML reports rendered to PDF or print, figures, PNG/SVG diagrams, slides, and images for Notion or Slack. Use for any styling, layout, animation, or visual-quality task, or when asked to make something look or feel a certain way."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Frontend
|
|
@@ -25,12 +25,12 @@ This file is a router, not a rulebook. The rules live in four rulesets under `re
|
|
|
25
25
|
|
|
26
26
|
**For implementation work, design + perfection load together.** Beauty with a 2 MB bundle fails; Lighthouse 100 that looks like AI slop fails. Both win or neither does.
|
|
27
27
|
|
|
28
|
-
## Draft guard — read before the first line of
|
|
28
|
+
## Draft guard — read before the first line of HTML or CSS
|
|
29
29
|
|
|
30
30
|
Some tells regenerate by default, so they are kept out of the first draft rather than left for QA to find.
|
|
31
31
|
|
|
32
|
-
- **No coloured
|
|
33
|
-
- **Lint before visual QA.** Run `bun $SKILL_DIR/scripts/perfection/check-accent-stripes.ts <changed files or dirs>` on every stylesheet and
|
|
32
|
+
- **No coloured bar on one side of a box, rounded or square, and no accent outline on a rounded card, decorative or state.** A card, callout, warning, cover block, stat tile, testimonial, alert, or list row never carries a coloured stripe on one side: `border-left: 4px solid <accent>` or `border-l-4 border-indigo-500`, a coloured `::before`/`::after` bar inside it, an inset `box-shadow` stripe, or a hard-stop gradient band or gradient `border-image` along one edge. A rounded card never wears a 2px-or-wider accent outline either (`border: 2px solid var(--primary)`, `ring-2 ring-indigo-500`, an inset ring). Both read as generated whether they decorate the box or mark it selected, focused, or active, and an accent underline under a heading, tab, or link counts too: use a neutral 1px rule, or set the text itself in the accent ink. Give the card its identity another way: a tonal surface (one ink at a low alpha, or the next step of the surface ramp), an eyebrow or heading set in the accent ink, a leading glyph, or more space between groups. Encode state with one ink at many alphas (hover/selected/active washes), a check glyph for selection, and tonal layering for focus. The coloured edges that stay allowed: keyboard `focus-visible` rings, validation states on form inputs, neutral 1px hairlines and dividers between rows or sections, table rules, and a blockquote's neutral rule. This covers pre-existing instances on any surface you touch.
|
|
33
|
+
- **Lint before visual QA.** Run `bun $SKILL_DIR/scripts/perfection/check-accent-stripes.ts <changed files or dirs>` on every stylesheet, component, and HTML file you wrote, including a report or figure you will print, screenshot, or render to an image. It reads CSS/SCSS/Less, HTML, JSX/TSX, Vue, Svelte, Astro, Tailwind classes (including `@apply` and `cva`/`cn` strings), inline styles, and styled-components. Exit 1 means a stripe is in the draft: remove the stripe, do not argue with the finding.
|
|
34
34
|
|
|
35
35
|
## Design System and Component Workflow
|
|
36
36
|
|
|
@@ -145,7 +145,7 @@ Domains: `product` `style` `typography` `color` `landing` `chart` `ux` `react` `
|
|
|
145
145
|
- **Concrete reference = contract.** When a screenshot, mockup, or annotated reference exists, match its pixels, copy, component structure, and responsive intent unless the user accepts a deviation.
|
|
146
146
|
- **Never weaken UX OR flatten the surface to buy points.** No dropping animations, hiding content, simplifying interactions, or replacing rendered/lit material with flat fills and flat geometric primitives for a Lighthouse score or a deadline. Hit 100 AND keep the surface dimensional — both, or neither.
|
|
147
147
|
- **No emojis as icons.** SVG icon sets only (Lucide, Heroicons, Radix, Phosphor).
|
|
148
|
-
- **No coloured
|
|
148
|
+
- **No coloured edge bars, no accent outlines on cards.** A decorative accent stripe on a callout, rounded or square, and a `border-l-2 border-primary` stripe on a selected row are the same tell, and so is a primary-tinted outline on a focused card. The Draft guard above carries the replacements and the allowed exceptions; `check-accent-stripes.ts` must exit 0 before `/visual-qa`. Applies to code you write AND to pre-existing instances on any surface you touch — sweep them out.
|
|
149
149
|
- **GPU-composited animation only** — `transform`, `opacity`, `filter`; never animate layout properties.
|
|
150
150
|
- **Slop animation is forbidden — motion serves meaning.** Every animation or hover must map to a real interaction, state change, or affordance. A hover that changes nothing, motion on a non-interactive element, or a decorative micro-animation with no informational purpose is slop — do not add it.
|
|
151
151
|
- **Done is the `/visual-qa` gate, not your own glance.** A frontend design task is verified through `/visual-qa` - its HIG-based checklist, its capture matrix (every page and every sibling surface, phone and desktop, light and dark, scrolled-end, motion driven and inspected) and its dual-oracle completion gate on fresh evidence. This skill does not keep its own list of visual checks; the verifier owns it.
|
|
@@ -160,4 +160,4 @@ Domains: `product` `style` `typography` `color` `landing` `chart` `ux` `react` `
|
|
|
160
160
|
|
|
161
161
|
## Activation
|
|
162
162
|
|
|
163
|
-
Use for any frontend, web UI, UX, visual, design, styling, layout, animation, performance, accessibility, or SEO work — building, redesigning, auditing, or generating mockups. Not for backend, CLI, or pure-logic tasks with no visual surface.
|
|
163
|
+
Use for any frontend, web UI, UX, visual, design, styling, layout, animation, performance, accessibility, or SEO work, and for every HTML/CSS/SVG artifact that ends up as a PDF, print page, report, figure, diagram, slide, or image — building, redesigning, auditing, or generating mockups. Not for backend, CLI, or pure-logic tasks with no visual surface.
|
|
@@ -202,7 +202,7 @@ Triggers: an animated, shader, particle, or grid background; a hero that must fe
|
|
|
202
202
|
## Anti-patterns — do not do these
|
|
203
203
|
|
|
204
204
|
- **Don't load nothing and just freestyle.** That produces the exact "generic AI SaaS slop" — purple-blue gradient backgrounds, rounded-2xl-on-everything, three feature cards in a grid, generic Inter font, lorem ipsum. The skills exist precisely to prevent this.
|
|
205
|
-
- **Don't put a coloured
|
|
205
|
+
- **Don't put a coloured bar on one side of a box, rounded or square, or an accent outline on a rounded card, for decoration or for state.** A feature card with `border-top: 4px solid` accent, a callout or cover block with `border-l-4 border-indigo-500`, a stat tile with a coloured `::before` bar, `border-l-2 border-primary` on the selected row, a 2px primary outline on the focused card: each is the generic AI tell. Identity comes from a tonal surface, an eyebrow or heading in the accent ink, a glyph, or spacing; state is ink-alpha washes, a glyph for selection, tonal layering for focus. `focus-visible` rings, input validation states, neutral hairlines, table rules, and a blockquote's neutral rule are the only coloured or ruled edges allowed. Includes pre-existing instances on surfaces you touch.
|
|
206
206
|
- **Don't ignore the user's named brand.** If they say "Linear-style" and you build something that doesn't match Linear's actual aesthetic (purple, ultra-tight spacing, mono accents, etc.), you have failed the routing.
|
|
207
207
|
- **Don't apply a Layer B brand verbatim if the project is not that brand.** The DESIGN.md captures *inspiration* — extract the tokens (palette, type scale, component patterns) and apply them to the project's own content. Do not copy logos or trademarked imagery.
|
|
208
208
|
- **Don't use imagegen skills to write code.** They are explicitly image-only. The agent has been observed trying to "describe" the image as React code — that is the wrong skill, switch to `image-to-code-skill.md` instead.
|
|
@@ -222,7 +222,7 @@ Once references are loaded, before writing any UI code:
|
|
|
222
222
|
8. **All tokens trace back to `DESIGN.md`.** No orphan hex codes, no magic px values. If you need a new token, update `DESIGN.md` first.
|
|
223
223
|
9. **New reusable patterns (used 2+ times) get documented back into `DESIGN.md` Section 5.**
|
|
224
224
|
10. **No generic-default drift (expressive briefs).** The shipped CSS must use the `DESIGN.md` material, not the model's priors. Load the declared fonts (do not silently fall back to Inter or system fonts), build elevated surfaces from the declared multi-layer recipe (not a lone `backdrop-filter: blur`), and color from the ramp stops (not one tint at varied opacity). Grep your styles before QA: finding `Inter`, a single blur on "glass", or one brand hex reused everywhere means you regressed to priors — fix it before declaring done.
|
|
225
|
-
11. **No coloured edge stripes.** Run `bun ../../scripts/perfection/check-accent-stripes.ts <changed files or dirs>` (from this directory; `$SKILL_DIR/scripts/perfection/check-accent-stripes.ts` from anywhere). It must exit 0 before Phase Final; every finding is a decorative or state stripe
|
|
225
|
+
11. **No coloured edge stripes.** Run `bun ../../scripts/perfection/check-accent-stripes.ts <changed files or dirs>` (from this directory; `$SKILL_DIR/scripts/perfection/check-accent-stripes.ts` from anywhere). It must exit 0 before Phase Final; every finding is a decorative or state stripe, or an accent outline, to replace, per the anti-pattern above.
|
|
226
226
|
|
|
227
227
|
## Quick lookup table — most common requests
|
|
228
228
|
|
|
@@ -67,7 +67,7 @@ During the audit loop, after Lighthouse scores pass, run a Design System Complia
|
|
|
67
67
|
- **Spacing**: every margin/padding/gap value must be a multiple of the base unit (4px) and ideally use a declared token.
|
|
68
68
|
- **Components**: any component used 2+ times must be documented in `DESIGN.md` Section 5. If it isn't, add it.
|
|
69
69
|
- **Depth**: if `DESIGN.md` says "borders-only", there must be zero `box-shadow` declarations. If "tonal-shift", zero borders for surface separation.
|
|
70
|
-
- **Accent stripes**: run `bun ../../scripts/perfection/check-accent-stripes.ts <src dirs>`. It flags a coloured one-side border (including a gradient `border-image`), a coloured `::before`/`::after` bar, an inset `box-shadow` stripe, or a hard-stop gradient band along one edge of a rounded
|
|
70
|
+
- **Accent stripes**: run `bun ../../scripts/perfection/check-accent-stripes.ts <src dirs>`. It flags a coloured one-side border (including a gradient `border-image`), a coloured `::before`/`::after` bar, an inset `box-shadow` stripe, or a hard-stop gradient band along one edge of any box, rounded or square, and a 2px-or-wider accent outline (border or inset ring) on a rounded card, in CSS, Tailwind, inline styles, and styled-components, whether the stripe is decorative or marks selected/focused/active. Each finding is a violation — identity belongs to tonal surfaces, headings, glyphs, and spacing; state belongs to ink-alpha washes and glyphs. Keyboard `focus-visible` rings, input validation states, neutral hairlines, table rules, and a blockquote's neutral rule are exempt, and the script already skips them.
|
|
71
71
|
|
|
72
72
|
A page that scores Lighthouse 100 but uses 14 undeclared hex codes and 8 magic spacing values is **NOT DONE**. The design system is the architecture — Lighthouse measures the performance of that architecture.
|
|
73
73
|
|
|
@@ -92,7 +92,7 @@ Quick audit via the cross-platform Python CLI (macOS, Linux, Windows):
|
|
|
92
92
|
uv run $SKILL_DIR/scripts/perfection/lighthouse-audit.py https://localhost:3000
|
|
93
93
|
uv run $SKILL_DIR/scripts/perfection/lighthouse-audit.py https://localhost:3000 --threshold 95
|
|
94
94
|
uv run $SKILL_DIR/scripts/perfection/lighthouse-audit.py https://localhost:3000 --desktop-only
|
|
95
|
-
bun $SKILL_DIR/scripts/perfection/check-accent-stripes.ts src/ # exit 1 = coloured
|
|
95
|
+
bun $SKILL_DIR/scripts/perfection/check-accent-stripes.ts src/ # exit 1 = coloured one-side bar, or accent outline on a rounded card
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
Or use the TypeScript approach directly in your test suite:
|
package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/declarations.ts
CHANGED
|
@@ -72,10 +72,6 @@ function collectEdges(declarations: readonly Declaration[]): Map<Side, Edge> {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
export type Corner = "tl" | "tr" | "br" | "bl"
|
|
75
|
-
export const ALL_CORNERS: ReadonlySet<Corner> = new Set(["tl", "tr", "br", "bl"])
|
|
76
|
-
export const SIDE_CORNERS: Readonly<Record<Side, readonly [Corner, Corner]>> = {
|
|
77
|
-
top: ["tl", "tr"], right: ["tr", "br"], bottom: ["br", "bl"], left: ["tl", "bl"],
|
|
78
|
-
}
|
|
79
75
|
const CORNER_LONGHAND: Readonly<Record<string, Corner>> = {
|
|
80
76
|
"top-left": "tl", "top-right": "tr", "bottom-right": "br", "bottom-left": "bl",
|
|
81
77
|
"start-start": "tl", "start-end": "tr", "end-end": "br", "end-start": "bl",
|
|
@@ -104,20 +100,33 @@ export function roundedCorners(declarations: readonly Declaration[]): Set<Corner
|
|
|
104
100
|
return corners
|
|
105
101
|
}
|
|
106
102
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
const edge = bySide.get(s)
|
|
113
|
-
return edge !== undefined && isStripe(edge) && SIDE_CORNERS[s].some((c) => corners.has(c))
|
|
114
|
-
})
|
|
115
|
-
if (!bent) return false
|
|
103
|
+
const isStripe = (e: Edge) => !e.hidden && (e.width ?? 0) >= MIN_STRIPE_PX && e.color === "chromatic"
|
|
104
|
+
|
|
105
|
+
export function hasEdgeStripe(declarations: readonly Declaration[]): boolean {
|
|
106
|
+
const edges = [...collectEdges(declarations).values()]
|
|
107
|
+
if (!edges.some(isStripe)) return false
|
|
116
108
|
const first = edges[0]
|
|
117
109
|
const uniform = edges.every((e) => e.width === first?.width && e.color === first?.color && e.hidden === first?.hidden)
|
|
118
110
|
return !uniform
|
|
119
111
|
}
|
|
120
112
|
|
|
113
|
+
function isInsetRing(value: string): boolean {
|
|
114
|
+
return splitTopLevel(value, ",").some((layer) => {
|
|
115
|
+
const tokens = splitTopLevel(layer, " ")
|
|
116
|
+
if (!tokens.some((t) => t.toLowerCase() === "inset")) return false
|
|
117
|
+
const [x = 0, y = 0, blur = 0, spread = 0] = tokens.map(parseLength).filter((n): n is number => n !== undefined)
|
|
118
|
+
return x === 0 && y === 0 && blur === 0 && spread >= MIN_STRIPE_PX && tokens.some((t) => looksLikeColor(t) && classifyColor(t) === "chromatic")
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** A uniform accent border (not a gradient border-image) or inset ring of MIN_STRIPE_PX or more. */
|
|
123
|
+
export function hasAccentOutline(declarations: readonly Declaration[]): boolean {
|
|
124
|
+
const image = declarations.some(({ prop }) => prop === "border-image" || prop === "border-image-source")
|
|
125
|
+
const edges = [...collectEdges(declarations).values()]
|
|
126
|
+
const frame = !image && edges.every((e) => isStripe(e) && e.width === edges[0]?.width)
|
|
127
|
+
return frame || declarations.some(({ prop, value }) => prop === "box-shadow" && isInsetRing(value))
|
|
128
|
+
}
|
|
129
|
+
|
|
121
130
|
export function hasRadius(declarations: readonly Declaration[]): boolean {
|
|
122
131
|
return roundedCorners(declarations).size > 0
|
|
123
132
|
}
|
package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/findings.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type RuleId = "edge-stripe" | "pseudo-bar" | "inset-shadow-stripe" | "gradient-stripe"
|
|
1
|
+
export type RuleId = "edge-stripe" | "pseudo-bar" | "inset-shadow-stripe" | "gradient-stripe" | "accent-outline"
|
|
2
2
|
|
|
3
3
|
export type Finding = {
|
|
4
4
|
readonly file: string
|
|
@@ -9,14 +9,15 @@ export type Finding = {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export const RULE_MESSAGES: Readonly<Record<RuleId, string>> = {
|
|
12
|
-
"edge-stripe": "coloured one-side border on a rounded
|
|
13
|
-
"pseudo-bar": "coloured ::before/::after bar
|
|
14
|
-
"inset-shadow-stripe": "inset box-shadow stripe
|
|
15
|
-
"gradient-stripe": "hard-stop gradient band along one edge of a
|
|
12
|
+
"edge-stripe": "coloured one-side border on a box, rounded or square",
|
|
13
|
+
"pseudo-bar": "coloured ::before/::after bar along one side of a box",
|
|
14
|
+
"inset-shadow-stripe": "inset box-shadow stripe along one side of a box",
|
|
15
|
+
"gradient-stripe": "hard-stop gradient band along one edge of a box",
|
|
16
|
+
"accent-outline": "accent-tinted full outline on a rounded card",
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export const FIX_HINT =
|
|
19
|
-
"drop the stripe: separate with a tonal surface (one ink at a low alpha), an eyebrow or heading, a leading glyph, or spacing"
|
|
20
|
+
"drop the stripe or outline: separate with a tonal surface (one ink at a low alpha), an eyebrow or heading, a leading glyph, or spacing"
|
|
20
21
|
|
|
21
22
|
export function lineLocator(text: string): (offset: number) => { line: number; column: number } {
|
|
22
23
|
const starts = [0]
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type CssRule, type Declaration, parseCss } from "./css-parse"
|
|
2
|
-
import {
|
|
2
|
+
import { hasAccentOutline, hasEdgeStripe, hasInsetShadowStripe, hasRadius, isPseudoBar, roundedCorners } from "./declarations"
|
|
3
3
|
import { type Finding, lineLocator, type RuleId } from "./findings"
|
|
4
4
|
import { hasGradientEdgeBand } from "./gradient"
|
|
5
5
|
import { classGroups, cssTemplates, inlineStyles, styleBlocks } from "./markup"
|
|
6
|
-
import { type Compound, compoundCovers, isExemptSelector, parseCompound, selectorParts } from "./selector"
|
|
6
|
+
import { type Compound, compoundCovers, isExemptSelector, isExemptTag, parseCompound, selectorParts } from "./selector"
|
|
7
7
|
import { checkClassSet } from "./tailwind"
|
|
8
8
|
|
|
9
9
|
export type SourceFile = { readonly path: string; readonly text: string }
|
|
@@ -25,18 +25,14 @@ function radiusIndex(rules: readonly CssRule[]): Compound[] {
|
|
|
25
25
|
return rules.filter(ruleHasRadius).flatMap((r) => selectorParts(r.selector).map(parseCompound))
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (hasRadius(rule.declarations)) return roundedCorners(rule.declarations)
|
|
33
|
-
if (ruleHasRadius(rule)) return ALL_CORNERS
|
|
34
|
-
}
|
|
35
|
-
const host = parseCompound(part.replace(/::?(before|after)\b/gi, ""))
|
|
36
|
-
return index.some((general) => compoundCovers(general, host)) ? ALL_CORNERS : NO_CORNERS
|
|
28
|
+
function isRoundedHost(part: string, rule: CssRule, index: readonly Compound[]): boolean {
|
|
29
|
+
if (ruleHasRadius(rule)) return true
|
|
30
|
+
const host = parseCompound(part)
|
|
31
|
+
return index.some((general) => compoundCovers(general, host))
|
|
37
32
|
}
|
|
38
33
|
|
|
39
34
|
const EDGE_PROP = /^border(?:-(?:top|right|bottom|left|block|inline|width|color|image)(?:-[\w-]+)?)?$/
|
|
35
|
+
const OUTLINE_PROP = /^(?:border(?:-width|-color)?|box-shadow)$/
|
|
40
36
|
const BACKGROUND_PROP = /^background(?:-color|-image)?$/
|
|
41
37
|
|
|
42
38
|
function declarationOffset(declarations: readonly Declaration[], prop: RegExp, fallback: number): number {
|
|
@@ -45,9 +41,10 @@ function declarationOffset(declarations: readonly Declaration[], prop: RegExp, f
|
|
|
45
41
|
|
|
46
42
|
type Hit = { readonly id: RuleId; readonly offset: number }
|
|
47
43
|
|
|
48
|
-
function declarationHits(declarations: readonly Declaration[],
|
|
44
|
+
function declarationHits(declarations: readonly Declaration[], rounded: boolean, fallback: number): Hit[] {
|
|
49
45
|
const hits: Hit[] = []
|
|
50
|
-
if (hasEdgeStripe(declarations
|
|
46
|
+
if (hasEdgeStripe(declarations)) hits.push({ id: "edge-stripe", offset: declarationOffset(declarations, EDGE_PROP, fallback) })
|
|
47
|
+
else if (rounded && hasAccentOutline(declarations)) hits.push({ id: "accent-outline", offset: declarationOffset(declarations, OUTLINE_PROP, fallback) })
|
|
51
48
|
if (hasInsetShadowStripe(declarations)) hits.push({ id: "inset-shadow-stripe", offset: declarationOffset(declarations, /^box-shadow$/, fallback) })
|
|
52
49
|
if (hasGradientEdgeBand(declarations)) hits.push({ id: "gradient-stripe", offset: declarationOffset(declarations, BACKGROUND_PROP, fallback) })
|
|
53
50
|
return hits
|
|
@@ -57,17 +54,14 @@ function checkRule(rule: CssRule, index: readonly Compound[]): Hit[] {
|
|
|
57
54
|
const found = new Map<RuleId, number>()
|
|
58
55
|
const add = (hit: Hit) => found.set(hit.id, found.get(hit.id) ?? hit.offset)
|
|
59
56
|
for (const part of selectorParts(rule.selector)) {
|
|
60
|
-
|
|
61
|
-
if (corners.size === 0) continue
|
|
57
|
+
if (isExemptSelector(part)) continue
|
|
62
58
|
if (parseCompound(part).pseudoElement) {
|
|
63
59
|
if (isPseudoBar(rule.declarations)) add({ id: "pseudo-bar", offset: declarationOffset(rule.declarations, BACKGROUND_PROP, rule.offset) })
|
|
64
60
|
continue
|
|
65
61
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
for (const id of checkClassSet(
|
|
69
|
-
add({ id, offset: rule.applyOffset ?? rule.offset })
|
|
70
|
-
}
|
|
62
|
+
const rounded = isRoundedHost(part, rule, index)
|
|
63
|
+
declarationHits(rule.declarations, rounded, rule.offset).forEach(add)
|
|
64
|
+
for (const id of checkClassSet(rule.applyClasses, rounded)) add({ id, offset: rule.applyOffset ?? rule.offset })
|
|
71
65
|
}
|
|
72
66
|
return [...found].map(([id, offset]) => ({ id, offset }))
|
|
73
67
|
}
|
|
@@ -97,13 +91,13 @@ export function lintFiles(files: readonly SourceFile[]): Finding[] {
|
|
|
97
91
|
}
|
|
98
92
|
if (STYLESHEET.test(file.path)) continue
|
|
99
93
|
for (const group of classGroups(file.text, SCRIPT.test(file.path))) {
|
|
94
|
+
if (isExemptTag(group.tag)) continue
|
|
100
95
|
for (const id of checkClassSet(group.tokens)) report(group.offset, id)
|
|
101
96
|
}
|
|
102
97
|
for (const style of inlineStyles(file.text)) {
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
for (const hit of declarationHits(style.declarations, corners, style.offset)) report(style.offset, hit.id)
|
|
98
|
+
if (isExemptTag(style.tag)) continue
|
|
99
|
+
const rounded = style.tagRounded || roundedCorners(style.declarations).size > 0
|
|
100
|
+
for (const hit of declarationHits(style.declarations, rounded, style.offset)) report(style.offset, hit.id)
|
|
107
101
|
}
|
|
108
102
|
}
|
|
109
103
|
return findings.sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line || a.column - b.column)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Declaration } from "./css-parse"
|
|
2
2
|
import { looksLikeClassList } from "./tailwind"
|
|
3
3
|
|
|
4
|
-
export type ClassGroup = { readonly tokens: readonly string[]; readonly offset: number }
|
|
5
|
-
export type InlineStyle = { readonly declarations: readonly Declaration[]; readonly offset: number; readonly tagRounded: boolean }
|
|
4
|
+
export type ClassGroup = { readonly tokens: readonly string[]; readonly offset: number; readonly tag: string }
|
|
5
|
+
export type InlineStyle = { readonly declarations: readonly Declaration[]; readonly offset: number; readonly tagRounded: boolean; readonly tag: string }
|
|
6
6
|
export type StyleBlock = { readonly css: string; readonly offset: number }
|
|
7
7
|
|
|
8
8
|
const UNITLESS = new Set(["opacity", "z-index", "flex", "flex-grow", "flex-shrink", "font-weight", "line-height", "order"])
|
|
@@ -51,6 +51,13 @@ function stripInterpolation(literal: string): string {
|
|
|
51
51
|
return literal.replace(/\$\{[^}]*\}/g, " ")
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/** Name of the element whose open tag contains `offset` ("" outside a tag, e.g. a cva string). */
|
|
55
|
+
function tagNameAt(text: string, offset: number): string {
|
|
56
|
+
const open = text.lastIndexOf("<", offset)
|
|
57
|
+
if (open < 0 || text.slice(open, offset).includes(">")) return ""
|
|
58
|
+
return /^<([A-Za-z][\w.-]*)/.exec(text.slice(open))?.[1] ?? ""
|
|
59
|
+
}
|
|
60
|
+
|
|
54
61
|
function tokensOf(text: string): string[] {
|
|
55
62
|
return text.split(/\s+/).filter(Boolean)
|
|
56
63
|
}
|
|
@@ -83,11 +90,11 @@ export function classGroups(text: string, scanLiterals: boolean): ClassGroup[] {
|
|
|
83
90
|
if (ch === '"' || ch === "'") {
|
|
84
91
|
const close = text.indexOf(ch, start + 1)
|
|
85
92
|
if (close < 0) continue
|
|
86
|
-
groups.push({ tokens: tokensOf(text.slice(start + 1, close)), offset: start })
|
|
93
|
+
groups.push({ tokens: tokensOf(text.slice(start + 1, close)), offset: start, tag: tagNameAt(text, start) })
|
|
87
94
|
covered.push([start, close])
|
|
88
95
|
} else if (ch === "{") {
|
|
89
96
|
const { end, literals } = readBalanced(text, start)
|
|
90
|
-
groups.push({ tokens: literals.flatMap(tokensOf), offset: start })
|
|
97
|
+
groups.push({ tokens: literals.flatMap(tokensOf), offset: start, tag: tagNameAt(text, start) })
|
|
91
98
|
covered.push([start, end])
|
|
92
99
|
}
|
|
93
100
|
}
|
|
@@ -96,7 +103,7 @@ export function classGroups(text: string, scanLiterals: boolean): ClassGroup[] {
|
|
|
96
103
|
const offset = m.index ?? 0
|
|
97
104
|
if (covered.some(([a, b]) => offset >= a && offset <= b)) continue
|
|
98
105
|
const body = stripInterpolation(m[2] ?? "")
|
|
99
|
-
if (looksLikeClassList(body)) groups.push({ tokens: tokensOf(body), offset })
|
|
106
|
+
if (looksLikeClassList(body)) groups.push({ tokens: tokensOf(body), offset, tag: "" })
|
|
100
107
|
}
|
|
101
108
|
return groups
|
|
102
109
|
}
|
|
@@ -136,13 +143,13 @@ export function inlineStyles(text: string): InlineStyle[] {
|
|
|
136
143
|
for (const m of text.matchAll(/\bstyle\s*=\s*\{\{([\s\S]*?)\}\}/g)) {
|
|
137
144
|
const offset = m.index ?? 0
|
|
138
145
|
const end = offset + m[0].length
|
|
139
|
-
styles.push({ declarations: objectDeclarations(m[1] ?? ""), offset, tagRounded: tagIsRounded(text, offset, end) })
|
|
146
|
+
styles.push({ declarations: objectDeclarations(m[1] ?? ""), offset, tagRounded: tagIsRounded(text, offset, end), tag: tagNameAt(text, offset) })
|
|
140
147
|
}
|
|
141
148
|
for (const m of text.matchAll(/\bstyle\s*=\s*(["'])([\s\S]*?)\1/g)) {
|
|
142
149
|
const offset = m.index ?? 0
|
|
143
150
|
const body = (m[2] ?? "").trim()
|
|
144
151
|
const declarations = body.startsWith("{") ? objectDeclarations(body) : cssDeclarations(body)
|
|
145
|
-
styles.push({ declarations, offset, tagRounded: tagIsRounded(text, offset, offset + m[0].length) })
|
|
152
|
+
styles.push({ declarations, offset, tagRounded: tagIsRounded(text, offset, offset + m[0].length), tag: tagNameAt(text, offset) })
|
|
146
153
|
}
|
|
147
154
|
return styles
|
|
148
155
|
}
|
package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/selector.ts
CHANGED
|
@@ -27,9 +27,13 @@ export function parseCompound(part: string): Compound {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
export function isExemptTag(tag: string): boolean {
|
|
31
|
+
return EXEMPT_TAGS.has(tag.toLowerCase())
|
|
32
|
+
}
|
|
33
|
+
|
|
30
34
|
export function isExemptSelector(part: string): boolean {
|
|
31
35
|
if (EXEMPT_STATE.test(part)) return true
|
|
32
|
-
return
|
|
36
|
+
return isExemptTag(parseCompound(part).tag)
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
export function selectorParts(selector: string): string[] {
|
package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/tailwind.ts
CHANGED
|
@@ -43,11 +43,15 @@ const SIDE_TOUCHES: Readonly<Record<string, readonly Corner[]>> = {
|
|
|
43
43
|
}
|
|
44
44
|
const ALL: readonly Corner[] = ["tl", "tr", "br", "bl"]
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return (width
|
|
46
|
+
const SIDE = /^(?:[tlrbsexy]|bs|be)-/
|
|
47
|
+
|
|
48
|
+
function isWide(width: string | undefined): boolean {
|
|
49
|
+
if (!width) return false
|
|
50
|
+
return ((/^\d+$/.test(width) ? Number.parseInt(width, 10) : arbitraryPx(width)) ?? 0) >= MIN_STRIPE_PX
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function isWideSide(util: string): boolean {
|
|
54
|
+
return isWide(/^border-(?:[tlrbsexy]|bs|be)-(\d+|\[[^\]]+\])$/.exec(util)?.[1])
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
function roundedCorners(utils: readonly string[]): Set<Corner> {
|
|
@@ -65,14 +69,30 @@ function roundedCorners(utils: readonly string[]): Set<Corner> {
|
|
|
65
69
|
return corners
|
|
66
70
|
}
|
|
67
71
|
|
|
68
|
-
function
|
|
69
|
-
const m = /^border(?:-(?:[tlrbsexy]|bs|be))?-(.+)$/.exec(util)
|
|
70
|
-
const fragment = m?.[1]
|
|
72
|
+
function colorIsChromatic(fragment: string | undefined): boolean {
|
|
71
73
|
if (!fragment || BORDER_STYLE.has(fragment) || /^\d+$/.test(fragment)) return false
|
|
72
74
|
if (fragment.startsWith("[") && arbitraryPx(fragment) !== undefined) return false
|
|
73
75
|
return classifyUtilityColor(fragment) === "chromatic"
|
|
74
76
|
}
|
|
75
77
|
|
|
78
|
+
function borderColorIsChromatic(util: string): boolean {
|
|
79
|
+
return colorIsChromatic(/^border(?:-(?:[tlrbsexy]|bs|be))?-(.+)$/.exec(util)?.[1])
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function hasOutline(utils: readonly string[]): boolean {
|
|
83
|
+
const border = utils.some((u) => isWide(/^border-(\d+|\[[^\]]+\])$/.exec(u)?.[1]))
|
|
84
|
+
const borderColor = utils.some((u) => {
|
|
85
|
+
const fragment = /^border-(.+)$/.exec(u)?.[1]
|
|
86
|
+
return fragment !== undefined && !SIDE.test(fragment) && colorIsChromatic(fragment)
|
|
87
|
+
})
|
|
88
|
+
const ring = utils.some((u) => isWide(/^ring-(\d+|\[[^\]]+\])$/.exec(u)?.[1]))
|
|
89
|
+
const ringColor = utils.some((u) => {
|
|
90
|
+
const fragment = /^ring-(.+)$/.exec(u)?.[1]
|
|
91
|
+
return fragment !== undefined && !/^(?:inset|offset-)/.test(fragment) && colorIsChromatic(fragment)
|
|
92
|
+
})
|
|
93
|
+
return (border && borderColor) || (ring && ringColor)
|
|
94
|
+
}
|
|
95
|
+
|
|
76
96
|
function thinBar(utils: readonly string[], axis: "w" | "h"): boolean {
|
|
77
97
|
return utils.some((u) => {
|
|
78
98
|
const m = new RegExp(`^${axis}-(px|0\\.5|1|1\\.5|2|\\[[^\\]]+\\])$`).exec(u)
|
|
@@ -93,14 +113,12 @@ function isPseudoBar(utils: readonly string[]): boolean {
|
|
|
93
113
|
return chromaticBg && ((thinBar(utils, "w") && longBar(utils, "h")) || (thinBar(utils, "h") && longBar(utils, "w")))
|
|
94
114
|
}
|
|
95
115
|
|
|
96
|
-
export function checkClassSet(tokens: readonly string[]): RuleId[] {
|
|
116
|
+
export function checkClassSet(tokens: readonly string[], hostRounded = false): RuleId[] {
|
|
97
117
|
const utilities = tokens.map(toUtility).filter((u): u is Utility => u !== undefined)
|
|
98
118
|
const base = utilities.filter((u) => u.layer === "base").map((u) => u.util)
|
|
99
|
-
const corners = roundedCorners(base)
|
|
100
|
-
if (corners.size === 0) return []
|
|
101
119
|
const found: RuleId[] = []
|
|
102
|
-
|
|
103
|
-
if (
|
|
120
|
+
if (base.some(isWideSide) && base.some(borderColorIsChromatic)) found.push("edge-stripe")
|
|
121
|
+
else if ((hostRounded || roundedCorners(base).size > 0) && hasOutline(base)) found.push("accent-outline")
|
|
104
122
|
const shadows = base.filter((u) => u.startsWith("shadow-[") && u.endsWith("]"))
|
|
105
123
|
if (shadows.some((u) => isInsetShadowStripe(u.slice("shadow-[".length, -1).replace(/_/g, " ")))) {
|
|
106
124
|
found.push("inset-shadow-stripe")
|
|
@@ -113,5 +131,5 @@ export function checkClassSet(tokens: readonly string[]): RuleId[] {
|
|
|
113
131
|
}
|
|
114
132
|
|
|
115
133
|
export function looksLikeClassList(text: string): boolean {
|
|
116
|
-
return /(?:^|\s)(?:[\w-]+:)*rounded/.test(text)
|
|
134
|
+
return /(?:^|\s)(?:[\w-]+:)*(?:rounded|border-|ring-|shadow-\[|(?:before|after):)/.test(text)
|
|
117
135
|
}
|
package/packages/shared-skills/skills/frontend/scripts/perfection/check-accent-stripes.test.ts
CHANGED
|
@@ -22,6 +22,11 @@ const EXPECTED: Readonly<Record<string, ReadonlyArray<[number, RuleId]>>> = {
|
|
|
22
22
|
"gradient-edges.css": [[3, "gradient-stripe"], [8, "edge-stripe"], [20, "pseudo-bar"], [25, "gradient-stripe"]],
|
|
23
23
|
"non-visible-focus-and-nested.tsx": [[2, "edge-stripe"], [3, "edge-stripe"], [6, "edge-stripe"]],
|
|
24
24
|
"styled-components.tsx": [[6, "edge-stripe"], [12, "edge-stripe"]],
|
|
25
|
+
"flat-stripe-side.tsx": [[2, "edge-stripe"], [7, "edge-stripe"], [8, "edge-stripe"], [9, "edge-stripe"], [10, "edge-stripe"], [11, "edge-stripe"]],
|
|
26
|
+
"report-callouts.html": [[3, "edge-stripe"], [5, "edge-stripe"]],
|
|
27
|
+
"square-surfaces.css": [[1, "edge-stripe"], [4, "pseudo-bar"], [6, "inset-shadow-stripe"], [8, "gradient-stripe"]],
|
|
28
|
+
"accent-outlines.css": [[1, "accent-outline"], [2, "accent-outline"], [4, "accent-outline"]],
|
|
29
|
+
"accent-outlines.tsx": [[3, "accent-outline"], [4, "accent-outline"], [5, "accent-outline"], [6, "accent-outline"]],
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
function lintFixture(dir: string, name: string) {
|
|
@@ -29,7 +34,7 @@ function lintFixture(dir: string, name: string) {
|
|
|
29
34
|
return lintFiles([{ path, text: readFileSync(path, "utf8") }])
|
|
30
35
|
}
|
|
31
36
|
|
|
32
|
-
describe("#given a positive fixture with a coloured
|
|
37
|
+
describe("#given a positive fixture with a coloured one-side bar or an accent outline on a rounded card", () => {
|
|
33
38
|
test("#then every positive fixture has an expectation", () => {
|
|
34
39
|
expect(readdirSync(join(FIXTURES, "positive")).sort()).toEqual(Object.keys(EXPECTED).sort())
|
|
35
40
|
})
|
|
@@ -42,7 +47,7 @@ describe("#given a positive fixture with a coloured edge on a rounded surface",
|
|
|
42
47
|
}
|
|
43
48
|
})
|
|
44
49
|
|
|
45
|
-
describe("#given a negative fixture (neutral hairlines,
|
|
50
|
+
describe("#given a negative fixture (neutral hairlines and rules, thin outlines, focus rings, validation, tables, overlays)", () => {
|
|
46
51
|
for (const name of readdirSync(join(FIXTURES, "negative"))) {
|
|
47
52
|
test(`#when ${name} is linted #then it reports nothing`, () => {
|
|
48
53
|
expect(lintFixture("negative", name)).toEqual([])
|
|
@@ -50,13 +55,17 @@ describe("#given a negative fixture (neutral hairlines, flat edges, focus rings,
|
|
|
50
55
|
}
|
|
51
56
|
})
|
|
52
57
|
|
|
53
|
-
describe("#given the radius and the
|
|
54
|
-
test("#when both files are linted together #then the
|
|
58
|
+
describe("#given the radius and the accent outline live in different stylesheets", () => {
|
|
59
|
+
test("#when both files are linted together #then the outline rule is flagged in its own file", () => {
|
|
55
60
|
const findings = lintFiles([
|
|
56
61
|
{ path: "base.css", text: ".card { border-radius: 12px; }\n" },
|
|
57
|
-
{ path: "feature.css", text: "\n.card.card--promo { border
|
|
62
|
+
{ path: "feature.css", text: "\n.card.card--promo { border: 2px solid #f97316; }\n" },
|
|
58
63
|
])
|
|
59
|
-
expect(findings.map((f) => [f.file, f.line, f.rule])).toEqual([["feature.css", 2, "
|
|
64
|
+
expect(findings.map((f) => [f.file, f.line, f.rule])).toEqual([["feature.css", 2, "accent-outline"]])
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test("#when the outline rule is linted without the radius stylesheet #then a square box is not flagged", () => {
|
|
68
|
+
expect(lintFiles([{ path: "feature.css", text: ".card.card--promo { border: 2px solid #f97316; }\n" }])).toEqual([])
|
|
60
69
|
})
|
|
61
70
|
})
|
|
62
71
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
// Flags
|
|
2
|
+
// Flags coloured one-side bars on any box and accent outlines on rounded cards in CSS, Tailwind and JSX.
|
|
3
3
|
// Usage: bun check-accent-stripes.ts [--json] <file-or-dir>... Exit 0 clean, 1 findings, 2 usage.
|
|
4
4
|
import { readdirSync, readFileSync, statSync } from "node:fs"
|
|
5
5
|
import { join } from "node:path"
|
|
@@ -3,5 +3,6 @@ export const Ok = () => (
|
|
|
3
3
|
<div style={{ borderRadius: 8, border: "1px solid #e5e7eb" }}>Card</div>
|
|
4
4
|
<div style={{ borderRadius: 8, boxShadow: "inset 0 0 0 1px rgba(0,0,0,.1)" }}>Ring</div>
|
|
5
5
|
<p>Don't stripe {"rounded"} cards.</p>
|
|
6
|
+
<table><tbody><tr><td style={{ borderLeft: "4px solid #6366f1" }}>Sorted</td></tr></tbody></table>
|
|
6
7
|
</>
|
|
7
8
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.list-item { border-bottom: 1px solid #e5e7eb; }
|
|
2
2
|
.panel { border-radius: 12px; border-top: 1px solid rgba(0, 0, 0, 0.08); }
|
|
3
3
|
.quiet { border-radius: 12px; border-left: 4px solid #e5e7eb; }
|
|
4
|
-
|
|
4
|
+
blockquote { border-left: 3px solid #d4d4d8; padding-left: 16px; }
|
|
5
5
|
.token { border-radius: 8px; border-left: 2px solid var(--color-border); }
|
|
6
6
|
.ink { border-radius: 8px; border-left: 2px solid var(--text-primary); }
|
|
@@ -4,8 +4,11 @@ export const Ok = () => (
|
|
|
4
4
|
<div className="rounded-xl border-l-4 border-l-zinc-300 p-4">Neutral edge</div>
|
|
5
5
|
<button className="rounded-md focus-visible:ring-2 focus-visible:ring-blue-500">Go</button>
|
|
6
6
|
<input className="rounded-md border-b-2 aria-invalid:border-b-red-500 invalid:border-red-500" />
|
|
7
|
-
<
|
|
8
|
-
<
|
|
7
|
+
<blockquote className="border-l-2 border-zinc-300 pl-4">Neutral quote rule</blockquote>
|
|
8
|
+
<button className="rounded-md border border-indigo-500 px-3">Outline button</button>
|
|
9
9
|
<div className="rounded-lg bg-blue-50 p-4 text-blue-900">Tonal surface</div>
|
|
10
|
+
<input className="border-b-2 border-indigo-500" />
|
|
11
|
+
<select className="rounded-md border-2 border-indigo-500" />
|
|
12
|
+
<table><tbody><tr><td className="border-l-4 border-indigo-500">Sorted</td></tr></tbody></table>
|
|
10
13
|
</div>
|
|
11
14
|
)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
.
|
|
2
|
-
.
|
|
1
|
+
.outline-button { border-radius: 6px; border: 1px solid var(--primary); }
|
|
2
|
+
.neutral-frame { border-radius: 8px; border: 2px solid #e5e7eb; }
|
|
3
3
|
.lift { border-radius: 12px; box-shadow: 0 4px 12px rgb(0 0 0 / 0.12); }
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const Plans = () => (
|
|
2
|
+
<>
|
|
3
|
+
<div className="rounded-xl border-2 border-indigo-500 p-6">Pro</div>
|
|
4
|
+
<div className="rounded-2xl p-6 ring-2 ring-primary">Team</div>
|
|
5
|
+
<div className="rounded-lg focus:ring-2 focus:ring-blue-500">Focused</div>
|
|
6
|
+
<div style={{ borderRadius: 12, border: "2px solid #6366f1" }}>Inline</div>
|
|
7
|
+
</>
|
|
8
|
+
)
|