@luci-dev/skills 0.0.0-stage → 0.5.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/dist/benchmark.d.ts +48 -0
- package/dist/benchmark.d.ts.map +1 -0
- package/dist/benchmark.js +84 -0
- package/dist/benchmark.js.map +1 -0
- package/dist/discovery.d.ts +105 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +271 -0
- package/dist/discovery.js.map +1 -0
- package/dist/drafts.d.ts +20 -0
- package/dist/drafts.d.ts.map +1 -0
- package/dist/drafts.js +57 -0
- package/dist/drafts.js.map +1 -0
- package/dist/github.d.ts +49 -0
- package/dist/github.d.ts.map +1 -0
- package/dist/github.js +93 -0
- package/dist/github.js.map +1 -0
- package/dist/import.d.ts +80 -0
- package/dist/import.d.ts.map +1 -0
- package/dist/import.js +286 -0
- package/dist/import.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/licenses.d.ts +30 -0
- package/dist/licenses.d.ts.map +1 -0
- package/dist/licenses.js +116 -0
- package/dist/licenses.js.map +1 -0
- package/dist/linter.d.ts +35 -0
- package/dist/linter.d.ts.map +1 -0
- package/dist/linter.js +262 -0
- package/dist/linter.js.map +1 -0
- package/dist/lss.d.ts +74 -0
- package/dist/lss.d.ts.map +1 -0
- package/dist/lss.js +273 -0
- package/dist/lss.js.map +1 -0
- package/dist/orchestrator.d.ts +164 -0
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +370 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/packs.d.ts +50 -0
- package/dist/packs.d.ts.map +1 -0
- package/dist/packs.js +166 -0
- package/dist/packs.js.map +1 -0
- package/dist/preferences.d.ts +18 -0
- package/dist/preferences.d.ts.map +1 -0
- package/dist/preferences.js +57 -0
- package/dist/preferences.js.map +1 -0
- package/dist/project.d.ts +45 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +183 -0
- package/dist/project.js.map +1 -0
- package/dist/rankability.d.ts +51 -0
- package/dist/rankability.d.ts.map +1 -0
- package/dist/rankability.js +217 -0
- package/dist/rankability.js.map +1 -0
- package/dist/registry.d.ts +82 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +300 -0
- package/dist/registry.js.map +1 -0
- package/dist/trust.d.ts +13 -0
- package/dist/trust.d.ts.map +1 -0
- package/dist/trust.js +41 -0
- package/dist/trust.js.map +1 -0
- package/dist/types.d.ts +44 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/library/3d/threejs/LICENSE.txt +21 -0
- package/library/3d/threejs/NOTICE.md +7 -0
- package/library/3d/threejs/SKILL.md +102 -0
- package/library/3d/threejs/luci.json +39 -0
- package/library/accessibility/accessibility-baseline/SKILL.md +51 -0
- package/library/accessibility/accessibility-baseline/luci.json +33 -0
- package/library/accessibility/fixing-accessibility/NOTICE.md +6 -0
- package/library/accessibility/fixing-accessibility/SKILL.md +141 -0
- package/library/accessibility/fixing-accessibility/luci.json +36 -0
- package/library/animation-motion/animation-systems/LICENSE.txt +21 -0
- package/library/animation-motion/animation-systems/NOTICE.md +7 -0
- package/library/animation-motion/animation-systems/SKILL.md +192 -0
- package/library/animation-motion/animation-systems/luci.json +32 -0
- package/library/animation-motion/animejs/SKILL.md +64 -0
- package/library/animation-motion/animejs/luci.json +12 -0
- package/library/animation-motion/motion-dev/SKILL.md +69 -0
- package/library/animation-motion/motion-dev/luci.json +13 -0
- package/library/animation-motion/react-view-transitions/AGENTS.md +1380 -0
- package/library/animation-motion/react-view-transitions/NOTICE.md +6 -0
- package/library/animation-motion/react-view-transitions/README.md +44 -0
- package/library/animation-motion/react-view-transitions/SKILL.md +334 -0
- package/library/animation-motion/react-view-transitions/luci.json +40 -0
- package/library/animation-motion/react-view-transitions/metadata.json +12 -0
- package/library/animation-motion/react-view-transitions/references/css-recipes.md +312 -0
- package/library/animation-motion/react-view-transitions/references/implementation.md +170 -0
- package/library/animation-motion/react-view-transitions/references/nextjs.md +233 -0
- package/library/animation-motion/react-view-transitions/references/patterns.md +274 -0
- package/library/animation-motion/react-view-transitions/references/troubleshooting.md +47 -0
- package/library/code-quality/code-review/NOTICE.md +6 -0
- package/library/code-quality/code-review/SKILL.md +94 -0
- package/library/code-quality/code-review/agents/openai.yaml +3 -0
- package/library/code-quality/code-review/luci.json +33 -0
- package/library/components/company-logos/LICENSE.txt +21 -0
- package/library/components/company-logos/NOTICE.md +7 -0
- package/library/components/company-logos/SKILL.md +27 -0
- package/library/components/company-logos/luci.json +38 -0
- package/library/components/container-lines/LICENSE.txt +21 -0
- package/library/components/container-lines/NOTICE.md +7 -0
- package/library/components/container-lines/SKILL.md +124 -0
- package/library/components/container-lines/luci.json +48 -0
- package/library/design-systems/build-design-system/NOTICE.md +6 -0
- package/library/design-systems/build-design-system/SKILL.md +78 -0
- package/library/design-systems/build-design-system/luci.json +29 -0
- package/library/design-systems/build-design-system/references/components.md +46 -0
- package/library/design-systems/build-design-system/references/glossary.md +77 -0
- package/library/design-systems/build-design-system/references/taste.md +37 -0
- package/library/design-systems/build-design-system/references/tokens.md +59 -0
- package/library/design-systems/build-design-system/references/traps.md +128 -0
- package/library/design-systems/build-design-system/scripts/capture-guard.mjs +470 -0
- package/library/design-systems/build-design-system/scripts/capture.mjs +355 -0
- package/library/design-systems/build-design-system/scripts/check-system.mjs +1883 -0
- package/library/design-systems/build-design-system/scripts/find-chromium.mjs +137 -0
- package/library/design-systems/build-design-system/scripts/oklch.mjs +221 -0
- package/library/design-systems/build-design-system/scripts/pixdiff.mjs +186 -0
- package/library/design-systems/component-docs/NOTICE.md +6 -0
- package/library/design-systems/component-docs/SKILL.md +50 -0
- package/library/design-systems/component-docs/luci.json +30 -0
- package/library/design-systems/component-docs/references/doc-format.md +85 -0
- package/library/design-systems/create-design-md/NOTICE.md +6 -0
- package/library/design-systems/create-design-md/SKILL.md +259 -0
- package/library/design-systems/create-design-md/luci.json +38 -0
- package/library/design-systems/design-system-boss/NOTICE.md +6 -0
- package/library/design-systems/design-system-boss/SKILL.md +58 -0
- package/library/design-systems/design-system-boss/luci.json +29 -0
- package/library/design-systems/design-system-boss/playbooks/build.md +10 -0
- package/library/design-systems/design-system-boss/playbooks/component.md +9 -0
- package/library/design-systems/design-system-boss/playbooks/migrate.md +11 -0
- package/library/design-systems/design-system-boss/playbooks/review.md +9 -0
- package/library/design-systems/migrate-design-system/NOTICE.md +6 -0
- package/library/design-systems/migrate-design-system/SKILL.md +62 -0
- package/library/design-systems/migrate-design-system/luci.json +33 -0
- package/library/design-systems/migrate-design-system/references/correct.md +37 -0
- package/library/design-systems/migrate-design-system/references/lessons.md +69 -0
- package/library/design-systems/migrate-design-system/references/parity.md +44 -0
- package/library/design-systems/migrate-design-system/references/running-many-agents.md +52 -0
- package/library/design-systems/migrate-design-system/scripts/bodies-check.mjs +215 -0
- package/library/design-systems/migrate-design-system/scripts/land.mjs +433 -0
- package/library/design-systems/migrate-design-system/scripts/legacy.mjs +283 -0
- package/library/design-systems/migrate-design-system/scripts/parity.mjs +173 -0
- package/library/design-systems/token-mapping/NOTICE.md +6 -0
- package/library/design-systems/token-mapping/SKILL.md +46 -0
- package/library/design-systems/token-mapping/luci.json +25 -0
- package/library/design-systems/token-mapping/references/mapping-rules.md +54 -0
- package/library/design-systems/ui-review/NOTICE.md +6 -0
- package/library/design-systems/ui-review/SKILL.md +53 -0
- package/library/design-systems/ui-review/luci.json +29 -0
- package/library/design-systems/ui-review/references/criteria.md +49 -0
- package/library/frontend/composition-patterns/AGENTS.md +946 -0
- package/library/frontend/composition-patterns/NOTICE.md +6 -0
- package/library/frontend/composition-patterns/README.md +60 -0
- package/library/frontend/composition-patterns/SKILL.md +86 -0
- package/library/frontend/composition-patterns/luci.json +33 -0
- package/library/frontend/composition-patterns/metadata.json +11 -0
- package/library/frontend/composition-patterns/rules/_sections.md +29 -0
- package/library/frontend/composition-patterns/rules/_template.md +24 -0
- package/library/frontend/composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
- package/library/frontend/composition-patterns/rules/architecture-compound-components.md +112 -0
- package/library/frontend/composition-patterns/rules/patterns-children-over-render-props.md +87 -0
- package/library/frontend/composition-patterns/rules/patterns-explicit-variants.md +100 -0
- package/library/frontend/composition-patterns/rules/react19-no-forwardref.md +42 -0
- package/library/frontend/composition-patterns/rules/state-context-interface.md +191 -0
- package/library/frontend/composition-patterns/rules/state-decouple-implementation.md +113 -0
- package/library/frontend/composition-patterns/rules/state-lift-state.md +125 -0
- package/library/frontend/design-mobile-apps/NOTICE.md +6 -0
- package/library/frontend/design-mobile-apps/SKILL.md +121 -0
- package/library/frontend/design-mobile-apps/designing.md +56 -0
- package/library/frontend/design-mobile-apps/endpoints.md +362 -0
- package/library/frontend/design-mobile-apps/implementing.md +213 -0
- package/library/frontend/design-mobile-apps/luci.json +31 -0
- package/library/frontend/design-mobile-apps/styling/nativewind.md +57 -0
- package/library/frontend/design-mobile-apps/styling/stylesheet.md +28 -0
- package/library/frontend/design-mobile-apps/styling/uniwind.md +38 -0
- package/library/frontend/frontend-design/LICENSE.txt +202 -0
- package/library/frontend/frontend-design/NOTICE.md +6 -0
- package/library/frontend/frontend-design/SKILL.md +81 -0
- package/library/frontend/frontend-design/luci.json +43 -0
- package/library/frontend/react-native-skills/AGENTS.md +2897 -0
- package/library/frontend/react-native-skills/NOTICE.md +6 -0
- package/library/frontend/react-native-skills/README.md +165 -0
- package/library/frontend/react-native-skills/SKILL.md +119 -0
- package/library/frontend/react-native-skills/luci.json +33 -0
- package/library/frontend/react-native-skills/metadata.json +16 -0
- package/library/frontend/react-native-skills/rules/_sections.md +86 -0
- package/library/frontend/react-native-skills/rules/_template.md +28 -0
- package/library/frontend/react-native-skills/rules/animation-derived-value.md +53 -0
- package/library/frontend/react-native-skills/rules/animation-gesture-detector-press.md +95 -0
- package/library/frontend/react-native-skills/rules/animation-gpu-properties.md +65 -0
- package/library/frontend/react-native-skills/rules/design-system-compound-components.md +66 -0
- package/library/frontend/react-native-skills/rules/fonts-config-plugin.md +71 -0
- package/library/frontend/react-native-skills/rules/imports-design-system-folder.md +68 -0
- package/library/frontend/react-native-skills/rules/js-hoist-intl.md +61 -0
- package/library/frontend/react-native-skills/rules/list-performance-callbacks.md +44 -0
- package/library/frontend/react-native-skills/rules/list-performance-function-references.md +132 -0
- package/library/frontend/react-native-skills/rules/list-performance-images.md +53 -0
- package/library/frontend/react-native-skills/rules/list-performance-inline-objects.md +97 -0
- package/library/frontend/react-native-skills/rules/list-performance-item-expensive.md +94 -0
- package/library/frontend/react-native-skills/rules/list-performance-item-memo.md +82 -0
- package/library/frontend/react-native-skills/rules/list-performance-item-types.md +104 -0
- package/library/frontend/react-native-skills/rules/list-performance-virtualize.md +67 -0
- package/library/frontend/react-native-skills/rules/monorepo-native-deps-in-app.md +46 -0
- package/library/frontend/react-native-skills/rules/monorepo-single-dependency-versions.md +63 -0
- package/library/frontend/react-native-skills/rules/navigation-native-navigators.md +188 -0
- package/library/frontend/react-native-skills/rules/react-compiler-destructure-functions.md +50 -0
- package/library/frontend/react-native-skills/rules/react-compiler-reanimated-shared-values.md +48 -0
- package/library/frontend/react-native-skills/rules/react-state-dispatcher.md +91 -0
- package/library/frontend/react-native-skills/rules/react-state-fallback.md +56 -0
- package/library/frontend/react-native-skills/rules/react-state-minimize.md +65 -0
- package/library/frontend/react-native-skills/rules/rendering-no-falsy-and.md +74 -0
- package/library/frontend/react-native-skills/rules/rendering-text-in-text-component.md +36 -0
- package/library/frontend/react-native-skills/rules/scroll-position-no-state.md +82 -0
- package/library/frontend/react-native-skills/rules/state-ground-truth.md +80 -0
- package/library/frontend/react-native-skills/rules/ui-expo-image.md +66 -0
- package/library/frontend/react-native-skills/rules/ui-image-gallery.md +104 -0
- package/library/frontend/react-native-skills/rules/ui-measure-views.md +78 -0
- package/library/frontend/react-native-skills/rules/ui-menus.md +174 -0
- package/library/frontend/react-native-skills/rules/ui-native-modals.md +77 -0
- package/library/frontend/react-native-skills/rules/ui-pressable.md +61 -0
- package/library/frontend/react-native-skills/rules/ui-safe-area-scroll.md +65 -0
- package/library/frontend/react-native-skills/rules/ui-scrollview-content-inset.md +45 -0
- package/library/frontend/react-native-skills/rules/ui-styling.md +87 -0
- package/library/frontend/tailwindcss/LICENSE.txt +21 -0
- package/library/frontend/tailwindcss/NOTICE.md +7 -0
- package/library/frontend/tailwindcss/SKILL.md +83 -0
- package/library/frontend/tailwindcss/luci.json +39 -0
- package/library/frontend-frameworks/react-best-practices/NOTICE.md +6 -0
- package/library/frontend-frameworks/react-best-practices/SKILL.md +151 -0
- package/library/frontend-frameworks/react-best-practices/luci.json +39 -0
- package/library/general/algorithmic-art/LICENSE.txt +202 -0
- package/library/general/algorithmic-art/NOTICE.md +6 -0
- package/library/general/algorithmic-art/SKILL.md +409 -0
- package/library/general/algorithmic-art/luci.json +27 -0
- package/library/general/algorithmic-art/templates/generator_template.js +223 -0
- package/library/general/algorithmic-art/templates/viewer.html +599 -0
- package/library/general/canvas-design/LICENSE.txt +202 -0
- package/library/general/canvas-design/NOTICE.md +6 -0
- package/library/general/canvas-design/SKILL.md +134 -0
- package/library/general/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
- package/library/general/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
- package/library/general/canvas-design/luci.json +29 -0
- package/library/index.json +2507 -0
- package/library/interaction/animation-on-scroll/LICENSE.txt +21 -0
- package/library/interaction/animation-on-scroll/NOTICE.md +7 -0
- package/library/interaction/animation-on-scroll/SKILL.md +115 -0
- package/library/interaction/animation-on-scroll/luci.json +38 -0
- package/library/micro-interactions/masked-reveal/LICENSE.txt +21 -0
- package/library/micro-interactions/masked-reveal/NOTICE.md +7 -0
- package/library/micro-interactions/masked-reveal/SKILL.md +187 -0
- package/library/micro-interactions/masked-reveal/luci.json +63 -0
- package/library/micro-interactions/micro-interaction/NOTICE.md +6 -0
- package/library/micro-interactions/micro-interaction/SKILL.md +177 -0
- package/library/micro-interactions/micro-interaction/luci.json +52 -0
- package/library/micro-interactions/micro-interaction/references/css-recipes.md +142 -0
- package/library/micro-interactions/micro-interaction/references/framer-motion-recipes.md +187 -0
- package/library/micro-interactions/micro-interaction/scripts/README.md +42 -0
- package/library/micro-interactions/micro-interaction/scripts/contact-sheet.sh +17 -0
- package/library/micro-interactions/micro-interaction/scripts/seek-shot.sh +21 -0
- package/library/performance/fixing-motion-performance/NOTICE.md +6 -0
- package/library/performance/fixing-motion-performance/SKILL.md +156 -0
- package/library/performance/fixing-motion-performance/luci.json +30 -0
- package/library/seo/fixing-metadata/NOTICE.md +6 -0
- package/library/seo/fixing-metadata/SKILL.md +111 -0
- package/library/seo/fixing-metadata/luci.json +36 -0
- package/library/shadcn-ui/migrate-radix-to-base/NOTICE.md +6 -0
- package/library/shadcn-ui/migrate-radix-to-base/SKILL.md +178 -0
- package/library/shadcn-ui/migrate-radix-to-base/class-mapping.md +62 -0
- package/library/shadcn-ui/migrate-radix-to-base/consumer-props.md +58 -0
- package/library/shadcn-ui/migrate-radix-to-base/disclosure.md +353 -0
- package/library/shadcn-ui/migrate-radix-to-base/display-misc.md +410 -0
- package/library/shadcn-ui/migrate-radix-to-base/form-controls.md +390 -0
- package/library/shadcn-ui/migrate-radix-to-base/luci.json +33 -0
- package/library/shadcn-ui/migrate-radix-to-base/menus.md +409 -0
- package/library/shadcn-ui/migrate-radix-to-base/overlays.md +459 -0
- package/library/shadcn-ui/migrate-radix-to-base/universal-patterns.md +286 -0
- package/library/shadcn-ui/migrate-radix-to-base/wrapper-shapes.md +110 -0
- package/library/shadcn-ui/shadcn/NOTICE.md +6 -0
- package/library/shadcn-ui/shadcn/SKILL.md +187 -0
- package/library/shadcn-ui/shadcn/agents/openai.yml +5 -0
- package/library/shadcn-ui/shadcn/assets/shadcn-small.png +0 -0
- package/library/shadcn-ui/shadcn/assets/shadcn.png +0 -0
- package/library/shadcn-ui/shadcn/assets/showcase/color-pair.tsx +126 -0
- package/library/shadcn-ui/shadcn/assets/showcase/preview-states.css +14 -0
- package/library/shadcn-ui/shadcn/assets/showcase/state-matrix.tsx +72 -0
- package/library/shadcn-ui/shadcn/cli.md +290 -0
- package/library/shadcn-ui/shadcn/customization.md +211 -0
- package/library/shadcn-ui/shadcn/design-system-page.md +268 -0
- package/library/shadcn-ui/shadcn/design-system.md +386 -0
- package/library/shadcn-ui/shadcn/evals/evals.json +126 -0
- package/library/shadcn-ui/shadcn/luci.json +34 -0
- package/library/shadcn-ui/shadcn/mcp.md +105 -0
- package/library/shadcn-ui/shadcn/references/updating-components.md +91 -0
- package/library/shadcn-ui/shadcn/references/workflow.md +31 -0
- package/library/shadcn-ui/shadcn/registry.md +277 -0
- package/library/shadcn-ui/shadcn/rules/base-vs-radix.md +306 -0
- package/library/shadcn-ui/shadcn/rules/chat.md +507 -0
- package/library/shadcn-ui/shadcn/rules/composition.md +213 -0
- package/library/shadcn-ui/shadcn/rules/forms.md +192 -0
- package/library/shadcn-ui/shadcn/rules/icons.md +101 -0
- package/library/shadcn-ui/shadcn/rules/styling.md +185 -0
- package/library/shadcn-ui/shadcn/scripts/showcase-coverage.mjs +53 -0
- package/library/systems/baseline-ui/NOTICE.md +6 -0
- package/library/systems/baseline-ui/SKILL.md +90 -0
- package/library/systems/baseline-ui/luci.json +35 -0
- package/library/testing/tdd/NOTICE.md +6 -0
- package/library/testing/tdd/SKILL.md +43 -0
- package/library/testing/tdd/agents/openai.yaml +3 -0
- package/library/testing/tdd/luci.json +29 -0
- package/library/testing/tdd/mocking.md +59 -0
- package/library/testing/tdd/tests.md +77 -0
- package/library/testing/webapp-testing/LICENSE.txt +202 -0
- package/library/testing/webapp-testing/NOTICE.md +6 -0
- package/library/testing/webapp-testing/SKILL.md +100 -0
- package/library/testing/webapp-testing/examples/console_logging.py +35 -0
- package/library/testing/webapp-testing/examples/element_discovery.py +40 -0
- package/library/testing/webapp-testing/examples/static_html_automation.py +33 -0
- package/library/testing/webapp-testing/luci.json +33 -0
- package/library/testing/webapp-testing/scripts/with_server.py +106 -0
- package/library/ui-ux/improve-ui/NOTICE.md +6 -0
- package/library/ui-ux/improve-ui/SKILL.md +127 -0
- package/library/ui-ux/improve-ui/agents/openai.yaml +13 -0
- package/library/ui-ux/improve-ui/luci.json +47 -0
- package/library/ui-ux/improve-ui/references/plan-template.md +55 -0
- package/library/ui-ux/landing-page/LICENSE.txt +21 -0
- package/library/ui-ux/landing-page/NOTICE.md +7 -0
- package/library/ui-ux/landing-page/SKILL.md +213 -0
- package/library/ui-ux/landing-page/luci.json +47 -0
- package/library/ui-ux/pricing-page/LICENSE.txt +21 -0
- package/library/ui-ux/pricing-page/NOTICE.md +7 -0
- package/library/ui-ux/pricing-page/SKILL.md +217 -0
- package/library/ui-ux/pricing-page/luci.json +47 -0
- package/library/ui-ux/prototype/LOGIC.md +67 -0
- package/library/ui-ux/prototype/NOTICE.md +6 -0
- package/library/ui-ux/prototype/SKILL.md +31 -0
- package/library/ui-ux/prototype/UI.md +112 -0
- package/library/ui-ux/prototype/agents/openai.yaml +3 -0
- package/library/ui-ux/prototype/luci.json +33 -0
- package/library/ui-ux/theme-factory/LICENSE.txt +202 -0
- package/library/ui-ux/theme-factory/NOTICE.md +6 -0
- package/library/ui-ux/theme-factory/SKILL.md +62 -0
- package/library/ui-ux/theme-factory/luci.json +35 -0
- package/library/ui-ux/theme-factory/themes/arctic-frost.md +19 -0
- package/library/ui-ux/theme-factory/themes/botanical-garden.md +19 -0
- package/library/ui-ux/theme-factory/themes/desert-rose.md +19 -0
- package/library/ui-ux/theme-factory/themes/forest-canopy.md +19 -0
- package/library/ui-ux/theme-factory/themes/golden-hour.md +19 -0
- package/library/ui-ux/theme-factory/themes/midnight-galaxy.md +19 -0
- package/library/ui-ux/theme-factory/themes/modern-minimalist.md +19 -0
- package/library/ui-ux/theme-factory/themes/ocean-depths.md +19 -0
- package/library/ui-ux/theme-factory/themes/sunset-boulevard.md +19 -0
- package/library/ui-ux/theme-factory/themes/tech-innovation.md +19 -0
- package/package.json +21 -3
- package/packs/design-system-build.json +10 -0
- package/packs/design-system.json +16 -0
- package/packs/marketing.json +11 -0
- package/packs/motion.json +12 -0
- package/packs/ui.json +13 -0
- package/README.md +0 -3
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// legacy.mjs: the legacy inventory and its ratchet. Node 18+, no dependencies.
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
const SELF = fileURLToPath(import.meta.url);
|
|
10
|
+
const KINDS = ["import", "raw", "palette"];
|
|
11
|
+
const DEFAULT_SCAN = ["src", "app", "pages", "components", "lib"];
|
|
12
|
+
const PLACEHOLDER_LEGACY = "^REPLACE-with-your-legacy-module";
|
|
13
|
+
const PLACEHOLDER_SYSTEM = "^REPLACE-with-your-system-module";
|
|
14
|
+
|
|
15
|
+
const HELP = `legacy.mjs [--inventory | --record | --zero [<kinds>]] [--root <dir>] [--config <file>] [--baseline <file>] [--paths "<glob> ..."]
|
|
16
|
+
legacy.mjs --init-config | --self-test | --help
|
|
17
|
+
|
|
18
|
+
Counts legacy usage per file and kind (${KINDS.join(", ")}), as occurrences, and holds the count to a committed baseline.
|
|
19
|
+
(no flag) fail when a count rose, a file with findings is not in the baseline, a count fell without being
|
|
20
|
+
recorded (run --record to lock the win in), or a file imports the system and a legacy module together
|
|
21
|
+
--inventory print kind, file, count, then totals. Changes nothing. Audit mode uses this
|
|
22
|
+
--record rewrite the baseline from today's counts, sorted. Never run it over other workers' half-done edits
|
|
23
|
+
--zero the close gate: fail unless these kinds count 0 everywhere (comma list of ${KINDS.join(", ")} and mixed,
|
|
24
|
+
default import,mixed). Needs no baseline, so a baseline full of legacy usage cannot pass it
|
|
25
|
+
--paths scoped check: compare only files matching the globs. Cannot be combined with --record
|
|
26
|
+
--init-config write a starter config. Refuses to overwrite
|
|
27
|
+
|
|
28
|
+
Config, default <root>/scripts/legacy.json, committed beside this script so CI reads the same one
|
|
29
|
+
{"scan": ["src", "app"], "ignore": ["**/*.test.*"], "tokenFiles": ["src/tokens.css"],
|
|
30
|
+
"legacyImports": ["^@/components/legacy/", "^old-ui$"], "systemImports": ["^@/components/ui/"]}
|
|
31
|
+
legacyImports and systemImports are regexes over import specifiers. tokenFiles may hold raw values.
|
|
32
|
+
scan defaults to whichever of ${DEFAULT_SCAN.join(", ")} exist. --init-config writes those it finds and
|
|
33
|
+
placeholder regexes, and every mode exits 2 until the placeholders are replaced.
|
|
34
|
+
Baseline, default <root>/scripts/legacy-baseline.json: {"path/file.tsx": {"raw": 2, "import": 1}}
|
|
35
|
+
Audit mode commits nothing, so it passes --config .design-system/legacy.json to keep the config there.
|
|
36
|
+
Exit 0 pass 1 violations 2 usage, missing baseline, placeholder config, or no file scanned`;
|
|
37
|
+
|
|
38
|
+
const globRe = (g) => {
|
|
39
|
+
let re = "";
|
|
40
|
+
for (let i = 0; i < g.length; i++) {
|
|
41
|
+
const c = g[i];
|
|
42
|
+
if (c === "*" && g[i + 1] === "*") { i++; if (g[i + 1] === "/") { i++; re += "(?:.*/)?"; } else re += ".*"; }
|
|
43
|
+
else if (c === "*") re += "[^/]*";
|
|
44
|
+
else if (c === "?") re += "[^/]";
|
|
45
|
+
else re += c.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
46
|
+
}
|
|
47
|
+
return new RegExp(`^${re}$`);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const EXT = /\.(tsx?|jsx?|mjs|css|scss|vue|svelte|astro|html)$/;
|
|
51
|
+
const SKIP_DIR = new Set(["node_modules", ".git", "dist", "build", ".next", ".turbo", "coverage", ".design-system"]);
|
|
52
|
+
const RAW_RE = /#[0-9a-fA-F]{3,8}\b|\b(?:rgba?|hsla?|oklch|oklab)\(/g;
|
|
53
|
+
const PALETTE = "slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose";
|
|
54
|
+
const PALETTE_RE = new RegExp(`\\b(?:bg|text|border|ring|fill|stroke|from|to|via|divide|outline|decoration|shadow|accent|caret)-(?:${PALETTE})-\\d{2,3}\\b|var\\(--color-(?:${PALETTE})-\\d+\\)`, "g");
|
|
55
|
+
const SPEC_RE = /(?:\bfrom\s*|\bimport\s*\(?\s*|\brequire\s*\(\s*)["']([^"']+)["']/g;
|
|
56
|
+
|
|
57
|
+
function walk(root, dirs) {
|
|
58
|
+
const out = [];
|
|
59
|
+
const rec = (d) => {
|
|
60
|
+
for (const name of readdirSync(d)) {
|
|
61
|
+
if (SKIP_DIR.has(name)) continue;
|
|
62
|
+
const p = join(d, name);
|
|
63
|
+
const s = statSync(p);
|
|
64
|
+
if (s.isDirectory()) rec(p);
|
|
65
|
+
else if (EXT.test(name)) out.push(relative(root, p).split("\\").join("/"));
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
for (const d of dirs) if (existsSync(join(root, d))) rec(join(root, d));
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function scan(root, cfg) {
|
|
73
|
+
const ignore = (cfg.ignore || []).map(globRe);
|
|
74
|
+
const tokens = new Set(cfg.tokenFiles || []);
|
|
75
|
+
const legacy = (cfg.legacyImports || []).map((r) => new RegExp(r));
|
|
76
|
+
const system = (cfg.systemImports || []).map((r) => new RegExp(r));
|
|
77
|
+
const counts = {};
|
|
78
|
+
const mixed = [];
|
|
79
|
+
const roots = cfg.scan || DEFAULT_SCAN.filter((d) => existsSync(join(root, d)));
|
|
80
|
+
let scanned = 0;
|
|
81
|
+
for (const file of walk(root, roots)) {
|
|
82
|
+
if (ignore.some((re) => re.test(file))) continue;
|
|
83
|
+
const text = readFileSync(join(root, file), "utf8");
|
|
84
|
+
scanned++;
|
|
85
|
+
const c = {};
|
|
86
|
+
let usesSystem = false;
|
|
87
|
+
for (const m of text.matchAll(SPEC_RE)) {
|
|
88
|
+
if (legacy.some((re) => re.test(m[1]))) c.import = (c.import || 0) + 1;
|
|
89
|
+
if (system.some((re) => re.test(m[1]))) usesSystem = true;
|
|
90
|
+
}
|
|
91
|
+
if (!tokens.has(file)) {
|
|
92
|
+
const raw = (text.match(RAW_RE) || []).length;
|
|
93
|
+
if (raw) c.raw = raw;
|
|
94
|
+
}
|
|
95
|
+
const pal = (text.match(PALETTE_RE) || []).length;
|
|
96
|
+
if (pal) c.palette = pal;
|
|
97
|
+
if (Object.keys(c).length) counts[file] = c;
|
|
98
|
+
if (usesSystem && c.import) mixed.push(file);
|
|
99
|
+
}
|
|
100
|
+
return { counts, mixed, scanned, roots };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// A config that would count nothing: no file scanned, or import regexes still the placeholder. Such a run once passed --zero.
|
|
104
|
+
export function configProblem(cfg, result, kinds) {
|
|
105
|
+
const re = [...(cfg.legacyImports || []), ...(cfg.systemImports || [])];
|
|
106
|
+
if (re.some((r) => r === PLACEHOLDER_LEGACY || r === PLACEHOLDER_SYSTEM || r === "^@old/ui" || r === "^@sys/ui")) return "legacyImports or systemImports still holds a placeholder. Point them at the app's real legacy and system modules";
|
|
107
|
+
if (kinds.some((k) => k === "import" || k === "mixed") && !(cfg.legacyImports || []).length) return "legacyImports is empty, so legacy imports cannot be counted";
|
|
108
|
+
if (kinds.includes("mixed") && !(cfg.systemImports || []).length) return "systemImports is empty, so files mixing the system with legacy cannot be found";
|
|
109
|
+
if (!result.scanned) return `scanned 0 files under ${result.roots.length ? result.roots.join(", ") : `(none of ${DEFAULT_SCAN.join(", ")} exists)`}. Set scan to the folders that hold the app`;
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function compare(baseline, current, inScope = () => true) {
|
|
114
|
+
const rose = [];
|
|
115
|
+
const stale = [];
|
|
116
|
+
for (const file of new Set([...Object.keys(baseline), ...Object.keys(current)])) {
|
|
117
|
+
if (!inScope(file)) continue;
|
|
118
|
+
for (const kind of KINDS) {
|
|
119
|
+
const before = baseline[file]?.[kind] ?? 0;
|
|
120
|
+
const after = current[file]?.[kind] ?? 0;
|
|
121
|
+
if (after === before) continue;
|
|
122
|
+
const note = !baseline[file] ? " (not in baseline)" : !current[file] ? " (no findings now)" : "";
|
|
123
|
+
(after > before ? rose : stale).push(` ${file} ${kind} baseline ${before}, now ${after}${note}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return { rose, stale };
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const total = (counts, kind) => Object.values(counts).reduce((s, c) => s + (c[kind] || 0), 0);
|
|
130
|
+
let scannedCount = 0;
|
|
131
|
+
const summary = (counts) => `${scannedCount} files scanned, ${Object.keys(counts).length} with findings; ${KINDS.map((k) => `${k} ${total(counts, k)}`).join(", ")} (occurrences).`;
|
|
132
|
+
const sorted = (counts) => Object.fromEntries(Object.keys(counts).sort().map((f) => [f, Object.fromEntries(KINDS.filter((k) => counts[f][k]).map((k) => [k, counts[f][k]]))]));
|
|
133
|
+
const baselineText = (counts) => "{\n" + Object.entries(sorted(counts)).map(([f, c]) => `\t${JSON.stringify(f)}: ${JSON.stringify(c)}`).join(",\n") + "\n}\n";
|
|
134
|
+
|
|
135
|
+
function main(argv) {
|
|
136
|
+
const o = { paths: null };
|
|
137
|
+
for (let i = 0; i < argv.length; i++) {
|
|
138
|
+
const a = argv[i];
|
|
139
|
+
if (["--root", "--config", "--baseline", "--paths"].includes(a) && i + 1 < argv.length) o[a.slice(2)] = argv[++i];
|
|
140
|
+
else if (a === "--zero") o.zero = i + 1 < argv.length && !argv[i + 1].startsWith("--") ? argv[++i] : "import,mixed";
|
|
141
|
+
else if (["--inventory", "--record", "--init-config", "--help", "--self-test"].includes(a)) o[a.slice(2)] = true;
|
|
142
|
+
else { console.error(HELP); return 2; }
|
|
143
|
+
}
|
|
144
|
+
if (o.help) { console.log(HELP); return 0; }
|
|
145
|
+
if (o["self-test"]) return selfTest();
|
|
146
|
+
const root = resolve(o.root || process.cwd());
|
|
147
|
+
const cfgFile = resolve(o.config || join(root, "scripts/legacy.json"));
|
|
148
|
+
const baseFile = resolve(o.baseline || join(root, "scripts/legacy-baseline.json"));
|
|
149
|
+
if (o["init-config"]) {
|
|
150
|
+
if (existsSync(cfgFile)) { console.error(`${cfgFile} exists`); return 2; }
|
|
151
|
+
mkdirSync(dirname(cfgFile), { recursive: true });
|
|
152
|
+
const found = DEFAULT_SCAN.filter((d) => existsSync(join(root, d)));
|
|
153
|
+
writeFileSync(cfgFile, JSON.stringify({ scan: found.length ? found : ["src"], ignore: ["**/*.test.*", "**/*.stories.*"], tokenFiles: [], legacyImports: [PLACEHOLDER_LEGACY], systemImports: [PLACEHOLDER_SYSTEM] }, null, "\t") + "\n");
|
|
154
|
+
console.log(`wrote ${cfgFile}, scanning ${found.length ? found.join(", ") : "src (none of the usual folders exists, so set scan)"}. Set legacyImports and systemImports to your modules; every mode exits 2 until then`);
|
|
155
|
+
return 0;
|
|
156
|
+
}
|
|
157
|
+
if (!existsSync(cfgFile)) { console.error(`no config at ${cfgFile}. Run --init-config`); return 2; }
|
|
158
|
+
const cfg = JSON.parse(readFileSync(cfgFile, "utf8"));
|
|
159
|
+
const result = scan(root, cfg);
|
|
160
|
+
const { counts, mixed } = result;
|
|
161
|
+
const kindsAsked = o.zero ? o.zero.split(",").map((k) => k.trim()).filter(Boolean) : [...KINDS, "mixed"];
|
|
162
|
+
const problem = configProblem(cfg, result, kindsAsked);
|
|
163
|
+
if (problem) { console.error(`legacy.mjs: ${problem} (${cfgFile})`); return 2; }
|
|
164
|
+
scannedCount = result.scanned;
|
|
165
|
+
if (o.inventory) {
|
|
166
|
+
for (const f of Object.keys(counts).sort()) for (const k of KINDS) if (counts[f][k]) console.log(`${k}\t${f}\t${counts[f][k]}`);
|
|
167
|
+
for (const f of mixed.sort()) console.log(`mixed\t${f}\t1`);
|
|
168
|
+
console.log(summary(counts));
|
|
169
|
+
return 0;
|
|
170
|
+
}
|
|
171
|
+
if (o.zero) {
|
|
172
|
+
const kinds = o.zero.split(",").map((k) => k.trim()).filter(Boolean);
|
|
173
|
+
const unknown = kinds.filter((k) => k !== "mixed" && !KINDS.includes(k));
|
|
174
|
+
if (unknown.length) { console.error(`--zero: unknown kind ${unknown.join(", ")}. Use ${KINDS.join(", ")} or mixed`); return 2; }
|
|
175
|
+
const left = [];
|
|
176
|
+
for (const f of Object.keys(counts).sort()) for (const k of kinds) if (k !== "mixed" && counts[f][k]) left.push(` ${f} ${k} ${counts[f][k]}`);
|
|
177
|
+
if (kinds.includes("mixed")) for (const f of mixed.sort()) left.push(` ${f} mixed 1`);
|
|
178
|
+
console.log(left.length ? `Legacy usage left (${left.length} rows), so the migration is not done:\n${left.join("\n")}` : `zero ${kinds.join(", ")} usage`);
|
|
179
|
+
console.log(summary(counts));
|
|
180
|
+
return left.length ? 1 : 0;
|
|
181
|
+
}
|
|
182
|
+
if (o.record) {
|
|
183
|
+
if (o.paths) { console.error("--paths is read-only"); return 2; }
|
|
184
|
+
mkdirSync(dirname(baseFile), { recursive: true });
|
|
185
|
+
writeFileSync(baseFile, baselineText(counts));
|
|
186
|
+
console.log(`recorded ${baseFile}: ${summary(counts)}`);
|
|
187
|
+
return 0;
|
|
188
|
+
}
|
|
189
|
+
if (!existsSync(baseFile)) { console.error(`${baseFile} is missing. Create it with --record`); return 2; }
|
|
190
|
+
const scope = o.paths ? o.paths.split(/\s+/).filter(Boolean).map(globRe) : null;
|
|
191
|
+
const inScope = (f) => !scope || scope.some((re) => re.test(f));
|
|
192
|
+
const { rose, stale } = compare(JSON.parse(readFileSync(baseFile, "utf8")), counts, inScope);
|
|
193
|
+
const mixedHere = mixed.filter(inScope);
|
|
194
|
+
if (rose.length) console.log(`New legacy usage (${rose.length}). Use the system instead:\n${rose.sort().join("\n")}`);
|
|
195
|
+
if (stale.length) console.log(`Stale baseline, run --record to lock in the fall (${stale.length}):\n${stale.sort().join("\n")}`);
|
|
196
|
+
if (mixedHere.length) console.log(`Files that import the system and a legacy module together (${mixedHere.length}):\n${mixedHere.sort().map((f) => " " + f).join("\n")}`);
|
|
197
|
+
console.log(summary(counts));
|
|
198
|
+
return rose.length + stale.length + mixedHere.length ? 1 : 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// ---------------------------------------------------------------- self-test
|
|
202
|
+
function selfTest() {
|
|
203
|
+
let fails = 0;
|
|
204
|
+
const expect = (name, ok, detail = "") => { console.log(`${ok ? "ok " : "FAIL"} ${name}${ok ? "" : "\n" + detail}`); if (!ok) fails++; };
|
|
205
|
+
const dir = mkdtempSync(join(tmpdir(), "legacy-"));
|
|
206
|
+
const w = (f, t) => { mkdirSync(dirname(join(dir, f)), { recursive: true }); writeFileSync(join(dir, f), t); };
|
|
207
|
+
const cfg = { scan: ["src"], ignore: ["**/*.test.*"], tokenFiles: ["src/tokens.css"], legacyImports: ["^@/legacy/"], systemImports: ["^@/ui/"] };
|
|
208
|
+
w("scripts/legacy.json", JSON.stringify(cfg));
|
|
209
|
+
w("src/tokens.css", ":root { --a: #0a0a0a; }\n");
|
|
210
|
+
w("src/a.tsx", 'import { Modal } from "@/legacy/modal"\nexport const A = () => <p style={{ color: "#333" }} className="text-gray-500" />\n');
|
|
211
|
+
w("src/b.tsx", 'import { Card } from "@/ui/card"\nexport const B = () => <Card />\n');
|
|
212
|
+
w("src/c.test.tsx", 'const x = "#fff"\n');
|
|
213
|
+
const run = (...a) => spawnSync(process.execPath, [SELF, "--root", dir, ...a], { encoding: "utf8" });
|
|
214
|
+
let r = run("--inventory");
|
|
215
|
+
expect("inventory counts import, raw and palette once", /import\tsrc\/a.tsx\t1/.test(r.stdout) && /raw\tsrc\/a.tsx\t1/.test(r.stdout) && /palette\tsrc\/a.tsx\t1/.test(r.stdout), r.stdout);
|
|
216
|
+
expect("tokenFiles and ignored tests are not counted", !/tokens.css|c.test/.test(r.stdout), r.stdout);
|
|
217
|
+
expect("a missing baseline exits 2", run().status === 2);
|
|
218
|
+
expect("--record exits 0", run("--record").status === 0);
|
|
219
|
+
expect("a clean tree passes", run().status === 0, run().stdout);
|
|
220
|
+
const plant = (name, file, text, want) => {
|
|
221
|
+
const path = join(dir, file);
|
|
222
|
+
const saved = existsSync(path) ? readFileSync(path, "utf8") : null;
|
|
223
|
+
w(file, text(saved || ""));
|
|
224
|
+
const bad = run();
|
|
225
|
+
expect(`plant: ${name} fails`, bad.status === 1 && bad.stdout.includes(want), bad.stdout);
|
|
226
|
+
if (saved === null) rmSync(path); else writeFileSync(path, saved);
|
|
227
|
+
expect(`reverted ${name} passes`, run().status === 0, run().stdout);
|
|
228
|
+
};
|
|
229
|
+
plant("a raw colour in a listed file", "src/a.tsx", (t) => t + 'const y = "#abcdef"\n', "raw");
|
|
230
|
+
plant("a palette class", "src/b.tsx", (t) => t + 'const z = "bg-red-500"\n', "palette");
|
|
231
|
+
plant("a legacy import", "src/b.tsx", (t) => 'import { X } from "@/legacy/modal"\n' + t, "import");
|
|
232
|
+
plant("a new unlisted file with a finding", "src/new.tsx", () => 'export const N = () => <b style={{ color: "#fff" }} />\n', "not in baseline");
|
|
233
|
+
plant("a file importing the system and a legacy module", "src/mix.tsx", () => 'import { Card } from "@/ui/card"\nimport { M } from "@/legacy/modal"\n', "together");
|
|
234
|
+
w("src/a.tsx", 'import { Card } from "@/ui/card"\nexport const A = Card\n');
|
|
235
|
+
r = run();
|
|
236
|
+
expect("a fall the baseline does not record fails", r.status === 1 && /Stale baseline/.test(r.stdout), r.stdout);
|
|
237
|
+
run("--record");
|
|
238
|
+
expect("after --record the win is locked in", run().status === 0);
|
|
239
|
+
w("src/a.tsx", 'import { Card } from "@/ui/card"\nconst c = "#123456"\nexport const A = Card\n');
|
|
240
|
+
expect("putting a finding back fails as a rise", run().status === 1);
|
|
241
|
+
w("src/a.tsx", 'import { Card } from "@/ui/card"\nexport const A = Card\n');
|
|
242
|
+
w("src/other.tsx", 'const o = "#eeeeee"\n');
|
|
243
|
+
expect("--paths passes when the violation is elsewhere", run("--paths", "src/a.tsx").status === 0);
|
|
244
|
+
expect("--paths fails on a listed path", run("--paths", "src/other.tsx").status === 1);
|
|
245
|
+
expect("--paths with --record is refused", run("--paths", "src/a.tsx", "--record").status === 2);
|
|
246
|
+
w("src/old.tsx", 'import { Modal } from "@/legacy/modal"\n');
|
|
247
|
+
run("--record");
|
|
248
|
+
expect("a baseline holding legacy usage passes the ratchet", run().status === 0);
|
|
249
|
+
r = run("--zero");
|
|
250
|
+
expect("--zero fails while a legacy import is left, baseline or not", r.status === 1 && /src\/old.tsx import 1/.test(r.stdout), r.stdout);
|
|
251
|
+
rmSync(join(dir, "src/old.tsx"));
|
|
252
|
+
expect("--zero passes once no legacy import is left", run("--zero").status === 0);
|
|
253
|
+
expect("--zero raw fails on a raw value", run("--zero", "raw").status === 1);
|
|
254
|
+
expect("--zero with an unknown kind exits 2", run("--zero", "colour").status === 2);
|
|
255
|
+
// --zero once passed on a config that scanned nothing or still held the placeholder.
|
|
256
|
+
w("scripts/legacy.json", JSON.stringify({ ...cfg, scan: ["nope"] }));
|
|
257
|
+
r = run("--zero");
|
|
258
|
+
expect("--zero exits 2 when no file was scanned", r.status === 2 && /scanned 0 files/.test(r.stderr), r.stdout + r.stderr);
|
|
259
|
+
w("scripts/legacy.json", JSON.stringify({ ...cfg, legacyImports: ["^REPLACE-with-your-legacy-module"] }));
|
|
260
|
+
r = run("--zero");
|
|
261
|
+
expect("--zero exits 2 while legacyImports holds the placeholder", r.status === 2 && /placeholder/.test(r.stderr), r.stdout + r.stderr);
|
|
262
|
+
w("scripts/legacy.json", JSON.stringify({ ...cfg, legacyImports: [] }));
|
|
263
|
+
expect("--zero import exits 2 with no legacyImports", run("--zero").status === 2);
|
|
264
|
+
expect("--zero raw needs no legacyImports", run("--zero", "palette").status === 0);
|
|
265
|
+
const { scan: _drop, ...noScan } = cfg;
|
|
266
|
+
w("scripts/legacy.json", JSON.stringify(noScan));
|
|
267
|
+
w("app/page.tsx", 'import { M } from "@/legacy/modal"\n');
|
|
268
|
+
r = run("--zero");
|
|
269
|
+
expect("with no scan set, app/ is scanned as well as src/", r.status === 1 && /app\/page.tsx import 1/.test(r.stdout), r.stdout + r.stderr);
|
|
270
|
+
const fresh = mkdtempSync(join(tmpdir(), "legacy-init-"));
|
|
271
|
+
mkdirSync(join(fresh, "app"));
|
|
272
|
+
writeFileSync(join(fresh, "app/page.tsx"), "export default () => null\n");
|
|
273
|
+
spawnSync(process.execPath, [SELF, "--root", fresh, "--init-config"], { encoding: "utf8" });
|
|
274
|
+
const made = JSON.parse(readFileSync(join(fresh, "scripts/legacy.json"), "utf8"));
|
|
275
|
+
r = spawnSync(process.execPath, [SELF, "--root", fresh, "--zero"], { encoding: "utf8" });
|
|
276
|
+
expect("--init-config scans the folders that exist and its placeholder fails until replaced", made.scan.join() === "app" && r.status === 2, JSON.stringify(made) + r.stderr);
|
|
277
|
+
rmSync(fresh, { recursive: true, force: true });
|
|
278
|
+
rmSync(dir, { recursive: true, force: true });
|
|
279
|
+
console.log(fails ? `${fails} failed` : "all as expected");
|
|
280
|
+
return fails ? 1 : 0;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if (process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1])) process.exitCode = main(process.argv.slice(2));
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// parity.mjs: the number and date parity tables. Node 18+, no dependencies.
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { join, resolve } from "node:path";
|
|
7
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
|
+
|
|
9
|
+
const SELF = fileURLToPath(import.meta.url);
|
|
10
|
+
|
|
11
|
+
const HELP = `parity.mjs number|date --old <module.mjs|results.json> --new <module.mjs|results.json> [--fn <name>] [--expect <file>] [--json]
|
|
12
|
+
parity.mjs date ... [--tz A,B,C] [--cases <file>]
|
|
13
|
+
parity.mjs --print-inputs | --self-test | --help
|
|
14
|
+
|
|
15
|
+
Runs the same inputs through the old and the new code and prints one row per input
|
|
16
|
+
case | old result | new result | expectation | verdict
|
|
17
|
+
A module exports the function (default export, or --fn name, default "parse" for number and "toPayload" for date). It takes
|
|
18
|
+
the typed text and returns the committed value, or throws to reject it. A results file is JSON {"<input>": result}
|
|
19
|
+
(for date {"<zone>": {"<input>": result}}) that you filled from the real controls in a browser. Every input needs a
|
|
20
|
+
result on both sides, and a date file every zone: a missing one fails its row, so an empty or half-filled file
|
|
21
|
+
never passes. Record a rejected input as {"rejected": true} and an empty commit as null.
|
|
22
|
+
number runs the 19 inputs: ${"2.5, -3, 1e3, 12.50, 0.123456789, 1,234.56, ' 42 ', '', abc, 12abc, 007, -0, a 20-digit number, 1.2.3, .5, 5., +3, a Unicode minus, '1 000'"}.
|
|
23
|
+
date runs each case in a child process once per zone (TZ is real). Default zones America/Los_Angeles, Asia/Tokyo, UTC,
|
|
24
|
+
Pacific/Auckland. Cases are a JSON list of strings. If the OLD code already answers differently per zone, the row
|
|
25
|
+
says "report it" and passes only while the new code matches. A fix is an announced "intended change" row.
|
|
26
|
+
Expectations file: {"<input or zone input>": "same" | "rejected" | "intended change" | "preexisting", "*": "same"}.
|
|
27
|
+
A value may also be {"expect": "intended change", "note": "why"}. Missing keys mean "same". An "intended change" row that does not change fails.
|
|
28
|
+
Exit 0 only when every row is as expected.`;
|
|
29
|
+
|
|
30
|
+
export const INPUTS = ["2.5", "-3", "1e3", "12.50", "0.123456789", "1,234.56", " 42 ", "", "abc", "12abc", "007", "-0", "99999999999999999999", "1.2.3", ".5", "5.", "+3", "−3", "1 000"];
|
|
31
|
+
export const ZONES = ["America/Los_Angeles", "Asia/Tokyo", "UTC", "Pacific/Auckland"];
|
|
32
|
+
export const DATE_CASES = ["2025-03-15", "2025-01-01", "2025-12-31", "2024-02-29", "2025-03-15T00:00:00.000Z"];
|
|
33
|
+
|
|
34
|
+
const sortKeys = (v) => (Array.isArray(v) ? v.map(sortKeys) : v && typeof v === "object" ? Object.fromEntries(Object.keys(v).sort().map((k) => [k, sortKeys(v[k])])) : v);
|
|
35
|
+
const stable = (v) => JSON.stringify(sortKeys(v)) ?? "undefined";
|
|
36
|
+
const same = (a, b) => stable(a) === stable(b);
|
|
37
|
+
|
|
38
|
+
// A child process computes {input: result} for one module in one zone.
|
|
39
|
+
async function childMain(argv) {
|
|
40
|
+
const get = (f) => argv[argv.indexOf(f) + 1];
|
|
41
|
+
const mod = await import(pathToFileURL(get("--module")).href);
|
|
42
|
+
const fn = mod[get("--fn")] ?? mod.default;
|
|
43
|
+
const out = {};
|
|
44
|
+
for (const input of JSON.parse(process.env.PARITY_INPUTS)) {
|
|
45
|
+
try { const v = await fn(input); out[input] = v instanceof Date ? v.toISOString() : v === undefined ? null : v; } catch (e) { out[input] = { rejected: true }; }
|
|
46
|
+
}
|
|
47
|
+
process.stdout.write(JSON.stringify(out));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// A results file answers only what it holds. A zone the file lacks is MISSING_ZONE, never the whole file.
|
|
51
|
+
const MISSING_ZONE = Symbol("missing zone");
|
|
52
|
+
function computeMap(spec, fn, inputs, tz) {
|
|
53
|
+
if (spec.endsWith(".json")) {
|
|
54
|
+
const j = JSON.parse(readFileSync(resolve(spec), "utf8"));
|
|
55
|
+
if (!j || typeof j !== "object" || Array.isArray(j)) throw new Error(`${spec} must be a JSON object`);
|
|
56
|
+
if (!tz) return j;
|
|
57
|
+
return j[tz] && typeof j[tz] === "object" ? j[tz] : MISSING_ZONE;
|
|
58
|
+
}
|
|
59
|
+
const r = spawnSync(process.execPath, [SELF, "--child", "--module", resolve(spec), "--fn", fn], { env: { ...process.env, ...(tz ? { TZ: tz } : {}), PARITY_INPUTS: JSON.stringify(inputs) }, encoding: "utf8" });
|
|
60
|
+
if (r.status !== 0) throw new Error(`${spec} failed${tz ? ` under TZ=${tz}` : ""}: ${(r.stderr || r.stdout).trim().split("\n").slice(-2).join(" ")}`);
|
|
61
|
+
return JSON.parse(r.stdout);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function runParity({ kind, oldSpec, newSpec, fn, inputs, zones, expect = {} }) {
|
|
65
|
+
const groups = kind === "date" ? zones : [null];
|
|
66
|
+
const maps = groups.map((tz) => ({ tz, old: computeMap(oldSpec, fn, inputs, tz), neu: computeMap(newSpec, fn, inputs, tz) }));
|
|
67
|
+
const has = (map, input) => map !== MISSING_ZONE && Object.prototype.hasOwnProperty.call(map, input);
|
|
68
|
+
const oldVaries = (input) => kind === "date" && maps.every((m) => has(m.old, input)) && !maps.every((m) => same(m.old[input], maps[0].old[input]));
|
|
69
|
+
const rows = [];
|
|
70
|
+
for (const m of maps) {
|
|
71
|
+
for (const input of inputs) {
|
|
72
|
+
const id = `${m.tz ? m.tz + " " : ""}${JSON.stringify(input)}`;
|
|
73
|
+
const e = expect[id] ?? expect[input] ?? expect["*"] ?? "same";
|
|
74
|
+
const want = String(e && typeof e === "object" ? e.expect : e).toLowerCase();
|
|
75
|
+
const o = has(m.old, input) ? m.old[input] : undefined;
|
|
76
|
+
const n = has(m.neu, input) ? m.neu[input] : undefined;
|
|
77
|
+
const eq = same(o, n);
|
|
78
|
+
const gone = [m.old === MISSING_ZONE && `old has no ${m.tz} results`, m.neu === MISSING_ZONE && `new has no ${m.tz} results`, m.old !== MISSING_ZONE && !has(m.old, input) && "old has no result", m.neu !== MISSING_ZONE && !has(m.neu, input) && "new has no result"].filter(Boolean);
|
|
79
|
+
let v;
|
|
80
|
+
if (gone.length) v = [`FAIL ${gone.join(", ")} for this input`, false];
|
|
81
|
+
else if (oldVaries(input) && want !== "intended change") v = eq ? ["ok (old answer is zone-dependent: report it, and fix it only as an intended change)", true] : ["FAIL changed a pre-existing zone-dependent answer with no intended change row", false];
|
|
82
|
+
else if (want === "same") v = eq ? ["ok", true] : ["FAIL differs, expected same", false];
|
|
83
|
+
else if (want === "rejected") v = n && n.rejected ? ["ok", true] : ["FAIL new did not reject", false];
|
|
84
|
+
else if (want === "intended change") v = eq ? ["FAIL no change, expected one", false] : ["ok (approve this change)", true];
|
|
85
|
+
else if (want === "preexisting") v = eq ? ["ok (pre-existing, report it)", true] : ["FAIL changed a pre-existing behaviour", false];
|
|
86
|
+
else v = [`FAIL unknown expectation "${want}"`, false];
|
|
87
|
+
rows.push({ id, old: o, neu: n, expectation: want, verdict: v[0], ok: v[1] });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return rows;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const trunc = (s, max) => (s.length > max ? s.slice(0, max - 1) + "~" : s);
|
|
94
|
+
const cell = (v, max = 40) => { if (v === undefined) return "(missing)"; const s = (typeof v === "string" ? JSON.stringify(v) : stable(v)).replace(/\s+/g, " "); return s.length > max ? s.slice(0, max - 1) + "~" : s; };
|
|
95
|
+
|
|
96
|
+
export function render(rows) {
|
|
97
|
+
const head = ["case", "old result", "new result", "expectation", "verdict"];
|
|
98
|
+
const body = rows.map((r) => [trunc(r.id, 44), cell(r.old), cell(r.neu), r.expectation, r.verdict]);
|
|
99
|
+
const w = head.map((h, i) => Math.max(h.length, ...body.map((b) => b[i].length)));
|
|
100
|
+
const line = (c) => c.map((x, i) => x.padEnd(w[i])).join(" | ").trimEnd();
|
|
101
|
+
const bad = rows.filter((r) => !r.ok).length;
|
|
102
|
+
return [line(head), w.map((n) => "-".repeat(n)).join("-+-"), ...body.map(line), "", bad ? `NOT as expected: ${bad} of ${rows.length} rows` : `all as expected (${rows.length} rows)`].join("\n");
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function selfTest() {
|
|
106
|
+
let fails = 0;
|
|
107
|
+
const t = (name, ok, detail = "") => { console.log(`${ok ? "ok " : "FAIL"} ${name}${ok ? "" : "\n" + detail}`); if (!ok) fails++; };
|
|
108
|
+
const dir = mkdtempSync(join(tmpdir(), "parity-"));
|
|
109
|
+
const mod = (n, src) => { const p = join(dir, n); writeFileSync(p, src); return p; };
|
|
110
|
+
const ref = mod("ref.mjs", `export const parse = (t) => { let s = String(t).trim().replace(/\\u2212/g, "-"); if (s === "") return null; if (/^[+-]?\\d{1,3}([, ]\\d{3})+$/.test(s)) s = s.replace(/[, ]/g, ""); if (!/^[+-]?\\d+$/.test(s)) throw new Error("no"); return s.replace(/^\\+/, ""); };`);
|
|
111
|
+
const ctl = mod("ctl.mjs", `import { parse as p } from "./ref.mjs"; export const parse = (t) => { if (String(t).trim().startsWith("+")) throw new Error("plus rejected"); return p(t); };`);
|
|
112
|
+
const bug = mod("bug.mjs", `export const parse = (t) => { const d = String(t).replace(/\\D/g, ""); return d === "" ? null : d; };`);
|
|
113
|
+
const num = (o, n, expect) => runParity({ kind: "number", oldSpec: o, newSpec: n, fn: "parse", inputs: INPUTS, expect });
|
|
114
|
+
t("19 number inputs", INPUTS.length === 19);
|
|
115
|
+
t("identical code passes", num(ref, ref).every((r) => r.ok));
|
|
116
|
+
t("digit-stripping code is flagged on 2.5, -3 and 1e3", ["\"2.5\"", "\"-3\"", "\"1e3\""].every((id) => num(ref, bug).some((r) => !r.ok && r.id === id)));
|
|
117
|
+
t("an intended rejection passes when recorded", num(ref, ctl, { "+3": "rejected" }).every((r) => r.ok));
|
|
118
|
+
t("an unrecorded change is flagged", num(ref, ctl).some((r) => !r.ok && r.id === "\"+3\""));
|
|
119
|
+
t("an intended change that does not change is flagged", num(ref, ref, { "+3": "intended change" }).some((r) => !r.ok));
|
|
120
|
+
const oj = join(dir, "old.json"), nj = join(dir, "new.json");
|
|
121
|
+
writeFileSync(oj, JSON.stringify({ "2.5": "2.5", "-3": "-3" }));
|
|
122
|
+
writeFileSync(nj, JSON.stringify({ "2.5": "25", "-3": "-3" }));
|
|
123
|
+
const jr = runParity({ kind: "number", oldSpec: oj, newSpec: nj, fn: "parse", inputs: ["2.5", "-3"] });
|
|
124
|
+
t("results files work: the hand-filled row that differs is flagged", jr.filter((r) => !r.ok).map((r) => r.id).join() === "\"2.5\"");
|
|
125
|
+
// An empty or half-filled results file once passed every row, because two missing values compare equal.
|
|
126
|
+
const ej = join(dir, "empty.json");
|
|
127
|
+
writeFileSync(ej, "{}");
|
|
128
|
+
t("two empty results files fail every row", runParity({ kind: "number", oldSpec: ej, newSpec: ej, fn: "parse", inputs: INPUTS }).every((r) => !r.ok && /no result/.test(r.verdict)));
|
|
129
|
+
const half = runParity({ kind: "number", oldSpec: oj, newSpec: nj, fn: "parse", inputs: ["2.5", "-3", "abc"] });
|
|
130
|
+
t("an input missing from the results fails its row", half.find((r) => r.id === "\"abc\"")?.ok === false);
|
|
131
|
+
t("a result missing on one side fails against a module", runParity({ kind: "number", oldSpec: ref, newSpec: ej, fn: "parse", inputs: ["-3"] }).every((r) => !r.ok && /new has no result/.test(r.verdict)));
|
|
132
|
+
|
|
133
|
+
const oldD = mod("old-d.mjs", `export const toPayload = (s) => String(s).slice(0, 10);`);
|
|
134
|
+
const goodD = mod("good-d.mjs", `export const toPayload = (s) => String(s).slice(0, 10);`);
|
|
135
|
+
const badD = mod("bad-d.mjs", `export const toPayload = (s) => new Date(s).toLocaleDateString("en-CA");`);
|
|
136
|
+
const date = (o, n, expect) => runParity({ kind: "date", oldSpec: o, newSpec: n, fn: "toPayload", inputs: DATE_CASES, zones: ZONES, expect });
|
|
137
|
+
t("date: a clean pair passes in four zones", date(oldD, goodD).every((r) => r.ok));
|
|
138
|
+
const bad = date(oldD, badD).filter((r) => !r.ok);
|
|
139
|
+
t("date: a local-time rewrite shifts a day in the west zone", bad.some((r) => r.id.startsWith("America/Los_Angeles")));
|
|
140
|
+
t("date: the east zone is not blamed for the west-zone defect", !bad.some((r) => r.id.startsWith("Asia/Tokyo \"2025-03-15\"")));
|
|
141
|
+
const pre = date(badD, badD);
|
|
142
|
+
t("date: a pre-existing zone bug passes while new equals old", pre.every((r) => r.ok) && pre.some((r) => /report it/.test(r.verdict)));
|
|
143
|
+
t("date: an unannounced fix is flagged", date(badD, goodD).some((r) => !r.ok && /pre-existing/.test(r.verdict)));
|
|
144
|
+
// A results file without a zone once fell back to the whole file, so the zone's rows compared garbage as equal.
|
|
145
|
+
const dz = join(dir, "dates.json");
|
|
146
|
+
writeFileSync(dz, JSON.stringify({ UTC: { "2025-03-15": "2025-03-15" } }));
|
|
147
|
+
const zr = runParity({ kind: "date", oldSpec: dz, newSpec: dz, fn: "toPayload", inputs: ["2025-03-15"], zones: ["UTC", "Asia/Tokyo"] });
|
|
148
|
+
t("date: a zone missing from a results file fails its rows", zr.find((r) => r.id.startsWith("UTC")).ok && zr.filter((r) => r.id.startsWith("Asia/Tokyo")).every((r) => !r.ok && /no Asia\/Tokyo results/.test(r.verdict)), JSON.stringify(zr));
|
|
149
|
+
rmSync(dir, { recursive: true, force: true });
|
|
150
|
+
console.log(fails ? `${fails} failed` : "all as expected");
|
|
151
|
+
return fails ? 1 : 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async function cli(argv) {
|
|
155
|
+
if (argv.includes("--child")) return childMain(argv);
|
|
156
|
+
if (argv.includes("--help") || argv.length === 0) return console.log(HELP);
|
|
157
|
+
if (argv.includes("--self-test")) { process.exitCode = selfTest(); return; }
|
|
158
|
+
if (argv.includes("--print-inputs")) return console.log(JSON.stringify({ number: INPUTS, date: DATE_CASES, zones: ZONES }, null, 2));
|
|
159
|
+
const kind = argv[0];
|
|
160
|
+
const flag = (f) => (argv.includes(f) ? argv[argv.indexOf(f) + 1] : undefined);
|
|
161
|
+
const unknown = argv.filter((a) => a.startsWith("--") && !["--old", "--new", "--fn", "--expect", "--json", "--tz", "--cases"].includes(a));
|
|
162
|
+
if (unknown.length) { console.error(`parity: unknown flag ${unknown.join(", ")}. See --help`); process.exitCode = 2; return; }
|
|
163
|
+
if (!["number", "date"].includes(kind) || !flag("--old") || !flag("--new")) { console.error("usage: parity.mjs number|date --old <x> --new <y>. See --help"); process.exitCode = 2; return; }
|
|
164
|
+
const rows = runParity({
|
|
165
|
+
kind, oldSpec: flag("--old"), newSpec: flag("--new"), fn: flag("--fn") || (kind === "number" ? "parse" : "toPayload"),
|
|
166
|
+
inputs: kind === "date" && flag("--cases") ? JSON.parse(readFileSync(flag("--cases"), "utf8")) : kind === "date" ? DATE_CASES : INPUTS,
|
|
167
|
+
zones: flag("--tz") ? flag("--tz").split(",") : ZONES, expect: flag("--expect") ? JSON.parse(readFileSync(flag("--expect"), "utf8")) : {},
|
|
168
|
+
});
|
|
169
|
+
console.log(argv.includes("--json") ? JSON.stringify(rows, null, 2) : render(rows));
|
|
170
|
+
process.exitCode = rows.every((r) => r.ok) ? 0 : 1;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1])) await cli(process.argv.slice(2));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Notice
|
|
2
|
+
|
|
3
|
+
This skill comes from https://github.com/arla6ka/design.how (`skills/token-mapping/SKILL.md`).
|
|
4
|
+
Licence: MIT (evidence: repository license, https://github.com/arla6ka/design.how/blob/main/LICENSE, checked 2026-11-09).
|
|
5
|
+
|
|
6
|
+
Luci converted it to the Luci Skill Standard: SKILL.md metadata keys and luci.json. The instructions are unchanged.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "token-mapping"
|
|
3
|
+
description: "Use to report how hardcoded style values on a page, file or diff map onto a project's existing design tokens, such as \"are we using our tokens here\", \"which hardcoded colors map to which tokens\", a token audit or planning a token migration. It never edits. Replacing the values is build-design-system."
|
|
4
|
+
license: "MIT"
|
|
5
|
+
metadata:
|
|
6
|
+
luci-category: "design-systems"
|
|
7
|
+
luci-author: "unknown"
|
|
8
|
+
luci-version: "1.0.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Token mapping
|
|
12
|
+
|
|
13
|
+
A read-only report that lands raw values (hex, px, shadows) on a token list someone else owns. Classes, normalising and tolerances are in `references/mapping-rules.md`. "Check the tokens on the settings page" is enough of an ask. Find the values and the list yourself.
|
|
14
|
+
|
|
15
|
+
## Steps
|
|
16
|
+
|
|
17
|
+
1. **Find the list.** Token files, theme entries, custom properties on `:root`, a component library's variable pairs. A framework's default theme is not the team's list, and neither is a public system's (Geist's names never stand in for the team's). Record its name, location and how you read it. If a read fails, say so and stop. Never fill a list from memory.
|
|
18
|
+
2. **Find the values.** What the person named, else the branch diff, else the product code. Record each with its file, line, property and job.
|
|
19
|
+
3. **Resolve.** Follow every alias to its final value in each mode. Write down every disagreement between two sources.
|
|
20
|
+
4. **Normalise** both sides (lengths to px, colours to OKLCH compared by delta E OK) with code, never by eye.
|
|
21
|
+
5. **Classify** each row once per mode. Purpose first, then value.
|
|
22
|
+
- Exact: the token's stated job covers the row and the values match.
|
|
23
|
+
- Semantic: the job covers it and the value is inside tolerance. State the difference in numbers.
|
|
24
|
+
- Ambiguous: two or more tokens fit and nothing picks one. Name every candidate.
|
|
25
|
+
- Gap: no token's job covers it, or the only fitting token is out of tolerance. A gap never gets a new name.
|
|
26
|
+
6. **Count and close.** When gaps are over 30% of rows and number 12 or more, the list is usually the wrong one. Say so, still deliver the table, and lead with `Status: not actionable (gap threshold)`.
|
|
27
|
+
|
|
28
|
+
## Report
|
|
29
|
+
|
|
30
|
+
Summary, Mapping, Do not use (a token whose value matches but whose job differs), Ambiguous, Gaps, For a person to decide, Source. Last line `Coverage:` with what was scanned and what was not. Run on its own, the chat reply gives the answer with its numbers and one prompt the person can paste to take the next step.
|
|
31
|
+
|
|
32
|
+
## Rules
|
|
33
|
+
|
|
34
|
+
- A match on value before purpose is wrong. Wrong: `#6b7280` mapped to `color.border.default` because the hex is equal. Right: it is text, so the candidates are text tokens, and the border token goes in Do not use.
|
|
35
|
+
- A semantic token wins over the primitive it aliases. Map to a primitive only when no semantic token covers the job, and say so.
|
|
36
|
+
- A palette class (`text-gray-500`) names a value and no job. It gets a row, counted apart from raw values.
|
|
37
|
+
- Anything inferred rather than read, such as a job taken from a class name, is marked inferred.
|
|
38
|
+
- Counts carry their unit: occurrences, lines or mapping rows.
|
|
39
|
+
|
|
40
|
+
## Stops
|
|
41
|
+
|
|
42
|
+
Stop and report on these only. No list exists. One name has two values in the same mode. Two sources disagree and no project rule says which wins (report both). Return what stopped it, the groundwork so far, and the shortest message that unblocks it, such as "Paste `tokens.json` or give its path."
|
|
43
|
+
|
|
44
|
+
## Done
|
|
45
|
+
|
|
46
|
+
Every row has a job, a class and a reason. Every ambiguous row names two or more candidates. Nothing in the repo changed (`git status` is the same before and after). The last line reads `Coverage:`.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lss": 1,
|
|
3
|
+
"lastVerified": "2026-11-09",
|
|
4
|
+
"source": {
|
|
5
|
+
"repo": "arla6ka/design.how",
|
|
6
|
+
"path": "skills/token-mapping/SKILL.md",
|
|
7
|
+
"licenseVerified": true,
|
|
8
|
+
"licenseStatus": "open",
|
|
9
|
+
"licenseEvidence": "repository license",
|
|
10
|
+
"licenseUrl": "https://github.com/arla6ka/design.how/blob/main/LICENSE",
|
|
11
|
+
"licenseCheckedAt": "2026-11-09"
|
|
12
|
+
},
|
|
13
|
+
"whenToUse": [
|
|
14
|
+
"Reporting how hardcoded style values on a page, file or diff map onto the project's existing design tokens, such as a token audit or planning a token migration."
|
|
15
|
+
],
|
|
16
|
+
"summary": "Use to report how hardcoded style values on a page, file or diff map onto a project's existing design tokens, such as \"are we using our tokens here\", \"which hardcoded colors map to which tokens\", a token audit or planning a token migration. It never edits.",
|
|
17
|
+
"domains": [
|
|
18
|
+
"design",
|
|
19
|
+
"web"
|
|
20
|
+
],
|
|
21
|
+
"derived": [
|
|
22
|
+
"domains",
|
|
23
|
+
"summary"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Mapping rules
|
|
2
|
+
|
|
3
|
+
Replace the categories, tolerances and threshold with your team's before the first real run. The skill treats this file as agreed.
|
|
4
|
+
|
|
5
|
+
## Classes
|
|
6
|
+
|
|
7
|
+
One class per row per mode. Purpose is checked first, then value. A value that equals a token but serves another job is never a match. It becomes ambiguous or a gap, and the token goes in Do not use.
|
|
8
|
+
|
|
9
|
+
**Not mapped** (counted in the Summary, no row): a role token with alpha applied (`color-mix()` over its `var()`, a utility's alpha modifier), and values in the `graphic` category (logo art, illustrations, decorative gradient stops).
|
|
10
|
+
|
|
11
|
+
If the list states no purposes at all, the run matches values only. Each reason begins "Value only", Do not use stays empty because it cannot be checked, and the report adds Consistency by role. A palette-only list (`gray-500` with no roles) makes almost every palette row Exact by definition, so Consistency by role becomes the main output and the table keeps only rows that are not Exact.
|
|
12
|
+
|
|
13
|
+
## Categories
|
|
14
|
+
|
|
15
|
+
A candidate belongs to the same category as the row's job.
|
|
16
|
+
|
|
17
|
+
- Colour by role: surface, text, border, icon, action, focus, status.
|
|
18
|
+
- Spacing by job: inset (inside a component) and gap (between items). One scale often serves both, so record which job the row does.
|
|
19
|
+
- Size, radius, border width, typography (family, size, weight, line height, letter spacing), shadow (each part its own row), opacity, motion (duration, easing), z-index.
|
|
20
|
+
|
|
21
|
+
A row whose job cannot be read is ambiguous when the jobs it might do give two or more candidates, and a gap marked "job unread" otherwise.
|
|
22
|
+
|
|
23
|
+
## Normalising
|
|
24
|
+
|
|
25
|
+
- Lengths to px. A 16 px root for `rem` unless the project sets another. Line height to a unitless ratio.
|
|
26
|
+
- Colours to OKLCH plus alpha. `build-design-system/scripts/oklch.mjs` reads hex (3, 4, 6, 8 digits), `rgb()`, `hsl()`, `hwb()`, `oklch()`, `oklab()` and the CSS named colours, each with its alpha, and prints the OKLCH. It does not read `color()`, `lab()`, `lch()`, `color-mix()` or a relative colour. Resolve those with a browser's computed style, and say so in Source. Compare by delta E OK (OKLab distance times 100), which `oklch.mjs --delta` prints. Under 0.5 is identical, which absorbs 8-bit rounding.
|
|
27
|
+
- Alpha is part of the colour. `#0F172A` at 80% is not `#0F172A`: `--delta` prints both alphas and says `alpha differs` past the opacity tolerance, and such a pair is never Exact.
|
|
28
|
+
|
|
29
|
+
## Tolerances
|
|
30
|
+
|
|
31
|
+
Applied only after purpose fits, and never turn a wrong-purpose token into a match. A difference equal to the limit is inside it.
|
|
32
|
+
|
|
33
|
+
| Category | Limit |
|
|
34
|
+
|---|---|
|
|
35
|
+
| Colour | delta E OK 2 |
|
|
36
|
+
| Spacing, size, radius | 2 px |
|
|
37
|
+
| Font size | 1 px |
|
|
38
|
+
| Line height | 0.05 as a ratio |
|
|
39
|
+
| Letter spacing | 0.01 em |
|
|
40
|
+
| Opacity | 0.02 |
|
|
41
|
+
| Duration | 30 ms |
|
|
42
|
+
| Border width, weight, family, easing | none |
|
|
43
|
+
|
|
44
|
+
## Consistency by role
|
|
45
|
+
|
|
46
|
+
Written when the list states no purposes or the ask is about consistency. Group every colour row by role. For each role give the distinct values with counts, their spread in delta E OK, and near pairs (under 5) that likely mean one thing.
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
Text: 6 values over 200 rows. gray-500 (80), gray-600 (60), #666 (10) sit within delta E OK 4 and likely mean one muted text.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Source conflicts
|
|
53
|
+
|
|
54
|
+
Two sources that disagree on a value go in Source with both sides. A project rule that says which wins is quoted. Otherwise neither is chosen and the question goes to For a person to decide.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Notice
|
|
2
|
+
|
|
3
|
+
This skill comes from https://github.com/arla6ka/design.how (`skills/ui-review/SKILL.md`).
|
|
4
|
+
Licence: MIT (evidence: repository license, https://github.com/arla6ka/design.how/blob/main/LICENSE, checked 2026-11-09).
|
|
5
|
+
|
|
6
|
+
Luci converted it to the Luci Skill Standard: SKILL.md metadata keys and luci.json. The instructions are unchanged.
|