@bastani/atomic 0.9.20-alpha.4 → 0.9.20-alpha.5

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.
Files changed (245) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/intercom/skills/intercom/SKILL.md +32 -1
  5. package/dist/builtin/mcp/package.json +1 -1
  6. package/dist/builtin/subagents/CHANGELOG.md +12 -0
  7. package/dist/builtin/subagents/README.md +2 -0
  8. package/dist/builtin/subagents/agents/code-simplifier.md +1 -1
  9. package/dist/builtin/subagents/agents/codebase-analyzer.md +1 -1
  10. package/dist/builtin/subagents/agents/codebase-online-researcher.md +3 -3
  11. package/dist/builtin/subagents/agents/debugger.md +7 -5
  12. package/dist/builtin/subagents/agents/worker.md +4 -2
  13. package/dist/builtin/subagents/package.json +1 -1
  14. package/dist/builtin/subagents/skills/agent-browser/SKILL.md +56 -0
  15. package/dist/builtin/subagents/skills/subagent/SKILL.md +32 -8
  16. package/dist/builtin/subagents/src/extension/index.bundle.mjs +7 -4
  17. package/dist/builtin/web-access/package.json +1 -1
  18. package/dist/builtin/workflows/CHANGELOG.md +30 -0
  19. package/dist/builtin/workflows/README.md +4 -2
  20. package/dist/builtin/workflows/builtin/adversarial-verification.js +3 -3
  21. package/dist/builtin/workflows/builtin/{chunk-n8g2da69.js → chunk-00ywx588.js} +1 -1
  22. package/dist/builtin/workflows/builtin/{chunk-d1xqh1rd.js → chunk-55p5dxjk.js} +1 -1
  23. package/dist/builtin/workflows/builtin/{chunk-1dydq7w3.js → chunk-7f381xnq.js} +62 -24
  24. package/dist/builtin/workflows/builtin/{chunk-k18g9me8.js → chunk-7h7s5xdj.js} +1 -1
  25. package/dist/builtin/workflows/builtin/{chunk-n4yxrsm9.js → chunk-e83tc6nr.js} +1 -1
  26. package/dist/builtin/workflows/builtin/{chunk-sn5mchnx.js → chunk-evfb0312.js} +1 -1
  27. package/dist/builtin/workflows/builtin/{chunk-scgprmdj.js → chunk-ne6vh5ct.js} +1 -1
  28. package/dist/builtin/workflows/builtin/{chunk-119kxb28.js → chunk-pfm1kgqz.js} +62 -43
  29. package/dist/builtin/workflows/builtin/{chunk-hnbbb5r0.js → chunk-tdqvdrg1.js} +4 -4
  30. package/dist/builtin/workflows/builtin/{chunk-kf5xpbkz.js → chunk-tvcydq13.js} +1 -1
  31. package/dist/builtin/workflows/builtin/{chunk-9y0f90rd.js → chunk-x2nftpgj.js} +1 -1
  32. package/dist/builtin/workflows/builtin/{chunk-vt9zgr9d.js → chunk-zj5162bh.js} +4 -4
  33. package/dist/builtin/workflows/builtin/classify-and-act.js +3 -3
  34. package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +3 -3
  35. package/dist/builtin/workflows/builtin/generate-and-filter.js +3 -3
  36. package/dist/builtin/workflows/builtin/goal.js +4 -4
  37. package/dist/builtin/workflows/builtin/index.d.ts +1 -1
  38. package/dist/builtin/workflows/builtin/index.js +12 -12
  39. package/dist/builtin/workflows/builtin/loop-until-done.js +3 -3
  40. package/dist/builtin/workflows/builtin/open-claude-design.d.ts +1 -1
  41. package/dist/builtin/workflows/builtin/open-claude-design.js +3 -3
  42. package/dist/builtin/workflows/builtin/ralph.js +4 -4
  43. package/dist/builtin/workflows/builtin/steering-context.js +1 -1
  44. package/dist/builtin/workflows/builtin/tournament.js +3 -3
  45. package/dist/builtin/workflows/package.json +1 -1
  46. package/dist/builtin/workflows/skills/impeccable/SKILL.md +18 -11
  47. package/dist/builtin/workflows/skills/impeccable/reference/adapt.md +1 -1
  48. package/dist/builtin/workflows/skills/impeccable/reference/adapt.native.md +1 -1
  49. package/dist/builtin/workflows/skills/impeccable/reference/animate.md +1 -1
  50. package/dist/builtin/workflows/skills/impeccable/reference/audit.md +5 -5
  51. package/dist/builtin/workflows/skills/impeccable/reference/audit.native.md +6 -6
  52. package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +2 -2
  53. package/dist/builtin/workflows/skills/impeccable/reference/clarify.md +1 -1
  54. package/dist/builtin/workflows/skills/impeccable/reference/colorize.md +1 -1
  55. package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +0 -6
  56. package/dist/builtin/workflows/skills/impeccable/reference/critique.md +19 -41
  57. package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +11 -65
  58. package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +3 -3
  59. package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +4 -4
  60. package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +1 -1
  61. package/dist/builtin/workflows/skills/impeccable/reference/delight.md +1 -1
  62. package/dist/builtin/workflows/skills/impeccable/reference/distill.md +2 -2
  63. package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +4 -4
  64. package/dist/builtin/workflows/skills/impeccable/reference/document.md +4 -4
  65. package/dist/builtin/workflows/skills/impeccable/reference/extract.md +1 -1
  66. package/dist/builtin/workflows/skills/impeccable/reference/harden.md +1 -1
  67. package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +21 -21
  68. package/dist/builtin/workflows/skills/impeccable/reference/init.md +8 -8
  69. package/dist/builtin/workflows/skills/impeccable/reference/layout.md +2 -2
  70. package/dist/builtin/workflows/skills/impeccable/reference/live-setup.md +10 -8
  71. package/dist/builtin/workflows/skills/impeccable/reference/live.md +39 -38
  72. package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +48 -21
  73. package/dist/builtin/workflows/skills/impeccable/reference/onboard.md +1 -1
  74. package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +1 -1
  75. package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +1 -1
  76. package/dist/builtin/workflows/skills/impeccable/reference/polish.md +11 -3
  77. package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +2 -2
  78. package/dist/builtin/workflows/skills/impeccable/reference/routing.md +13 -7
  79. package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +2 -2
  80. package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +13 -19
  81. package/dist/builtin/workflows/skills/impeccable/scripts/VERSION +1 -0
  82. package/dist/builtin/workflows/skills/impeccable/scripts/data/font-index-failures.json +121 -0
  83. package/dist/builtin/workflows/skills/impeccable/scripts/data/font-index.json +1 -0
  84. package/dist/builtin/workflows/skills/impeccable/scripts/impeccable +212 -0
  85. package/dist/builtin/workflows/skills/impeccable/scripts/impeccable.cmd +218 -0
  86. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-dom.js +21 -0
  87. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-ignores.js +242 -0
  88. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-session.js +25 -4
  89. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +666 -197
  90. package/dist/builtin/workflows/skills/research-codebase/SKILL.md +1 -1
  91. package/dist/builtin/workflows/src/extension/index.bundle.mjs +156 -84
  92. package/dist/builtin/workflows/src/index.js +62 -24
  93. package/dist/core/execution-model-router.d.ts +2 -0
  94. package/dist/core/execution-model-router.d.ts.map +1 -1
  95. package/dist/core/execution-model-router.js +30 -4
  96. package/dist/core/execution-model-router.js.map +1 -1
  97. package/dist/core/model-routing-task.d.ts +1 -1
  98. package/dist/core/model-routing-task.d.ts.map +1 -1
  99. package/dist/core/model-routing-task.js +4 -3
  100. package/dist/core/model-routing-task.js.map +1 -1
  101. package/dist/core/system-prompt.d.ts.map +1 -1
  102. package/dist/core/system-prompt.js +2 -1
  103. package/dist/core/system-prompt.js.map +1 -1
  104. package/dist/index.d.ts +1 -1
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +1 -1
  107. package/dist/index.js.map +1 -1
  108. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  109. package/dist/modes/interactive/components/chat-message-renderer.js +4 -0
  110. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  111. package/docs/computer-use.md +22 -21
  112. package/docs/getting-started/first-session.md +2 -2
  113. package/docs/getting-started/installation.md +6 -2
  114. package/docs/intercom.md +6 -1
  115. package/docs/models/model-selection.md +11 -7
  116. package/docs/quickstart.md +1 -1
  117. package/docs/skills.md +1 -1
  118. package/docs/subagents/reference.md +2 -2
  119. package/docs/subagents.md +7 -1
  120. package/docs/usage.md +2 -0
  121. package/docs/windows.md +1 -1
  122. package/docs/workflows/api-reference.md +3 -4
  123. package/docs/workflows/builtins.md +2 -2
  124. package/docs/workflows/operations.md +1 -1
  125. package/docs/workflows/reliable-design.md +12 -1
  126. package/docs/workflows/verification.md +8 -8
  127. package/npm-shrinkwrap.json +32 -32
  128. package/package.json +3 -3
  129. package/dist/builtin/subagents/skills/playwright-cli/SKILL.md +0 -420
  130. package/dist/builtin/subagents/skills/playwright-cli/references/element-attributes.md +0 -23
  131. package/dist/builtin/subagents/skills/playwright-cli/references/playwright-tests.md +0 -39
  132. package/dist/builtin/subagents/skills/playwright-cli/references/request-mocking.md +0 -87
  133. package/dist/builtin/subagents/skills/playwright-cli/references/running-code.md +0 -241
  134. package/dist/builtin/subagents/skills/playwright-cli/references/session-management.md +0 -225
  135. package/dist/builtin/subagents/skills/playwright-cli/references/storage-state.md +0 -275
  136. package/dist/builtin/subagents/skills/playwright-cli/references/test-generation.md +0 -433
  137. package/dist/builtin/subagents/skills/playwright-cli/references/tracing.md +0 -139
  138. package/dist/builtin/subagents/skills/playwright-cli/references/video-recording.md +0 -143
  139. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_asset_producer.toml +0 -94
  140. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_documenter.toml +0 -27
  141. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_finish_reviewer.toml +0 -41
  142. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_manual_edit_applier.toml +0 -95
  143. package/dist/builtin/workflows/skills/impeccable/agents/openai.yaml +0 -4
  144. package/dist/builtin/workflows/skills/impeccable/scripts/concept-seed.mjs +0 -695
  145. package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +0 -325
  146. package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +0 -1503
  147. package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +0 -222
  148. package/dist/builtin/workflows/skills/impeccable/scripts/detect-csp.mjs +0 -198
  149. package/dist/builtin/workflows/skills/impeccable/scripts/detect.mjs +0 -21
  150. package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +0 -2073
  151. package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +0 -432
  152. package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +0 -1121
  153. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +0 -8746
  154. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns.mjs +0 -51
  155. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +0 -376
  156. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +0 -1168
  157. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +0 -1192
  158. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +0 -290
  159. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -189
  160. package/dist/builtin/workflows/skills/impeccable/scripts/detector/findings.mjs +0 -18
  161. package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +0 -213
  162. package/dist/builtin/workflows/skills/impeccable/scripts/detector/profile/profiler.mjs +0 -166
  163. package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +0 -617
  164. package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +0 -5534
  165. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/color.mjs +0 -588
  166. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/constants.mjs +0 -112
  167. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/fonts.mjs +0 -30
  168. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/inline-ignores.mjs +0 -148
  169. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/page.mjs +0 -35
  170. package/dist/builtin/workflows/skills/impeccable/scripts/doctor.mjs +0 -338
  171. package/dist/builtin/workflows/skills/impeccable/scripts/embed-prompt.mjs +0 -270
  172. package/dist/builtin/workflows/skills/impeccable/scripts/generate-image.mjs +0 -277
  173. package/dist/builtin/workflows/skills/impeccable/scripts/hook-admin.mjs +0 -783
  174. package/dist/builtin/workflows/skills/impeccable/scripts/hook-lib.mjs +0 -2305
  175. package/dist/builtin/workflows/skills/impeccable/scripts/hook.mjs +0 -78
  176. package/dist/builtin/workflows/skills/impeccable/scripts/lib/artifact-schema.mjs +0 -93
  177. package/dist/builtin/workflows/skills/impeccable/scripts/lib/composition-catalog.mjs +0 -200
  178. package/dist/builtin/workflows/skills/impeccable/scripts/lib/concept-catalog.mjs +0 -395
  179. package/dist/builtin/workflows/skills/impeccable/scripts/lib/design-parser.mjs +0 -925
  180. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +0 -640
  181. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-paths.mjs +0 -137
  182. package/dist/builtin/workflows/skills/impeccable/scripts/lib/is-generated.mjs +0 -72
  183. package/dist/builtin/workflows/skills/impeccable/scripts/lib/open-system-browser.mjs +0 -57
  184. package/dist/builtin/workflows/skills/impeccable/scripts/lib/provider.mjs +0 -5
  185. package/dist/builtin/workflows/skills/impeccable/scripts/lib/roll-selection.mjs +0 -369
  186. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-deep.mjs +0 -483
  187. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-notice.mjs +0 -169
  188. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness.mjs +0 -528
  189. package/dist/builtin/workflows/skills/impeccable/scripts/lib/surface-briefs.mjs +0 -151
  190. package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-args.mjs +0 -42
  191. package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-slug.mjs +0 -33
  192. package/dist/builtin/workflows/skills/impeccable/scripts/lib/template-extensions.mjs +0 -146
  193. package/dist/builtin/workflows/skills/impeccable/scripts/live/accept-css.mjs +0 -617
  194. package/dist/builtin/workflows/skills/impeccable/scripts/live/accept-verify.mjs +0 -71
  195. package/dist/builtin/workflows/skills/impeccable/scripts/live/browser-script-parts.mjs +0 -77
  196. package/dist/builtin/workflows/skills/impeccable/scripts/live/completion.mjs +0 -28
  197. package/dist/builtin/workflows/skills/impeccable/scripts/live/event-validation.mjs +0 -199
  198. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/astro.mjs +0 -47
  199. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/detect-utils.mjs +0 -157
  200. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/index.mjs +0 -143
  201. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/journal.mjs +0 -205
  202. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/nextjs.mjs +0 -49
  203. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/nuxt.mjs +0 -170
  204. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/script-src.mjs +0 -26
  205. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/static-html.mjs +0 -26
  206. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/sveltekit.mjs +0 -71
  207. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/tag-strategy.mjs +0 -247
  208. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/tanstack-start.mjs +0 -70
  209. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/vite-generic.mjs +0 -42
  210. package/dist/builtin/workflows/skills/impeccable/scripts/live/generation-preflight.mjs +0 -149
  211. package/dist/builtin/workflows/skills/impeccable/scripts/live/insert-ui.mjs +0 -458
  212. package/dist/builtin/workflows/skills/impeccable/scripts/live/instructions.mjs +0 -169
  213. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-apply.mjs +0 -939
  214. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-edit-routes.mjs +0 -357
  215. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-edits-buffer.mjs +0 -152
  216. package/dist/builtin/workflows/skills/impeccable/scripts/live/poll-lanes.mjs +0 -14
  217. package/dist/builtin/workflows/skills/impeccable/scripts/live/roots.mjs +0 -670
  218. package/dist/builtin/workflows/skills/impeccable/scripts/live/session-store.mjs +0 -563
  219. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-lock.mjs +0 -105
  220. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-search.mjs +0 -105
  221. package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-ast.mjs +0 -969
  222. package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-component.mjs +0 -1401
  223. package/dist/builtin/workflows/skills/impeccable/scripts/live/sveltekit-adapter.mjs +0 -314
  224. package/dist/builtin/workflows/skills/impeccable/scripts/live/tanstack-adapter.mjs +0 -280
  225. package/dist/builtin/workflows/skills/impeccable/scripts/live/ui-surfaces.mjs +0 -75
  226. package/dist/builtin/workflows/skills/impeccable/scripts/live/vocabulary.mjs +0 -171
  227. package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +0 -961
  228. package/dist/builtin/workflows/skills/impeccable/scripts/live-commit-manual-edits.mjs +0 -1244
  229. package/dist/builtin/workflows/skills/impeccable/scripts/live-complete.mjs +0 -107
  230. package/dist/builtin/workflows/skills/impeccable/scripts/live-copy-edit-agent.mjs +0 -800
  231. package/dist/builtin/workflows/skills/impeccable/scripts/live-discard-manual-edits.mjs +0 -51
  232. package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +0 -515
  233. package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +0 -292
  234. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +0 -371
  235. package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +0 -427
  236. package/dist/builtin/workflows/skills/impeccable/scripts/live-resume.mjs +0 -123
  237. package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +0 -1675
  238. package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +0 -71
  239. package/dist/builtin/workflows/skills/impeccable/scripts/live-target.mjs +0 -30
  240. package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +0 -927
  241. package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +0 -365
  242. package/dist/builtin/workflows/skills/impeccable/scripts/palette.mjs +0 -628
  243. package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +0 -224
  244. package/dist/builtin/workflows/skills/impeccable/scripts/serve-question.mjs +0 -1540
  245. package/dist/builtin/workflows/skills/impeccable/scripts/surface-brief.mjs +0 -74
@@ -1,290 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
-
4
- import { GENERIC_FONTS, OVERUSED_FONTS } from '../../shared/constants.mjs';
5
- import {
6
- checkSourceDesignSystem,
7
- collectStaticDesignSystemFindings,
8
- mergeDesignSystemFindings,
9
- } from '../../design-system.mjs';
10
- import { isFullPage } from '../../shared/page.mjs';
11
- import { applyInlineIgnores } from '../../shared/inline-ignores.mjs';
12
- import { finding } from '../../findings.mjs';
13
- import { profileFindings, profileStep, profileStepAsync } from '../../profile/profiler.mjs';
14
- import {
15
- checkElementBorders,
16
- checkElementClippedOverflow,
17
- checkElementColors,
18
- checkElementGlow,
19
- checkElementGptBorderShadow,
20
- checkElementHeroEyebrow,
21
- checkElementHoverContrast,
22
- checkElementIconTile,
23
- checkElementItalicSerif,
24
- checkElementMotion,
25
- checkElementOversizedH1,
26
- checkElementQuality,
27
- checkElementRadialSpotlight,
28
- checkCreamPalette,
29
- checkHtmlPatterns,
30
- checkKickerAboveHeadingFromDoc,
31
- scopedIgnoreActive,
32
- checkNumberedSectionLabelsFromDoc,
33
- checkPageLayout,
34
- checkPageQualityFromDoc,
35
- checkRepeatedContainerTextFromDoc,
36
- resolveBackground,
37
- resolveBorderRadiusPx,
38
- } from '../../rules/checks.mjs';
39
- import { detectText, runTextContentAnalyzers } from '../regex/detect-text.mjs';
40
- import {
41
- StaticDocument,
42
- buildStaticStyleMap,
43
- buildStaticWindow,
44
- collectStaticCssText,
45
- } from './css-cascade.mjs';
46
-
47
- function checkStaticPageTypography(document, window) {
48
- const findings = [];
49
- const fonts = new Set();
50
- const overusedFound = new Set();
51
- for (const el of document.querySelectorAll('p, h1, h2, h3, h4, h5, h6, li, td, th, dd, blockquote, figcaption, a, button, label, span, div')) {
52
- const hasText = el.childNodes.some(n => n.nodeType === 3 && n.textContent.trim().length > 0);
53
- if (!hasText) continue;
54
- const ff = window.getComputedStyle(el).fontFamily || '';
55
- const stack = ff.split(',').map(f => f.trim().replace(/^['"]|['"]$/g, '').toLowerCase());
56
- const primary = stack.find(f => f && !GENERIC_FONTS.has(f));
57
- if (!primary) continue;
58
- fonts.add(primary);
59
- if (OVERUSED_FONTS.has(primary)) overusedFound.add(primary);
60
- }
61
- for (const font of overusedFound) {
62
- findings.push({ id: 'overused-font', snippet: `Primary font: ${font}` });
63
- }
64
- const sizes = new Set();
65
- for (const el of document.querySelectorAll('h1, h2, h3, h4, h5, h6, p, span, a, li, td, th, label, button, div')) {
66
- const fontSize = parseFloat(window.getComputedStyle(el).fontSize);
67
- if (fontSize >= 8 && fontSize < 200) sizes.add(Math.round(fontSize * 10) / 10);
68
- }
69
- if (sizes.size >= 3) {
70
- const sorted = [...sizes].sort((a, b) => a - b);
71
- const ratio = sorted[sorted.length - 1] / sorted[0];
72
- if (ratio < 2.0) {
73
- findings.push({ id: 'flat-type-hierarchy', snippet: `Sizes: ${sorted.map(s => s + 'px').join(', ')} (ratio ${ratio.toFixed(1)}:1)` });
74
- }
75
- }
76
- return findings;
77
- }
78
-
79
- function checkElementBrokenImage(el) {
80
- const src = (el.getAttribute && el.getAttribute('src')) ?? el.attribs?.src;
81
- // Missing src attribute entirely
82
- if (src === undefined || src === null) {
83
- return [{ id: 'broken-image', snippet: '<img> with no src attribute' }];
84
- }
85
- const trimmed = String(src).trim();
86
- // Empty or placeholder-only src values
87
- if (trimmed === '' || trimmed === '#') {
88
- return [{ id: 'broken-image', snippet: `<img src="${src}">` }];
89
- }
90
- return [];
91
- }
92
-
93
- const STATIC_ELEMENT_RULES = [
94
- { id: 'border-rules', selector: '*', run: (el, tag, style, window, customPropMap) => checkElementBorders(tag, style, null, resolveBorderRadiusPx(el, style, parseFloat(style.width) || 0, window), el) },
95
- { id: 'color-rules', selector: '*', run: (el, tag, style, window, customPropMap) => checkElementColors(el, style, tag, window, customPropMap, false) },
96
- { id: 'hover-color-rules', selector: '*', run: (el, tag, style, window) => checkElementHoverContrast(el, style, tag, window) },
97
- { id: 'dark-glow', selector: '*', run: (el, tag, style, window, customPropMap) => checkElementGlow(tag, style, resolveBackground(el.parentElement || el, window, customPropMap)) },
98
- { id: 'motion-rules', selector: '*', run: (el, tag, style) => checkElementMotion(tag, style) },
99
- { id: 'icon-tile-stack', selector: 'h1,h2,h3,h4,h5,h6', run: (el, tag, _style, window) => checkElementIconTile(el, tag, window) },
100
- { id: 'italic-serif-display', selector: 'h1,h2', run: (el, tag, style) => checkElementItalicSerif(el, style, tag) },
101
- { id: 'hero-eyebrow-chip', selector: 'h1', run: (el, tag, style, window, customPropMap) => checkElementHeroEyebrow(el, style, tag, window, customPropMap) },
102
- { id: 'broken-image', selector: 'img', run: (el) => checkElementBrokenImage(el) },
103
- { id: 'quality-rules', selector: '*', run: (el, tag, style, window) => checkElementQuality(el, style, tag, window) },
104
- { id: 'oversized-h1', selector: 'h1', run: (el, tag, style, window) => checkElementOversizedH1(el, style, tag, window) },
105
- { id: 'clipped-overflow-container', selector: '*', run: (el, tag, style, window) => checkElementClippedOverflow(el, style, tag, window) },
106
- { id: 'gpt-thin-border-wide-shadow', selector: '*', run: (el, tag, style) => checkElementGptBorderShadow(el, style) },
107
- { id: 'radial-spotlight-glow', selector: '*', run: (el, tag, style, window) => checkElementRadialSpotlight(el, style, tag, window) },
108
- ];
109
-
110
- async function detectHtml(filePath, options = {}) {
111
- const profile = options?.profile;
112
- const html = profileStep(profile, {
113
- engine: 'static-html',
114
- phase: 'setup',
115
- ruleId: 'read-html',
116
- target: filePath,
117
- }, () => fs.readFileSync(filePath, 'utf-8'));
118
-
119
- let modules;
120
- try {
121
- modules = await profileStepAsync(profile, {
122
- engine: 'static-html',
123
- phase: 'setup',
124
- ruleId: 'import-static-parser',
125
- target: filePath,
126
- }, async () => {
127
- const [htmlparser2, cssSelect, csstree, domutils] = await Promise.all([
128
- import('htmlparser2'),
129
- import('css-select'),
130
- import('css-tree'),
131
- import('domutils'),
132
- ]);
133
- return {
134
- parseDocument: htmlparser2.parseDocument,
135
- selectAll: cssSelect.selectAll,
136
- selectOne: cssSelect.selectOne,
137
- is: cssSelect.is,
138
- csstree,
139
- domutils,
140
- };
141
- });
142
- } catch (err) {
143
- if (!globalThis.__impeccableStaticHtmlWarned) {
144
- globalThis.__impeccableStaticHtmlWarned = true;
145
-
146
- process.stderr.write(
147
- 'impeccable detect: DEGRADED - HTML parser modules unavailable ' +
148
- '(htmlparser2, css-select, css-tree, domutils).\n' +
149
- 'Falling back to regex matching. Custom properties, selector matching and computed ' +
150
- 'contrast are NOT evaluated; findings are an undercount, not a clean bill of health.\n'
151
- );
152
- }
153
-
154
- return detectText(html, filePath, options);
155
- }
156
-
157
- const resolvedPath = path.resolve(filePath);
158
- const fileDir = path.dirname(resolvedPath);
159
- const root = profileStep(profile, {
160
- engine: 'static-html',
161
- phase: 'parse-html',
162
- ruleId: 'parse-document',
163
- target: filePath,
164
- }, () => modules.parseDocument(html, { lowerCaseAttributeNames: false, lowerCaseTags: true }));
165
-
166
- const cssText = collectStaticCssText(root, fileDir, profile, filePath, modules);
167
- const document = new StaticDocument(root, modules);
168
- buildStaticStyleMap(root, document, cssText, modules, profile, filePath);
169
- const window = buildStaticWindow(document);
170
-
171
- const customPropMap = null;
172
-
173
- const findings = [];
174
- const runElementCheck = (ruleId, callback) => profile
175
- ? profileFindings(profile, { engine: 'static-html', phase: 'element', ruleId, target: filePath }, callback)
176
- : callback();
177
-
178
- const visitedByRule = new Map();
179
- for (const rule of STATIC_ELEMENT_RULES) {
180
- const elements = document.querySelectorAll(rule.selector);
181
- visitedByRule.set(rule.id, elements.length);
182
- for (const el of elements) {
183
- const tag = el.tagName.toLowerCase();
184
- const style = window.getComputedStyle(el);
185
- for (const f of runElementCheck(rule.id, () => rule.run(el, tag, style, window, customPropMap))) {
186
- // Element-scoped waivers: a data-impeccable-ignore ancestor suppresses
187
- // matching findings for its subtree, same as the browser walk.
188
- if (scopedIgnoreActive(el, f.id)) continue;
189
- findings.push(finding(f.id, filePath, f.snippet));
190
- }
191
- }
192
- }
193
-
194
- if (options?.designSystem) {
195
- const sourceDesignFindings = profileFindings(profile, {
196
- engine: 'static-html',
197
- phase: 'source',
198
- ruleId: 'design-system',
199
- target: filePath,
200
- }, () => checkSourceDesignSystem(html, filePath, { designSystem: options.designSystem }));
201
- const staticDesignFindings = profileFindings(profile, {
202
- engine: 'static-html',
203
- phase: 'page',
204
- ruleId: 'design-system',
205
- target: filePath,
206
- }, () => collectStaticDesignSystemFindings(document, window, filePath, options.designSystem));
207
- findings.push(...mergeDesignSystemFindings(staticDesignFindings, sourceDesignFindings));
208
- }
209
-
210
- if (isFullPage(html)) {
211
- const runPageCheck = (ruleId, callback) => profile
212
- ? profileFindings(profile, { engine: 'static-html', phase: 'page', ruleId, target: filePath }, callback)
213
- : callback();
214
- for (const f of runPageCheck('typography-rules', () => checkStaticPageTypography(document, window))) {
215
- findings.push(finding(f.id, filePath, f.snippet));
216
- }
217
- for (const f of runPageCheck('kicker-above-heading', () => checkKickerAboveHeadingFromDoc(document, window))) {
218
- findings.push(finding(f.id, filePath, f.snippet));
219
- }
220
- for (const f of runPageCheck('numbered-section-labels', () => checkNumberedSectionLabelsFromDoc(document, window))) {
221
- findings.push(finding(f.id, filePath, f.snippet));
222
- }
223
- for (const f of runPageCheck('repeated-container-text', () => checkRepeatedContainerTextFromDoc(document, window))) {
224
- findings.push(finding(f.id, filePath, f.snippet));
225
- }
226
- for (const f of runPageCheck('layout-rules', () => checkPageLayout(document, window))) {
227
- findings.push(finding(f.id, filePath, f.snippet));
228
- }
229
- for (const f of runPageCheck('cream-palette', () => checkCreamPalette(document, window))) {
230
- findings.push(finding(f.id, filePath, f.snippet));
231
- }
232
- for (const f of runPageCheck('skipped-heading', () => checkPageQualityFromDoc(document))) {
233
- findings.push(finding(f.id, filePath, f.snippet));
234
- }
235
- // Scoped corpora for the pattern checks (see buildHtmlPatternCorpora in
236
- // rules/checks.mjs): CSS-property regexes must not fire on prose ABOUT
237
- // css — `<code>background-clip: text</code>` in a changelog is
238
- // documentation, not styling. cssText already carries the <style>
239
- // blocks and any linked local stylesheets; style/class attributes come
240
- // from the parsed document, so escaped code samples never contribute.
241
- const styleAttrParts = [];
242
- const classAttrParts = [];
243
- for (const el of document.querySelectorAll('*')) {
244
- const styleAttr = el.getAttribute('style');
245
- if (styleAttr) styleAttrParts.push(`style="${styleAttr}"`);
246
- const classAttr = el.getAttribute('class');
247
- if (classAttr) classAttrParts.push(classAttr);
248
- }
249
- const patternCorpora = {
250
- styleText: [cssText, ...styleAttrParts].join('\n'),
251
- classText: classAttrParts.join('\n'),
252
- };
253
- for (const f of runPageCheck('html-patterns', () => checkHtmlPatterns(html, patternCorpora).filter(item =>
254
- item.id !== 'bounce-easing' && item.id !== 'layout-transition'
255
- ))) {
256
- // Selector-backed page findings honor scoped waivers here too, matching
257
- // the browser pass: resolve the selector and drop the finding when an
258
- // ignoring ancestor covers a match. Unlike the browser, an unmatched
259
- // selector keeps the finding — static scans see partial documents.
260
- if (f.selector) {
261
- let matches = null;
262
- try {
263
- matches = document.querySelectorAll(String(f.selector).replace(/::?[a-zA-Z-]+(\([^)]*\))?/g, '').trim());
264
- } catch { matches = null; }
265
- if (matches && matches.length > 0 && [...matches].every(el => scopedIgnoreActive(el, f.id))) continue;
266
- }
267
- const item = finding(f.id, filePath, f.snippet);
268
- // Position-aware severity promotion: checks may attach a per-finding
269
- // severity (e.g. a pulsing dot inside a header/nav landmark) that
270
- // overrides the registry default.
271
- if (f.severity) item.severity = f.severity;
272
- findings.push(item);
273
- }
274
- // Text-content analyzers (em-dash overuse, marketing buzzwords,
275
- // numbered section markers, aphoristic cadence) live in the regex
276
- // engine. Call them from here so .html files get the same coverage
277
- // as .css/.tsx files. These are scoped to text content only and
278
- // don't overlap with static-html's element/page rules.
279
- for (const f of runPageCheck('text-content', () => runTextContentAnalyzers(html, filePath, options))) {
280
- findings.push(finding(f.antipattern, filePath, f.snippet));
281
- }
282
- }
283
-
284
- // Static-HTML findings carry no line number, so only whole-file
285
- // `impeccable-disable` directives apply here — exactly the standalone-document
286
- // waiver this primitive targets. Bypassed by `--no-config` / `--no-inline-ignores`.
287
- return options?.inlineIgnores === false ? findings : applyInlineIgnores(findings, html);
288
- }
289
-
290
- export { checkStaticPageTypography, STATIC_ELEMENT_RULES, detectHtml };
@@ -1,189 +0,0 @@
1
- function sanitizeScreenshotClip(clip, viewport) {
2
- if (!clip) return null;
3
- const x = Math.max(0, Math.floor(clip.x || 0));
4
- const y = Math.max(0, Math.floor(clip.y || 0));
5
- const width = Math.min(
6
- Math.max(1, Math.ceil(clip.width || 0)),
7
- Math.max(1, viewport?.width || 1600),
8
- );
9
- const height = Math.min(
10
- Math.max(1, Math.ceil(clip.height || 0)),
11
- 320,
12
- );
13
- if (width < 1 || height < 1) return null;
14
- return { x, y, width, height };
15
- }
16
-
17
- async function compareScreenshotContrast(page, beforeBase64, afterBase64, candidate) {
18
- return page.evaluate(async ({ beforeBase64, afterBase64, candidate }) => {
19
- const loadImage = (base64) => new Promise((resolve, reject) => {
20
- const img = new Image();
21
- img.onload = () => resolve(img);
22
- img.onerror = () => reject(new Error('Could not decode contrast screenshot'));
23
- img.src = `data:image/png;base64,${base64}`;
24
- });
25
- const [before, after] = await Promise.all([loadImage(beforeBase64), loadImage(afterBase64)]);
26
- const width = Math.min(before.width, after.width);
27
- const height = Math.min(before.height, after.height);
28
- if (width < 1 || height < 1) return null;
29
-
30
- const canvas = document.createElement('canvas');
31
- canvas.width = width;
32
- canvas.height = height;
33
- const ctx = canvas.getContext('2d', { willReadFrequently: true });
34
- if (!ctx) return null;
35
-
36
- ctx.drawImage(before, 0, 0, width, height);
37
- const beforePixels = ctx.getImageData(0, 0, width, height).data;
38
- ctx.clearRect(0, 0, width, height);
39
- ctx.drawImage(after, 0, 0, width, height);
40
- const afterPixels = ctx.getImageData(0, 0, width, height).data;
41
-
42
- const luminance = ({ r, g, b }) => {
43
- const convert = c => {
44
- const v = c / 255;
45
- return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
46
- };
47
- return 0.2126 * convert(r) + 0.7152 * convert(g) + 0.0722 * convert(b);
48
- };
49
- const ratio = (a, b) => {
50
- const l1 = luminance(a);
51
- const l2 = luminance(b);
52
- return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
53
- };
54
-
55
- const cssTextColor = candidate.textColor && !candidate.preferRenderedForeground
56
- ? {
57
- r: candidate.textColor.r,
58
- g: candidate.textColor.g,
59
- b: candidate.textColor.b,
60
- }
61
- : null;
62
- const ratios = [];
63
- let glyphPixels = 0;
64
- let strongestDelta = 0;
65
- for (let i = 0; i < beforePixels.length; i += 4) {
66
- const delta = Math.abs(beforePixels[i] - afterPixels[i])
67
- + Math.abs(beforePixels[i + 1] - afterPixels[i + 1])
68
- + Math.abs(beforePixels[i + 2] - afterPixels[i + 2])
69
- + Math.abs(beforePixels[i + 3] - afterPixels[i + 3]);
70
- strongestDelta = Math.max(strongestDelta, delta);
71
- if (delta < 10) continue;
72
- glyphPixels++;
73
- const fg = cssTextColor || {
74
- r: beforePixels[i],
75
- g: beforePixels[i + 1],
76
- b: beforePixels[i + 2],
77
- };
78
- const bg = {
79
- r: afterPixels[i],
80
- g: afterPixels[i + 1],
81
- b: afterPixels[i + 2],
82
- };
83
- ratios.push(ratio(fg, bg));
84
- }
85
-
86
- if (ratios.length < 8) {
87
- return {
88
- glyphPixels,
89
- strongestDelta,
90
- worstRatio: null,
91
- p10Ratio: null,
92
- medianRatio: null,
93
- };
94
- }
95
-
96
- ratios.sort((a, b) => a - b);
97
- const pick = pct => ratios[Math.min(ratios.length - 1, Math.max(0, Math.floor((pct / 100) * ratios.length)))];
98
- return {
99
- glyphPixels,
100
- strongestDelta,
101
- worstRatio: ratios[0],
102
- p10Ratio: pick(10),
103
- medianRatio: pick(50),
104
- };
105
- }, { beforeBase64, afterBase64, candidate });
106
- }
107
-
108
- async function captureVisualContrastCandidate(page, candidate, viewport) {
109
- const clip = sanitizeScreenshotClip(candidate.clip, viewport);
110
- if (!clip) return null;
111
-
112
- const beforeBase64 = await page.screenshot({
113
- encoding: 'base64',
114
- clip,
115
- captureBeyondViewport: true,
116
- });
117
- const token = `impeccable-contrast-${Date.now()}-${Math.random().toString(36).slice(2)}`;
118
- const applied = await page.evaluate(({ selector, token, backgroundClipText }) => {
119
- let el;
120
- try {
121
- el = document.querySelector(selector);
122
- } catch {
123
- return false;
124
- }
125
- if (!el) return false;
126
- let style = document.getElementById('impeccable-visual-contrast-hide-style');
127
- if (!style) {
128
- style = document.createElement('style');
129
- style.id = 'impeccable-visual-contrast-hide-style';
130
- style.textContent = [
131
- '[data-impeccable-visual-contrast-target] {',
132
- ' color: transparent !important;',
133
- ' -webkit-text-fill-color: transparent !important;',
134
- ' text-shadow: none !important;',
135
- '}',
136
- '[data-impeccable-visual-contrast-target][data-impeccable-bgclip-text="true"] {',
137
- ' background-image: none !important;',
138
- '}',
139
- ].join('\n');
140
- document.head.appendChild(style);
141
- }
142
- el.setAttribute('data-impeccable-visual-contrast-target', token);
143
- if (backgroundClipText) el.setAttribute('data-impeccable-bgclip-text', 'true');
144
- return true;
145
- }, {
146
- selector: candidate.selector,
147
- token,
148
- backgroundClipText: candidate.backgroundClipText,
149
- });
150
- if (!applied) return null;
151
-
152
- let afterBase64;
153
- try {
154
- afterBase64 = await page.screenshot({
155
- encoding: 'base64',
156
- clip,
157
- captureBeyondViewport: true,
158
- });
159
- } finally {
160
- await page.evaluate(({ selector }) => {
161
- try {
162
- const el = document.querySelector(selector);
163
- if (el) {
164
- el.removeAttribute('data-impeccable-visual-contrast-target');
165
- el.removeAttribute('data-impeccable-bgclip-text');
166
- }
167
- } catch {
168
- // Ignore invalid or stale selectors during cleanup.
169
- }
170
- }, { selector: candidate.selector }).catch(() => {});
171
- }
172
-
173
- const metrics = await compareScreenshotContrast(page, beforeBase64, afterBase64, candidate);
174
- if (!metrics || !Number.isFinite(metrics.p10Ratio) || metrics.glyphPixels < 8) return null;
175
- const measuredRatio = metrics.p10Ratio;
176
- if (measuredRatio >= candidate.threshold) return null;
177
- const textLabel = candidate.text ? ` "${candidate.text}"` : '';
178
- const reasonLabel = (candidate.reasons || []).slice(0, 3).join(', ') || 'visual background';
179
- return {
180
- id: 'low-contrast',
181
- snippet: `pixel contrast ${measuredRatio.toFixed(1)}:1 median ${metrics.medianRatio.toFixed(1)}:1 (need ${candidate.threshold}:1) on ${reasonLabel}${textLabel}`,
182
- };
183
- }
184
-
185
- export {
186
- sanitizeScreenshotClip,
187
- compareScreenshotContrast,
188
- captureVisualContrastCandidate,
189
- };
@@ -1,18 +0,0 @@
1
- import { getAntipattern } from './registry/antipatterns.mjs';
2
-
3
- function getAP(id) {
4
- return getAntipattern(id);
5
- }
6
-
7
- function finding(id, filePath, snippet, line = 0) {
8
- const ap = getAP(id);
9
- const base = { antipattern: id, name: ap.name, description: ap.description, severity: ap.severity || 'warning', category: ap.category || null, file: filePath, line, snippet };
10
- // Advisory findings are detected but reported separately and never counted as
11
- // failures. Carry the flag on the finding so every consumer (CLI, JSON, hook)
12
- // can partition without a registry lookup. Only stamped when true to keep the
13
- // finding shape stable for the vast majority of rules.
14
- if (ap.advisory === true) base.advisory = true;
15
- return base;
16
- }
17
-
18
- export { getAP, finding };