omo-ai 5.1.69 → 5.1.71

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 (408) hide show
  1. package/bin/darwin/omo-keychain +0 -0
  2. package/bin/lib/agent-dir.js +8 -1
  3. package/bin/lib/auth-store.js +11 -1
  4. package/bin/lib/bun-bin-shim.js +12 -2
  5. package/bin/lib/category-coverage.js +56 -18
  6. package/bin/lib/child-process.js +2 -1
  7. package/bin/lib/compile-safe-engine.js +14 -2
  8. package/bin/lib/daemon-adopt.js +41 -10
  9. package/bin/lib/daemon-config.js +9 -3
  10. package/bin/lib/daemon-operations.js +11 -3
  11. package/bin/lib/daemon-rollback.js +28 -23
  12. package/bin/lib/daemon-status.js +9 -3
  13. package/bin/lib/daemon.js +18 -3
  14. package/bin/lib/doctor-memory-runtime.js +46 -12
  15. package/bin/lib/doctor-migration.js +65 -38
  16. package/bin/lib/doctor-pi-config.js +8 -3
  17. package/bin/lib/doctor-reflection-lock.js +35 -12
  18. package/bin/lib/doctor.js +64 -49
  19. package/bin/lib/engine-boot.js +3 -1
  20. package/bin/lib/engine-commands.js +11 -1
  21. package/bin/lib/engine-environment.js +8 -1
  22. package/bin/lib/engine-models.js +2 -1
  23. package/bin/lib/engine-prepare.js +18 -3
  24. package/bin/lib/host-status.js +5 -1
  25. package/bin/lib/jsonc-edit.js +10 -6
  26. package/bin/lib/keychain-helper-doctor.js +13 -3
  27. package/bin/lib/launch-spec-mode.js +6 -2
  28. package/bin/lib/launcher.js +31 -19
  29. package/bin/lib/model-chains.js +12 -5
  30. package/bin/lib/npm-dist-tags.js +2 -1
  31. package/bin/lib/package-paths.js +18 -10
  32. package/bin/lib/private-fd-table.js +19 -10
  33. package/bin/lib/process-list.js +26 -0
  34. package/bin/lib/provider-map.json +1 -1
  35. package/bin/lib/rpc-stream-errors.js +6 -2
  36. package/bin/lib/same-version.js +6 -1
  37. package/bin/lib/self-update.js +41 -10
  38. package/bin/lib/service-auth.generated.js +57 -43
  39. package/bin/lib/setup-assets-import.js +25 -5
  40. package/bin/lib/setup-commandcode.js +5 -2
  41. package/bin/lib/setup-credentials.js +12 -2
  42. package/bin/lib/setup-detect-refresh.js +9 -6
  43. package/bin/lib/setup-detect.js +4 -5
  44. package/bin/lib/setup-guidance.js +1 -1
  45. package/bin/lib/setup-import.js +35 -7
  46. package/bin/lib/setup-model-choices-import.js +61 -10
  47. package/bin/lib/setup-models.js +9 -5
  48. package/bin/lib/setup-opencode-assets.js +26 -9
  49. package/bin/lib/setup-opencode-models.d.ts +4 -1
  50. package/bin/lib/setup-opencode-models.js +76 -30
  51. package/bin/lib/setup-opencode-providers.js +58 -17
  52. package/bin/lib/setup-providers-import.js +38 -6
  53. package/bin/lib/setup-report.js +9 -7
  54. package/bin/lib/setup-stream-items.js +29 -5
  55. package/bin/lib/setup-stream.d.ts +13 -3
  56. package/bin/lib/setup-stream.js +92 -15
  57. package/bin/lib/setup-summary.js +61 -18
  58. package/bin/lib/sqlite-rows.js +3 -1
  59. package/bin/lib/thread-output.js +14 -4
  60. package/bin/lib/thread.js +224 -38
  61. package/bin/lib/update-args.js +5 -1
  62. package/bin/lib/update-lock.js +13 -2
  63. package/bin/omo.js +1 -1
  64. package/package.json +2 -2
  65. package/plugin/CHANGELOG.md +148 -0
  66. package/plugin/README.md +9 -1
  67. package/plugin/extensions/gateway-store-worker.mjs +2 -2
  68. package/plugin/extensions/memory-run-supervisor.mjs +1 -1
  69. package/plugin/extensions/omo-claim-receipt.js +1 -1
  70. package/plugin/extensions/omo-computer-run-worker.mjs +1 -1
  71. package/plugin/extensions/omo-computer-use.js +2 -2
  72. package/plugin/extensions/omo-desktop-toolkit.js +1 -1
  73. package/plugin/extensions/omo-device-account.js +4 -4
  74. package/plugin/extensions/omo-device-service.js +5 -5
  75. package/plugin/extensions/omo-feedback.js +2 -2
  76. package/plugin/extensions/omo-init-deep-advisor.js +2 -2
  77. package/plugin/extensions/omo-member.js +2 -2
  78. package/plugin/extensions/omo-memory-commands.js +2 -2
  79. package/plugin/extensions/omo-memory-doctor.js +3 -3
  80. package/plugin/extensions/omo-memory-memfs.js +1 -1
  81. package/plugin/extensions/omo-memory-palace.js +3 -3
  82. package/plugin/extensions/omo-memory-sync.js +2 -2
  83. package/plugin/extensions/omo-onboarding-scan.js +2 -2
  84. package/plugin/extensions/omo-recall-store.js +1 -1
  85. package/plugin/extensions/omo-session-history.js +1 -1
  86. package/plugin/extensions/omo-side-panel.js +3 -3
  87. package/plugin/extensions/omo-task.js +2 -2
  88. package/plugin/extensions/omo-telemetry-otlp.js +2 -2
  89. package/plugin/extensions/omo-telemetry-posthog.js +1 -1
  90. package/plugin/extensions/omo-telemetry-recovery.js +1 -1
  91. package/plugin/extensions/omo-thread-client.js +5 -5
  92. package/plugin/extensions/omo.js +3 -3
  93. package/plugin/package.json +1 -1
  94. package/plugin/runtime/agent-toolkit-sdk/sdk.js +2 -2
  95. package/plugin/runtime/ast-grep-mcp/cli.js +26 -5
  96. package/plugin/runtime/ast-grep-mcp/manifest.json +2 -2
  97. package/plugin/runtime/bunshin-ts/sdk.js +4 -4
  98. package/plugin/runtime/category-coverage/index.js +6 -6
  99. package/plugin/runtime/lsp-daemon/dist/.omo-runtime-manifest.json +4 -4
  100. package/plugin/runtime/lsp-daemon/dist/cli.js +8 -2
  101. package/plugin/runtime/lsp-daemon/dist/client.js +8 -2
  102. package/plugin/runtime/lsp-daemon/dist/index.js +8 -2
  103. package/plugin/runtime/rollback-migrate.js +2 -2
  104. package/plugin/runtime/task-config/index.js +3 -3
  105. package/plugin/runtime/thread-sdk/sdk.js +5 -5
  106. package/plugin/scripts/install.mjs +20 -15
  107. package/plugin/skills/ast-grep/references/recipes.md +1 -1
  108. package/plugin/skills/ast-grep/tests/smoke.ps1 +1 -1
  109. package/plugin/skills/ast-grep/tests/smoke.sh +1 -1
  110. package/plugin/skills/browser/runtime/omowright/index.js +16 -16
  111. package/plugin/skills/browser/runtime/omowright/manifest.json +5 -5
  112. package/plugin/skills/browser/runtime/omowright/page-bundle.js +14 -4
  113. package/plugin/skills/browser/scripts/browser-doctor-report.mjs +36 -9
  114. package/plugin/skills/browser/scripts/browser-doctor.mjs +24 -7
  115. package/plugin/skills/browser/scripts/browser-engine-guard.mjs +2 -1
  116. package/plugin/skills/browser/scripts/browser-install.mjs +40 -8
  117. package/plugin/skills/debugging/references/scripts/dap.mjs +280 -170
  118. package/plugin/skills/debugging/references/scripts/fixture-adapter.mjs +104 -42
  119. package/plugin/skills/frontend/scripts/detect/cli.ts +67 -50
  120. package/plugin/skills/frontend/scripts/detect/config.ts +41 -38
  121. package/plugin/skills/frontend/scripts/detect/core/color.ts +109 -94
  122. package/plugin/skills/frontend/scripts/detect/core/page.ts +43 -42
  123. package/plugin/skills/frontend/scripts/detect/core/shadow.ts +38 -29
  124. package/plugin/skills/frontend/scripts/detect/core/source.ts +25 -20
  125. package/plugin/skills/frontend/scripts/detect/detect.ts +63 -45
  126. package/plugin/skills/frontend/scripts/detect/lint.ts +78 -69
  127. package/plugin/skills/frontend/scripts/detect/render/probe-placement.ts +36 -32
  128. package/plugin/skills/frontend/scripts/detect/render/renderer.ts +14 -13
  129. package/plugin/skills/frontend/scripts/detect/render/webview.ts +53 -50
  130. package/plugin/skills/frontend/scripts/detect/report.ts +20 -18
  131. package/plugin/skills/frontend/scripts/detect/rule.ts +21 -21
  132. package/plugin/skills/frontend/scripts/detect/rules/color/ai-color-palette.ts +144 -63
  133. package/plugin/skills/frontend/scripts/detect/rules/color/cream-palette.ts +41 -27
  134. package/plugin/skills/frontend/scripts/detect/rules/color/dark-glow.ts +59 -34
  135. package/plugin/skills/frontend/scripts/detect/rules/color/design-system-color.ts +37 -28
  136. package/plugin/skills/frontend/scripts/detect/rules/color/gradient-text.ts +68 -45
  137. package/plugin/skills/frontend/scripts/detect/rules/color/gray-on-color.ts +34 -25
  138. package/plugin/skills/frontend/scripts/detect/rules/color/index.ts +9 -2
  139. package/plugin/skills/frontend/scripts/detect/rules/color/low-contrast.ts +106 -43
  140. package/plugin/skills/frontend/scripts/detect/rules/color/radial-halo.ts +48 -23
  141. package/plugin/skills/frontend/scripts/detect/rules/color/radial-spotlight-glow.ts +49 -26
  142. package/plugin/skills/frontend/scripts/detect/rules/color/support/animation-opacity.ts +90 -66
  143. package/plugin/skills/frontend/scripts/detect/rules/color/support/color-path.ts +43 -6
  144. package/plugin/skills/frontend/scripts/detect/rules/color/support/contrast-pairs.ts +75 -38
  145. package/plugin/skills/frontend/scripts/detect/rules/color/support/contrast-role.ts +142 -59
  146. package/plugin/skills/frontend/scripts/detect/rules/color/support/glow-forms.ts +93 -44
  147. package/plugin/skills/frontend/scripts/detect/rules/color/support/gradient-samples.ts +115 -114
  148. package/plugin/skills/frontend/scripts/detect/rules/color/support/gradients.ts +77 -66
  149. package/plugin/skills/frontend/scripts/detect/rules/color/support/mockup-roots.ts +178 -48
  150. package/plugin/skills/frontend/scripts/detect/rules/color/support/page-ignore.ts +6 -2
  151. package/plugin/skills/frontend/scripts/detect/rules/color/support/painted-text.ts +171 -108
  152. package/plugin/skills/frontend/scripts/detect/rules/color/support/palette-roles.ts +60 -39
  153. package/plugin/skills/frontend/scripts/detect/rules/color/support/placeholder-contrast.ts +36 -16
  154. package/plugin/skills/frontend/scripts/detect/rules/color/support/stock-accent.ts +48 -18
  155. package/plugin/skills/frontend/scripts/detect/rules/color/support/text-colors.ts +88 -62
  156. package/plugin/skills/frontend/scripts/detect/rules/copy/aphoristic-cadence.ts +25 -15
  157. package/plugin/skills/frontend/scripts/detect/rules/copy/broken-image.ts +20 -12
  158. package/plugin/skills/frontend/scripts/detect/rules/copy/em-dash-overuse.ts +63 -39
  159. package/plugin/skills/frontend/scripts/detect/rules/copy/index.ts +9 -2
  160. package/plugin/skills/frontend/scripts/detect/rules/copy/marketing-buzzword.ts +53 -25
  161. package/plugin/skills/frontend/scripts/detect/rules/copy/numbered-section-labels.ts +49 -28
  162. package/plugin/skills/frontend/scripts/detect/rules/copy/repeated-container-text.ts +80 -47
  163. package/plugin/skills/frontend/scripts/detect/rules/copy/script-error.ts +42 -34
  164. package/plugin/skills/frontend/scripts/detect/rules/copy/skipped-heading.ts +199 -75
  165. package/plugin/skills/frontend/scripts/detect/rules/copy/support/numbered-label.ts +122 -71
  166. package/plugin/skills/frontend/scripts/detect/rules/copy/support/page-text.ts +32 -24
  167. package/plugin/skills/frontend/scripts/detect/rules/copy/theater-slop-phrase.ts +42 -13
  168. package/plugin/skills/frontend/scripts/detect/rules/decoration/blinking-cursor.ts +49 -41
  169. package/plugin/skills/frontend/scripts/detect/rules/decoration/border-accent-on-rounded.ts +10 -10
  170. package/plugin/skills/frontend/scripts/detect/rules/decoration/bounce-easing.ts +87 -68
  171. package/plugin/skills/frontend/scripts/detect/rules/decoration/buried-raster.ts +83 -64
  172. package/plugin/skills/frontend/scripts/detect/rules/decoration/codex-grid-background.ts +29 -29
  173. package/plugin/skills/frontend/scripts/detect/rules/decoration/design-system-radius.ts +33 -26
  174. package/plugin/skills/frontend/scripts/detect/rules/decoration/gpt-thin-border-wide-shadow.ts +61 -58
  175. package/plugin/skills/frontend/scripts/detect/rules/decoration/hard-offset-shadow.ts +25 -23
  176. package/plugin/skills/frontend/scripts/detect/rules/decoration/hero-eyebrow-chip.ts +16 -14
  177. package/plugin/skills/frontend/scripts/detect/rules/decoration/icon-tile-stack.ts +85 -84
  178. package/plugin/skills/frontend/scripts/detect/rules/decoration/index.ts +17 -17
  179. package/plugin/skills/frontend/scripts/detect/rules/decoration/kicker-above-heading.ts +79 -64
  180. package/plugin/skills/frontend/scripts/detect/rules/decoration/marquee.ts +57 -40
  181. package/plugin/skills/frontend/scripts/detect/rules/decoration/organic-clip-path.ts +34 -34
  182. package/plugin/skills/frontend/scripts/detect/rules/decoration/pulsing-dot.ts +92 -58
  183. package/plugin/skills/frontend/scripts/detect/rules/decoration/repeating-stripes-gradient.ts +19 -19
  184. package/plugin/skills/frontend/scripts/detect/rules/decoration/shape-assembled-illustration.ts +59 -53
  185. package/plugin/skills/frontend/scripts/detect/rules/decoration/side-tab.ts +15 -12
  186. package/plugin/skills/frontend/scripts/detect/rules/decoration/support/appearance.ts +89 -85
  187. package/plugin/skills/frontend/scripts/detect/rules/decoration/support/assert-cases.ts +17 -15
  188. package/plugin/skills/frontend/scripts/detect/rules/decoration/support/borders.ts +178 -136
  189. package/plugin/skills/frontend/scripts/detect/rules/decoration/support/clip-geometry.ts +155 -145
  190. package/plugin/skills/frontend/scripts/detect/rules/decoration/support/css-candidates.ts +60 -54
  191. package/plugin/skills/frontend/scripts/detect/rules/decoration/support/curve-samples.ts +51 -48
  192. package/plugin/skills/frontend/scripts/detect/rules/decoration/support/gradient-pattern.ts +43 -34
  193. package/plugin/skills/frontend/scripts/detect/rules/decoration/support/keyframes.ts +118 -113
  194. package/plugin/skills/frontend/scripts/detect/rules/decoration/support/labels.ts +74 -67
  195. package/plugin/skills/frontend/scripts/detect/rules/decoration/support/raster-state.ts +80 -42
  196. package/plugin/skills/frontend/scripts/detect/rules/index.ts +6 -6
  197. package/plugin/skills/frontend/scripts/detect/rules/layout/body-text-viewport-edge.ts +116 -55
  198. package/plugin/skills/frontend/scripts/detect/rules/layout/clipped-overflow-container.ts +22 -9
  199. package/plugin/skills/frontend/scripts/detect/rules/layout/content-hidden-at-rest.ts +113 -52
  200. package/plugin/skills/frontend/scripts/detect/rules/layout/cramped-padding.ts +167 -90
  201. package/plugin/skills/frontend/scripts/detect/rules/layout/edge-flush-cards.ts +82 -41
  202. package/plugin/skills/frontend/scripts/detect/rules/layout/first-viewport-column-overflow.ts +74 -37
  203. package/plugin/skills/frontend/scripts/detect/rules/layout/heading-rhythm.ts +49 -24
  204. package/plugin/skills/frontend/scripts/detect/rules/layout/index.ts +14 -3
  205. package/plugin/skills/frontend/scripts/detect/rules/layout/monotonous-spacing.ts +47 -28
  206. package/plugin/skills/frontend/scripts/detect/rules/layout/nested-cards.ts +66 -31
  207. package/plugin/skills/frontend/scripts/detect/rules/layout/straggler.ts +46 -22
  208. package/plugin/skills/frontend/scripts/detect/rules/layout/support/cards.ts +157 -82
  209. package/plugin/skills/frontend/scripts/detect/rules/layout/support/clipping.ts +98 -50
  210. package/plugin/skills/frontend/scripts/detect/rules/layout/support/declared-mockups.ts +100 -36
  211. package/plugin/skills/frontend/scripts/detect/rules/layout/support/geometry.ts +66 -43
  212. package/plugin/skills/frontend/scripts/detect/rules/layout/support/hidden-interface.ts +56 -24
  213. package/plugin/skills/frontend/scripts/detect/rules/layout/support/layout-cases.ts +23 -8
  214. package/plugin/skills/frontend/scripts/detect/rules/layout/support/line-breaks.ts +28 -16
  215. package/plugin/skills/frontend/scripts/detect/rules/layout/support/motion.ts +88 -56
  216. package/plugin/skills/frontend/scripts/detect/rules/layout/support/padding.ts +106 -68
  217. package/plugin/skills/frontend/scripts/detect/rules/layout/support/rhythm.ts +204 -128
  218. package/plugin/skills/frontend/scripts/detect/rules/layout/text-occlusion.ts +125 -70
  219. package/plugin/skills/frontend/scripts/detect/rules/layout/text-overflow.ts +111 -59
  220. package/plugin/skills/frontend/scripts/detect/rules/layout/unbalanced-heading.ts +27 -16
  221. package/plugin/skills/frontend/scripts/detect/rules/layout/viewport-reflow.ts +38 -23
  222. package/plugin/skills/frontend/scripts/detect/rules/source/ai-color-palette.ts +17 -6
  223. package/plugin/skills/frontend/scripts/detect/rules/source/aphoristic-cadence.ts +19 -9
  224. package/plugin/skills/frontend/scripts/detect/rules/source/border-accent-on-rounded.ts +31 -13
  225. package/plugin/skills/frontend/scripts/detect/rules/source/bounce-easing.ts +41 -16
  226. package/plugin/skills/frontend/scripts/detect/rules/source/broken-image.ts +19 -9
  227. package/plugin/skills/frontend/scripts/detect/rules/source/codex-grid-background.ts +36 -12
  228. package/plugin/skills/frontend/scripts/detect/rules/source/dark-glow.ts +28 -14
  229. package/plugin/skills/frontend/scripts/detect/rules/source/em-dash-overuse.ts +17 -9
  230. package/plugin/skills/frontend/scripts/detect/rules/source/gradient-text.ts +14 -6
  231. package/plugin/skills/frontend/scripts/detect/rules/source/gray-on-color.ts +18 -7
  232. package/plugin/skills/frontend/scripts/detect/rules/source/index.ts +18 -1
  233. package/plugin/skills/frontend/scripts/detect/rules/source/marketing-buzzword.ts +49 -11
  234. package/plugin/skills/frontend/scripts/detect/rules/source/marquee.ts +16 -6
  235. package/plugin/skills/frontend/scripts/detect/rules/source/monotonous-spacing.ts +35 -17
  236. package/plugin/skills/frontend/scripts/detect/rules/source/overused-font.ts +51 -10
  237. package/plugin/skills/frontend/scripts/detect/rules/source/radial-halo.ts +16 -8
  238. package/plugin/skills/frontend/scripts/detect/rules/source/side-tab.ts +88 -47
  239. package/plugin/skills/frontend/scripts/detect/rules/source/support/accent-scans.ts +103 -62
  240. package/plugin/skills/frontend/scripts/detect/rules/source/support/check-source.ts +6 -2
  241. package/plugin/skills/frontend/scripts/detect/rules/source/support/corners.ts +148 -80
  242. package/plugin/skills/frontend/scripts/detect/rules/source/support/css-effects.ts +86 -66
  243. package/plugin/skills/frontend/scripts/detect/rules/source/support/css-scopes.ts +148 -113
  244. package/plugin/skills/frontend/scripts/detect/rules/source/support/image-tags.ts +113 -105
  245. package/plugin/skills/frontend/scripts/detect/rules/source/support/js-punctuation.ts +47 -30
  246. package/plugin/skills/frontend/scripts/detect/rules/source/support/markup-scope.ts +45 -34
  247. package/plugin/skills/frontend/scripts/detect/rules/source/support/source-color.ts +64 -29
  248. package/plugin/skills/frontend/scripts/detect/rules/source/support/source-shadow.ts +17 -10
  249. package/plugin/skills/frontend/scripts/detect/rules/source/support/source-text.ts +128 -86
  250. package/plugin/skills/frontend/scripts/detect/rules/typography/all-caps-body.ts +23 -9
  251. package/plugin/skills/frontend/scripts/detect/rules/typography/design-system-font-size.ts +27 -17
  252. package/plugin/skills/frontend/scripts/detect/rules/typography/design-system-font.ts +27 -17
  253. package/plugin/skills/frontend/scripts/detect/rules/typography/extreme-negative-tracking.ts +26 -12
  254. package/plugin/skills/frontend/scripts/detect/rules/typography/flat-type-hierarchy.ts +41 -19
  255. package/plugin/skills/frontend/scripts/detect/rules/typography/index.ts +14 -3
  256. package/plugin/skills/frontend/scripts/detect/rules/typography/italic-serif-display.ts +67 -16
  257. package/plugin/skills/frontend/scripts/detect/rules/typography/justified-text.ts +47 -25
  258. package/plugin/skills/frontend/scripts/detect/rules/typography/line-length.ts +37 -21
  259. package/plugin/skills/frontend/scripts/detect/rules/typography/oversized-h1.ts +35 -14
  260. package/plugin/skills/frontend/scripts/detect/rules/typography/overused-font.ts +83 -38
  261. package/plugin/skills/frontend/scripts/detect/rules/typography/support/drawn-enlargement.ts +68 -40
  262. package/plugin/skills/frontend/scripts/detect/rules/typography/support/fading-text.ts +59 -39
  263. package/plugin/skills/frontend/scripts/detect/rules/typography/support/flex-runs.ts +13 -8
  264. package/plugin/skills/frontend/scripts/detect/rules/typography/support/font-family.ts +68 -17
  265. package/plugin/skills/frontend/scripts/detect/rules/typography/support/painted-text.ts +173 -67
  266. package/plugin/skills/frontend/scripts/detect/rules/typography/support/svg-size.ts +56 -49
  267. package/plugin/skills/frontend/scripts/detect/rules/typography/support/text-context.ts +155 -78
  268. package/plugin/skills/frontend/scripts/detect/rules/typography/support/text-lines.ts +38 -28
  269. package/plugin/skills/frontend/scripts/detect/rules/typography/support/type-hierarchy.ts +43 -38
  270. package/plugin/skills/frontend/scripts/detect/rules/typography/tight-leading.ts +67 -39
  271. package/plugin/skills/frontend/scripts/detect/rules/typography/tiny-text.ts +34 -15
  272. package/plugin/skills/frontend/scripts/detect/rules/typography/undersized-ui-text.ts +52 -22
  273. package/plugin/skills/frontend/scripts/detect/rules/typography/wide-tracking.ts +37 -19
  274. package/plugin/skills/frontend/scripts/detect/snapshot/collect.ts +154 -145
  275. package/plugin/skills/frontend/scripts/detect/snapshot/style-props.ts +121 -21
  276. package/plugin/skills/frontend/scripts/detect/testing/build-snapshot.ts +140 -65
  277. package/plugin/skills/frontend/scripts/detect/types.ts +81 -76
  278. package/plugin/skills/frontend/scripts/perfection/accent-stripes/color.ts +205 -85
  279. package/plugin/skills/frontend/scripts/perfection/accent-stripes/css-parse.ts +97 -80
  280. package/plugin/skills/frontend/scripts/perfection/accent-stripes/declarations.ts +129 -101
  281. package/plugin/skills/frontend/scripts/perfection/accent-stripes/findings.ts +23 -23
  282. package/plugin/skills/frontend/scripts/perfection/accent-stripes/gradient.ts +43 -42
  283. package/plugin/skills/frontend/scripts/perfection/accent-stripes/lint.ts +75 -60
  284. package/plugin/skills/frontend/scripts/perfection/accent-stripes/markup.ts +131 -106
  285. package/plugin/skills/frontend/scripts/perfection/accent-stripes/selector.ts +28 -25
  286. package/plugin/skills/frontend/scripts/perfection/accent-stripes/tailwind.ts +93 -78
  287. package/plugin/skills/frontend/scripts/perfection/check-accent-stripes.ts +22 -22
  288. package/plugin/skills/frontend/scripts/perfection/check-draft-guard.ts +24 -24
  289. package/plugin/skills/frontend/scripts/perfection/collect-files.ts +49 -36
  290. package/plugin/skills/frontend/scripts/perfection/draft-guard/findings.ts +10 -9
  291. package/plugin/skills/frontend/scripts/perfection/draft-guard/lint.ts +27 -24
  292. package/plugin/skills/frontend/scripts/perfection/draft-guard/rules.ts +46 -42
  293. package/plugin/skills/frontend/scripts/perfection/draft-guard/text-nodes.ts +98 -75
  294. package/plugin/skills/lsp-setup/scripts/detect-lsp.ts +162 -152
  295. package/plugin/skills/lsp-setup/scripts/lsp-server-table.ts +164 -164
  296. package/plugin/skills/lsp-setup/scripts/verify-lsp.ts +94 -91
  297. package/plugin/skills/programming/SKILL.md +2 -2
  298. package/plugin/skills/programming/scripts/go/new-project.ts +68 -68
  299. package/plugin/skills/programming/scripts/python/new-project.ts +64 -64
  300. package/plugin/skills/programming/scripts/python/new-script.ts +39 -39
  301. package/plugin/skills/programming/scripts/rust/new-project.ts +60 -57
  302. package/plugin/skills/programming/scripts/shared/run-tool.ts +7 -7
  303. package/plugin/skills/programming/scripts/typescript/check-no-excuse-rules.ts +96 -36
  304. package/plugin/skills/programming/scripts/typescript/check-test-junk-rules.ts +38 -17
  305. package/plugin/skills/programming/scripts/typescript/check-test-junk.ts +13 -2
  306. package/plugin/skills/programming/scripts/typescript/mutation-proof.ts +16 -4
  307. package/plugin/skills/programming/scripts/typescript/new-project.ts +21 -21
  308. package/plugin/skills/ultimate-browsing/engine/templates/playwright_mobile_chrome.js +65 -62
  309. package/plugin/skills/ultimate-browsing/engine/templates/playwright_real_chrome.js +73 -70
  310. package/plugin/skills/ulw-plan/scripts/plan-templates.mjs +30 -30
  311. package/plugin/skills/ulw-plan/scripts/scaffold-plan.mjs +131 -123
  312. package/plugin/skills/ulw-research/scripts/claim-kinds.mjs +178 -67
  313. package/plugin/skills/ulw-research/scripts/claims-index.mjs +117 -93
  314. package/plugin/skills/ulw-research/scripts/cli-support.mjs +73 -73
  315. package/plugin/skills/ulw-research/scripts/contracts.mjs +604 -174
  316. package/plugin/skills/ulw-research/scripts/conversion-probe.mjs +161 -113
  317. package/plugin/skills/ulw-research/scripts/css-hiding.mjs +126 -92
  318. package/plugin/skills/ulw-research/scripts/css-lite.mjs +143 -137
  319. package/plugin/skills/ulw-research/scripts/design-spec.mjs +123 -107
  320. package/plugin/skills/ulw-research/scripts/entities.mjs +66 -30
  321. package/plugin/skills/ulw-research/scripts/entry-guard.mjs +8 -8
  322. package/plugin/skills/ulw-research/scripts/fact-commands-fill.mjs +104 -51
  323. package/plugin/skills/ulw-research/scripts/fact-commands-meaning.mjs +207 -105
  324. package/plugin/skills/ulw-research/scripts/fact-commands-polish.mjs +143 -76
  325. package/plugin/skills/ulw-research/scripts/fact-commands-verify.mjs +164 -120
  326. package/plugin/skills/ulw-research/scripts/fact-commands.mjs +264 -151
  327. package/plugin/skills/ulw-research/scripts/fact-derive.mjs +92 -48
  328. package/plugin/skills/ulw-research/scripts/fact-expr.mjs +90 -78
  329. package/plugin/skills/ulw-research/scripts/fact-fill.mjs +215 -127
  330. package/plugin/skills/ulw-research/scripts/fact-ledger-kinds.mjs +305 -131
  331. package/plugin/skills/ulw-research/scripts/fact-ledger-schema.mjs +264 -158
  332. package/plugin/skills/ulw-research/scripts/fact-ledger.mjs +93 -57
  333. package/plugin/skills/ulw-research/scripts/fact-locate.mjs +204 -147
  334. package/plugin/skills/ulw-research/scripts/fact-pairs.mjs +126 -108
  335. package/plugin/skills/ulw-research/scripts/fact-recompute.mjs +89 -66
  336. package/plugin/skills/ulw-research/scripts/fidelity-binding.mjs +101 -70
  337. package/plugin/skills/ulw-research/scripts/fidelity-brief.mjs +95 -89
  338. package/plugin/skills/ulw-research/scripts/fidelity-claims.mjs +76 -48
  339. package/plugin/skills/ulw-research/scripts/fidelity-csv.mjs +27 -27
  340. package/plugin/skills/ulw-research/scripts/fidelity-lexicon.mjs +101 -78
  341. package/plugin/skills/ulw-research/scripts/fidelity-originals.mjs +124 -77
  342. package/plugin/skills/ulw-research/scripts/fidelity-policy.mjs +132 -83
  343. package/plugin/skills/ulw-research/scripts/fidelity-records.mjs +179 -117
  344. package/plugin/skills/ulw-research/scripts/fidelity-snapshot-readability.mjs +38 -33
  345. package/plugin/skills/ulw-research/scripts/fidelity-sources.mjs +92 -54
  346. package/plugin/skills/ulw-research/scripts/fidelity-state.mjs +27 -27
  347. package/plugin/skills/ulw-research/scripts/fidelity-trace.mjs +81 -48
  348. package/plugin/skills/ulw-research/scripts/fidelity-value-unit.mjs +207 -104
  349. package/plugin/skills/ulw-research/scripts/fidelity-values.mjs +255 -154
  350. package/plugin/skills/ulw-research/scripts/format-extract-css.mjs +74 -74
  351. package/plugin/skills/ulw-research/scripts/format-extract.mjs +161 -134
  352. package/plugin/skills/ulw-research/scripts/gates-fidelity.mjs +118 -59
  353. package/plugin/skills/ulw-research/scripts/gates-figures.mjs +192 -141
  354. package/plugin/skills/ulw-research/scripts/gates-layout.mjs +119 -85
  355. package/plugin/skills/ulw-research/scripts/gates-static.mjs +109 -102
  356. package/plugin/skills/ulw-research/scripts/gates-structure.mjs +105 -86
  357. package/plugin/skills/ulw-research/scripts/gates-text.mjs +169 -113
  358. package/plugin/skills/ulw-research/scripts/html-foreign-object.mjs +39 -34
  359. package/plugin/skills/ulw-research/scripts/html-lite.mjs +230 -176
  360. package/plugin/skills/ulw-research/scripts/html-markup.mjs +150 -128
  361. package/plugin/skills/ulw-research/scripts/html-text-map.mjs +125 -96
  362. package/plugin/skills/ulw-research/scripts/layout-probe.mjs +10 -8
  363. package/plugin/skills/ulw-research/scripts/lexicon.mjs +36 -19
  364. package/plugin/skills/ulw-research/scripts/markdown-closers.mjs +85 -85
  365. package/plugin/skills/ulw-research/scripts/md-lite.mjs +133 -125
  366. package/plugin/skills/ulw-research/scripts/meaning-check.mjs +154 -123
  367. package/plugin/skills/ulw-research/scripts/number-grammar.mjs +10 -8
  368. package/plugin/skills/ulw-research/scripts/numerals.mjs +181 -137
  369. package/plugin/skills/ulw-research/scripts/outcome-start.mjs +50 -36
  370. package/plugin/skills/ulw-research/scripts/outcome.mjs +194 -153
  371. package/plugin/skills/ulw-research/scripts/particles-ko.mjs +72 -70
  372. package/plugin/skills/ulw-research/scripts/placeholder.mjs +130 -112
  373. package/plugin/skills/ulw-research/scripts/polish-apply.mjs +67 -51
  374. package/plugin/skills/ulw-research/scripts/polish-diff.mjs +10 -5
  375. package/plugin/skills/ulw-research/scripts/polish-project.mjs +67 -57
  376. package/plugin/skills/ulw-research/scripts/polish-rules.mjs +120 -100
  377. package/plugin/skills/ulw-research/scripts/rational.mjs +74 -73
  378. package/plugin/skills/ulw-research/scripts/raw-decode.mjs +74 -74
  379. package/plugin/skills/ulw-research/scripts/raw-locator.mjs +32 -24
  380. package/plugin/skills/ulw-research/scripts/repair-tracker.mjs +98 -93
  381. package/plugin/skills/ulw-research/scripts/report-tools-commands.mjs +265 -176
  382. package/plugin/skills/ulw-research/scripts/report-tools.mjs +65 -62
  383. package/plugin/skills/ulw-research/scripts/sentence-split.mjs +63 -43
  384. package/plugin/skills/ulw-research/scripts/source-commands.mjs +199 -125
  385. package/plugin/skills/ulw-research/scripts/source-refresh.mjs +91 -54
  386. package/plugin/skills/ulw-research/scripts/source-snapshot.mjs +143 -102
  387. package/plugin/skills/ulw-research/scripts/source-view.mjs +82 -46
  388. package/plugin/skills/ulw-research/scripts/sources-citation.mjs +135 -96
  389. package/plugin/skills/ulw-research/scripts/text-normalize.mjs +63 -48
  390. package/plugin/skills/ulw-research/scripts/text-similarity.mjs +15 -15
  391. package/plugin/skills/ulw-research/scripts/unit-algebra.mjs +98 -66
  392. package/plugin/skills/ulw-research/scripts/unit-errors.mjs +14 -14
  393. package/plugin/skills/ulw-research/scripts/unit-metadata.mjs +30 -14
  394. package/plugin/skills/ulw-research/scripts/unit-pairs.mjs +57 -45
  395. package/plugin/skills/ulw-research/scripts/unit-precision.mjs +39 -25
  396. package/plugin/skills/ulw-research/scripts/unit-rules-shapes.mjs +79 -44
  397. package/plugin/skills/ulw-research/scripts/unit-rules.mjs +262 -135
  398. package/plugin/skills/ulw-research/scripts/units.mjs +96 -65
  399. package/plugin/skills/visual-qa/scripts/ansi.ts +3 -6
  400. package/plugin/skills/visual-qa/scripts/cli.ts +52 -52
  401. package/plugin/skills/visual-qa/scripts/east-asian-width.ts +53 -53
  402. package/plugin/skills/visual-qa/scripts/image-diff.ts +86 -86
  403. package/plugin/skills/visual-qa/scripts/png-crc.ts +16 -16
  404. package/plugin/skills/visual-qa/scripts/png-decode.ts +167 -167
  405. package/plugin/skills/visual-qa/scripts/png-synth.ts +36 -40
  406. package/plugin/skills/visual-qa/scripts/tui-grid.ts +63 -63
  407. package/plugin/skills/visual-qa/scripts/types.ts +37 -37
  408. package/plugin/skills/visual-qa/scripts/visual-qa.mjs +268 -289
@@ -3,16 +3,30 @@ import type { PageRule } from "../../rule"
3
3
  import { cjk, visibleText } from "./support/text-context"
4
4
 
5
5
  export const extremeNegativeTracking: PageRule = {
6
- meta: {
7
- id: "extreme-negative-tracking", name: "Crushed letter spacing", category: "slop", severity: "warning", engine: "page",
8
- description: "Negative tracking beyond the reading or display threshold damages letter shapes.",
9
- fixHint: "Keep tracking at or above -0.07em for reading text and -0.09em for display type.",
10
- },
11
- check: ({ snapshot }) => snapshot.elements.flatMap(element => {
12
- const size = fontSizePx(element)
13
- const tracking = (px(styleOf(element, "letter-spacing")) ?? 0) / size
14
- if (visibleText(snapshot, element) === false || element.ownText.length <= 10 || element.text.length <= 20 ||
15
- size <= 0 || tracking >= (size >= 40 ? -0.09 : -0.07) || cjk(element.text)) return []
16
- return [{ element, message: `Letter spacing ${tracking.toFixed(2)}em at ${size}px`, snippet: shortSnippet(element) }]
17
- }),
6
+ meta: {
7
+ id: "extreme-negative-tracking",
8
+ name: "Crushed letter spacing",
9
+ category: "slop",
10
+ severity: "warning",
11
+ engine: "page",
12
+ description: "Negative tracking beyond the reading or display threshold damages letter shapes.",
13
+ fixHint: "Keep tracking at or above -0.07em for reading text and -0.09em for display type.",
14
+ },
15
+ check: ({ snapshot }) =>
16
+ snapshot.elements.flatMap((element) => {
17
+ const size = fontSizePx(element)
18
+ const tracking = (px(styleOf(element, "letter-spacing")) ?? 0) / size
19
+ if (
20
+ visibleText(snapshot, element) === false ||
21
+ element.ownText.length <= 10 ||
22
+ element.text.length <= 20 ||
23
+ size <= 0 ||
24
+ tracking >= (size >= 40 ? -0.09 : -0.07) ||
25
+ cjk(element.text)
26
+ )
27
+ return []
28
+ return [
29
+ { element, message: `Letter spacing ${tracking.toFixed(2)}em at ${size}px`, snippet: shortSnippet(element) },
30
+ ]
31
+ }),
18
32
  }
@@ -4,23 +4,45 @@ import { readingTags, visibleText } from "./support/text-context"
4
4
  import { flatHierarchy } from "./support/type-hierarchy"
5
5
 
6
6
  export const flatTypeHierarchy: PageRule = {
7
- meta: {
8
- id: "flat-type-hierarchy", name: "Flat type hierarchy", category: "slop", severity: "warning", engine: "page",
9
- description: "Heading and body roles have no adjacent size step of at least 1.25.",
10
- fixHint: "Add a stronger size step between at least two heading or body roles.",
11
- },
12
- check: ({ snapshot }) => {
13
- const sampled = (tag: string): boolean => /^h[1-6]$/.test(tag) || readingTags.includes(tag)
14
- const ownChars = (e: (typeof snapshot.elements)[number]): number =>
15
- e.ownText.replace(/\s/g, "").length + childrenOf(snapshot, e)
16
- .filter(n => sampled(n.tag) === false && visibleText(snapshot, n))
17
- .reduce((count, n) => count + ownChars(n), 0)
18
- const samples = snapshot.elements.filter(e => sampled(e.tag) && e.text.trim() !== "" && visibleText(snapshot, e) &&
19
- fontSizePx(e) >= 8 && fontSizePx(e) < 200 &&
20
- (isHeading(e) || [1, 2].includes(ownChars(e)) === false))
21
- .map(e => ({ role: isHeading(e) ? e.tag : "body", size: fontSizePx(e), weight: Number.parseFloat(e.style["font-weight"] ?? "400") }))
22
- const roles = flatHierarchy(samples)
23
- if (roles.length === 0) return []
24
- return [{ element: null, message: `Flat role sizes: ${roles.map(([r, size]) => `${r} ${size}px`).join(", ")}`, snippet: "All adjacent type steps are below 1.25" }]
25
- },
7
+ meta: {
8
+ id: "flat-type-hierarchy",
9
+ name: "Flat type hierarchy",
10
+ category: "slop",
11
+ severity: "warning",
12
+ engine: "page",
13
+ description: "Heading and body roles have no adjacent size step of at least 1.25.",
14
+ fixHint: "Add a stronger size step between at least two heading or body roles.",
15
+ },
16
+ check: ({ snapshot }) => {
17
+ const sampled = (tag: string): boolean => /^h[1-6]$/.test(tag) || readingTags.includes(tag)
18
+ const ownChars = (e: (typeof snapshot.elements)[number]): number =>
19
+ e.ownText.replace(/\s/g, "").length +
20
+ childrenOf(snapshot, e)
21
+ .filter((n) => sampled(n.tag) === false && visibleText(snapshot, n))
22
+ .reduce((count, n) => count + ownChars(n), 0)
23
+ const samples = snapshot.elements
24
+ .filter(
25
+ (e) =>
26
+ sampled(e.tag) &&
27
+ e.text.trim() !== "" &&
28
+ visibleText(snapshot, e) &&
29
+ fontSizePx(e) >= 8 &&
30
+ fontSizePx(e) < 200 &&
31
+ (isHeading(e) || [1, 2].includes(ownChars(e)) === false),
32
+ )
33
+ .map((e) => ({
34
+ role: isHeading(e) ? e.tag : "body",
35
+ size: fontSizePx(e),
36
+ weight: Number.parseFloat(e.style["font-weight"] ?? "400"),
37
+ }))
38
+ const roles = flatHierarchy(samples)
39
+ if (roles.length === 0) return []
40
+ return [
41
+ {
42
+ element: null,
43
+ message: `Flat role sizes: ${roles.map(([r, size]) => `${r} ${size}px`).join(", ")}`,
44
+ snippet: "All adjacent type steps are below 1.25",
45
+ },
46
+ ]
47
+ },
26
48
  }
@@ -15,7 +15,18 @@ import { undersizedUiText } from "./undersized-ui-text"
15
15
  import { wideTracking } from "./wide-tracking"
16
16
 
17
17
  export const TYPOGRAPHY_RULES: readonly Rule[] = [
18
- overusedFont, flatTypeHierarchy, italicSerifDisplay, oversizedH1, extremeNegativeTracking,
19
- tinyText, undersizedUiText, allCapsBody, wideTracking, tightLeading, justifiedText,
20
- lineLength, designSystemFont, designSystemFontSize,
18
+ overusedFont,
19
+ flatTypeHierarchy,
20
+ italicSerifDisplay,
21
+ oversizedH1,
22
+ extremeNegativeTracking,
23
+ tinyText,
24
+ undersizedUiText,
25
+ allCapsBody,
26
+ wideTracking,
27
+ tightLeading,
28
+ justifiedText,
29
+ lineLength,
30
+ designSystemFont,
31
+ designSystemFontSize,
21
32
  ]
@@ -3,22 +3,73 @@ import type { PageRule } from "../../rule"
3
3
  import { visibleText } from "./support/text-context"
4
4
  import { primaryFont } from "./support/font-family"
5
5
 
6
- const serifNames = ["fraunces", "recoleta", "newsreader", "playfair display", "playfair", "cormorant", "cormorant garamond", "garamond", "eb garamond", "tiempos", "tiempos headline", "tiempos text", "lora", "vollkorn", "spectral", "source serif pro", "source serif 4", "source serif", "ibm plex serif", "merriweather", "libre caslon", "libre baskerville", "baskerville", "georgia", "times new roman", "times", "dm serif display", "dm serif text", "instrument serif", "gt sectra", "ogg", "canela", "freight display", "freight text"]
6
+ const serifNames = [
7
+ "fraunces",
8
+ "recoleta",
9
+ "newsreader",
10
+ "playfair display",
11
+ "playfair",
12
+ "cormorant",
13
+ "cormorant garamond",
14
+ "garamond",
15
+ "eb garamond",
16
+ "tiempos",
17
+ "tiempos headline",
18
+ "tiempos text",
19
+ "lora",
20
+ "vollkorn",
21
+ "spectral",
22
+ "source serif pro",
23
+ "source serif 4",
24
+ "source serif",
25
+ "ibm plex serif",
26
+ "merriweather",
27
+ "libre caslon",
28
+ "libre baskerville",
29
+ "baskerville",
30
+ "georgia",
31
+ "times new roman",
32
+ "times",
33
+ "dm serif display",
34
+ "dm serif text",
35
+ "instrument serif",
36
+ "gt sectra",
37
+ "ogg",
38
+ "canela",
39
+ "freight display",
40
+ "freight text",
41
+ ]
7
42
 
8
43
  export const italicSerifDisplay: PageRule = {
9
- meta: {
10
- id: "italic-serif-display", name: "Italic serif display headline", category: "slop", severity: "warning", engine: "page",
11
- description: "An italic serif at hero scale repeats a common landing-page treatment.",
12
- fixHint: "Use roman type or a non-serif display face unless the brief calls for editorial typography.",
13
- },
14
- check: ({ snapshot }) => snapshot.elements.flatMap(element => {
15
- if (["h1", "h2"].includes(element.tag) === false || visibleText(snapshot, element) === false) return []
16
- const italic = [element, ...descendants(snapshot, element)].some(n => {
17
- const families = styleOf(n, "font-family").toLowerCase().split(",").map(f => f.trim().replace(/^['"]|['"]$/g, ""))
18
- const primary = primaryFont(styleOf(n, "font-family"), true)
19
- return visibleText(snapshot, n) && n.ownText.trim() !== "" && styleOf(n, "font-style") === "italic" &&
20
- fontSizePx(n) >= 48 && primary !== "" && (serifNames.includes(primary) || families.includes("serif"))
21
- })
22
- return italic ? [{ element, message: "Italic serif heading at 48px or larger", snippet: shortSnippet(element) }] : []
23
- }),
44
+ meta: {
45
+ id: "italic-serif-display",
46
+ name: "Italic serif display headline",
47
+ category: "slop",
48
+ severity: "warning",
49
+ engine: "page",
50
+ description: "An italic serif at hero scale repeats a common landing-page treatment.",
51
+ fixHint: "Use roman type or a non-serif display face unless the brief calls for editorial typography.",
52
+ },
53
+ check: ({ snapshot }) =>
54
+ snapshot.elements.flatMap((element) => {
55
+ if (["h1", "h2"].includes(element.tag) === false || visibleText(snapshot, element) === false) return []
56
+ const italic = [element, ...descendants(snapshot, element)].some((n) => {
57
+ const families = styleOf(n, "font-family")
58
+ .toLowerCase()
59
+ .split(",")
60
+ .map((f) => f.trim().replace(/^['"]|['"]$/g, ""))
61
+ const primary = primaryFont(styleOf(n, "font-family"), true)
62
+ return (
63
+ visibleText(snapshot, n) &&
64
+ n.ownText.trim() !== "" &&
65
+ styleOf(n, "font-style") === "italic" &&
66
+ fontSizePx(n) >= 48 &&
67
+ primary !== "" &&
68
+ (serifNames.includes(primary) || families.includes("serif"))
69
+ )
70
+ })
71
+ return italic
72
+ ? [{ element, message: "Italic serif heading at 48px or larger", snippet: shortSnippet(element) }]
73
+ : []
74
+ }),
24
75
  }
@@ -4,29 +4,51 @@ import { letters, visibleText } from "./support/text-context"
4
4
  import { mergedLines, phrasingNodes } from "./support/text-lines"
5
5
 
6
6
  export const justifiedText: PageRule = {
7
- meta: {
8
- id: "justified-text", name: "Justified text", category: "quality", severity: "warning", engine: "page",
9
- description: "Narrow justified columns without automatic hyphenation stretch word spaces into gaps.",
10
- fixHint: "Align text left, widen the column, or enable hyphens: auto.",
11
- },
12
- check: ({ snapshot }) => snapshot.elements.flatMap(element => {
13
- if (visibleText(snapshot, element) === false || element.ownText.length <= 10 ||
14
- styleOf(element, "text-align") !== "justify" || styleOf(element, "hyphens") === "auto") return []
15
- let block = element
16
- if (styleOf(element, "display") === "inline") {
17
- const ancestor = [...ancestors(snapshot, element)].find(n => ["inline", "contents"].includes(styleOf(n, "display")) === false)
18
- if (ancestor === undefined || ancestor.ownText.length > 10) return []
19
- block = ancestor
20
- }
21
- const size = fontSizePx(element)
22
- if (size <= 0 || block.rect.width <= 0 || block.rect.width / (size * 0.5) > 45) return []
23
- const lines = mergedLines(phrasingNodes(snapshot, block))
24
- const first = lines[0]
25
- if (first && Math.max(...lines.map(l => l.y + l.height)) - first.y <
26
- (px(styleOf(block, "line-height")) ?? size * 1.2) + size * 0.75) return []
27
- const chars = letters([...element.ownText].slice(0, 400).join(""))
28
- const exempt = chars.filter(c => /[\u0600-\u06ff\u0750-\u077f\u08a0-\u08ff\u0e00-\u0e7f\u1100-\u11ff\u2e80-\u9fff\ua960-\ud7ff\uf900-\ufaff\ufb50-\ufdff\ufe70-\ufeff\uff66-\uff9f\u{20000}-\u{3134f}]/u.test(c)).length
29
- if (exempt * 2 > chars.length) return []
30
- return [{ element, message: "Narrow justified text without automatic hyphenation", snippet: shortSnippet(element) }]
31
- }),
7
+ meta: {
8
+ id: "justified-text",
9
+ name: "Justified text",
10
+ category: "quality",
11
+ severity: "warning",
12
+ engine: "page",
13
+ description: "Narrow justified columns without automatic hyphenation stretch word spaces into gaps.",
14
+ fixHint: "Align text left, widen the column, or enable hyphens: auto.",
15
+ },
16
+ check: ({ snapshot }) =>
17
+ snapshot.elements.flatMap((element) => {
18
+ if (
19
+ visibleText(snapshot, element) === false ||
20
+ element.ownText.length <= 10 ||
21
+ styleOf(element, "text-align") !== "justify" ||
22
+ styleOf(element, "hyphens") === "auto"
23
+ )
24
+ return []
25
+ let block = element
26
+ if (styleOf(element, "display") === "inline") {
27
+ const ancestor = [...ancestors(snapshot, element)].find(
28
+ (n) => ["inline", "contents"].includes(styleOf(n, "display")) === false,
29
+ )
30
+ if (ancestor === undefined || ancestor.ownText.length > 10) return []
31
+ block = ancestor
32
+ }
33
+ const size = fontSizePx(element)
34
+ if (size <= 0 || block.rect.width <= 0 || block.rect.width / (size * 0.5) > 45) return []
35
+ const lines = mergedLines(phrasingNodes(snapshot, block))
36
+ const first = lines[0]
37
+ if (
38
+ first &&
39
+ Math.max(...lines.map((l) => l.y + l.height)) - first.y <
40
+ (px(styleOf(block, "line-height")) ?? size * 1.2) + size * 0.75
41
+ )
42
+ return []
43
+ const chars = letters([...element.ownText].slice(0, 400).join(""))
44
+ const exempt = chars.filter((c) =>
45
+ /[\u0600-\u06ff\u0750-\u077f\u08a0-\u08ff\u0e00-\u0e7f\u1100-\u11ff\u2e80-\u9fff\ua960-\ud7ff\uf900-\ufaff\ufb50-\ufdff\ufe70-\ufeff\uff66-\uff9f\u{20000}-\u{3134f}]/u.test(
46
+ c,
47
+ ),
48
+ ).length
49
+ if (exempt * 2 > chars.length) return []
50
+ return [
51
+ { element, message: "Narrow justified text without automatic hyphenation", snippet: shortSnippet(element) },
52
+ ]
53
+ }),
32
54
  }
@@ -4,25 +4,41 @@ import { control, finePrintExempt, readingTags, visibleText } from "./support/te
4
4
  import { mergedLines, phrasingNodes, renderedCharacters } from "./support/text-lines"
5
5
 
6
6
  export const lineLength: PageRule = {
7
- meta: {
8
- id: "line-length", name: "Line length too long", category: "quality", severity: "warning", engine: "page",
9
- description: "Multiple rendered lines longer than 80 characters make return sweeps difficult.",
10
- fixHint: "Constrain reading copy to a max-width around 65ch to 75ch.",
11
- },
12
- check: ({ snapshot }) => snapshot.elements.flatMap(element => {
13
- if (visibleText(snapshot, element) === false || finePrintExempt(snapshot, element)) return []
14
- const generic = ["div", "section", "article", "aside", "main"].includes(element.tag) &&
15
- element.ownText.length > 10 && fontSizePx(element) < 24 &&
16
- ["block", "flow-root"].includes(styleOf(element, "display")) &&
17
- styleOf(element, "white-space").startsWith("pre") === false && control(snapshot, element) === false &&
18
- childrenOf(snapshot, element).every(n => ["inline", "contents"].includes(styleOf(n, "display")) || ["br", "wbr"].includes(n.tag))
19
- if (readingTags.includes(element.tag) === false && generic === false) return []
20
- const nodes = phrasingNodes(snapshot, element)
21
- const count = renderedCharacters(nodes)
22
- if (count <= 80) return []
23
- const lines = mergedLines(nodes)
24
- const total = lines.reduce((n, l) => n + l.width, 0)
25
- if (total <= 0 || lines.filter(l => count * l.width / total > 85).length < 2) return []
26
- return [{ element, message: `Rendered lines exceed 80 characters (${Math.round(count * Math.max(...lines.map(l => l.width)) / total)} at widest)`, snippet: shortSnippet(element) }]
27
- }),
7
+ meta: {
8
+ id: "line-length",
9
+ name: "Line length too long",
10
+ category: "quality",
11
+ severity: "warning",
12
+ engine: "page",
13
+ description: "Multiple rendered lines longer than 80 characters make return sweeps difficult.",
14
+ fixHint: "Constrain reading copy to a max-width around 65ch to 75ch.",
15
+ },
16
+ check: ({ snapshot }) =>
17
+ snapshot.elements.flatMap((element) => {
18
+ if (visibleText(snapshot, element) === false || finePrintExempt(snapshot, element)) return []
19
+ const generic =
20
+ ["div", "section", "article", "aside", "main"].includes(element.tag) &&
21
+ element.ownText.length > 10 &&
22
+ fontSizePx(element) < 24 &&
23
+ ["block", "flow-root"].includes(styleOf(element, "display")) &&
24
+ styleOf(element, "white-space").startsWith("pre") === false &&
25
+ control(snapshot, element) === false &&
26
+ childrenOf(snapshot, element).every(
27
+ (n) => ["inline", "contents"].includes(styleOf(n, "display")) || ["br", "wbr"].includes(n.tag),
28
+ )
29
+ if (readingTags.includes(element.tag) === false && generic === false) return []
30
+ const nodes = phrasingNodes(snapshot, element)
31
+ const count = renderedCharacters(nodes)
32
+ if (count <= 80) return []
33
+ const lines = mergedLines(nodes)
34
+ const total = lines.reduce((n, l) => n + l.width, 0)
35
+ if (total <= 0 || lines.filter((l) => (count * l.width) / total > 85).length < 2) return []
36
+ return [
37
+ {
38
+ element,
39
+ message: `Rendered lines exceed 80 characters (${Math.round((count * Math.max(...lines.map((l) => l.width))) / total)} at widest)`,
40
+ snippet: shortSnippet(element),
41
+ },
42
+ ]
43
+ }),
28
44
  }
@@ -3,18 +3,39 @@ import type { PageRule } from "../../rule"
3
3
  import { visibleText } from "./support/text-context"
4
4
 
5
5
  export const oversizedH1: PageRule = {
6
- meta: {
7
- id: "oversized-h1", name: "Oversized hero headline", category: "slop", severity: "warning", engine: "page",
8
- description: "A sentence-length display headline consumes too much of the first screen.",
9
- fixHint: "Shorten the headline or reduce its font size so supporting content fits above the fold.",
10
- },
11
- check: ({ snapshot }) => snapshot.elements.flatMap(element => {
12
- if (element.tag !== "h1" || visibleText(snapshot, element) === false ||
13
- fontSizePx(element) < 72 || element.rect.y >= snapshot.viewport.height) return []
14
- const text = [element, ...descendants(snapshot, element)].filter(e => visibleText(snapshot, e)).map(e => e.ownText).join(" ").trim().replace(/\s+/g, " ")
15
- const height = element.rect.height / snapshot.viewport.height
16
- const area = element.rect.width * element.rect.height / (snapshot.viewport.width * snapshot.viewport.height)
17
- if (text.length < 40 || (height < 0.28 && area < 0.25)) return []
18
- return [{ element, message: `Long display headline occupies ${Math.round(height * 100)}% of viewport height`, snippet: shortSnippet(element) }]
19
- }),
6
+ meta: {
7
+ id: "oversized-h1",
8
+ name: "Oversized hero headline",
9
+ category: "slop",
10
+ severity: "warning",
11
+ engine: "page",
12
+ description: "A sentence-length display headline consumes too much of the first screen.",
13
+ fixHint: "Shorten the headline or reduce its font size so supporting content fits above the fold.",
14
+ },
15
+ check: ({ snapshot }) =>
16
+ snapshot.elements.flatMap((element) => {
17
+ if (
18
+ element.tag !== "h1" ||
19
+ visibleText(snapshot, element) === false ||
20
+ fontSizePx(element) < 72 ||
21
+ element.rect.y >= snapshot.viewport.height
22
+ )
23
+ return []
24
+ const text = [element, ...descendants(snapshot, element)]
25
+ .filter((e) => visibleText(snapshot, e))
26
+ .map((e) => e.ownText)
27
+ .join(" ")
28
+ .trim()
29
+ .replace(/\s+/g, " ")
30
+ const height = element.rect.height / snapshot.viewport.height
31
+ const area = (element.rect.width * element.rect.height) / (snapshot.viewport.width * snapshot.viewport.height)
32
+ if (text.length < 40 || (height < 0.28 && area < 0.25)) return []
33
+ return [
34
+ {
35
+ element,
36
+ message: `Long display headline occupies ${Math.round(height * 100)}% of viewport height`,
37
+ snippet: shortSnippet(element),
38
+ },
39
+ ]
40
+ }),
20
41
  }
@@ -4,42 +4,87 @@ import { brandDomain, canonicalFont, overusedFonts, primaryFont } from "./suppor
4
4
  import { cjkChar, letters, lineage } from "./support/text-context"
5
5
 
6
6
  export const overusedFont: PageRule = {
7
- meta: {
8
- id: "overused-font", name: "Overused font", category: "slop", severity: "warning", engine: "page",
9
- description: "The page's dominant face comes from a frequently repeated set of interface fonts.",
10
- fixHint: "Choose a face suited to the project, or list the intentional choice in allowFonts.",
11
- },
12
- check: ({ snapshot, config }) => {
13
- const usage = new Map<string, { count: number; chars: number; latin: number }>()
14
- let total = 0
15
- let chars = 0
16
- let letterCount = 0
17
- let cjkCount = 0
18
- for (const e of snapshot.elements) {
19
- if (["p", "h1", "h2", "h3", "h4", "h5", "h6", "li", "td", "th", "dd", "blockquote", "figcaption", "a", "button", "label", "span"].includes(e.tag) === false ||
20
- e.ownText.trim() === "" || lineage(snapshot, e).some(n => /impeccable-(overlay|label|banner|tooltip)/.test(n.attributes["class"] ?? ""))) continue
21
- const font = canonicalFont(primaryFont(styleOf(e, "font-family")))
22
- if (font === "") continue
23
- const hasBox = lineage(snapshot, e).every(n => n.attributes["hidden"] === undefined &&
24
- styleOf(n, "display") !== "none" && ["hidden", "collapse"].includes(styleOf(n, "visibility")) === false &&
25
- styleOf(n, "content-visibility") !== "hidden")
26
- const weight = hasBox ? [...e.ownText].length : 0
27
- const alphabet = hasBox ? letters(e.ownText) : []
28
- const cjkLetters = alphabet.filter(cjkChar).length
29
- const value = usage.get(font) ?? { count: 0, chars: 0, latin: 0 }
30
- usage.set(font, { count: value.count + 1, chars: value.chars + weight, latin: value.latin + alphabet.length - cjkLetters })
31
- total++
32
- chars += weight
33
- letterCount += alphabet.length
34
- cjkCount += cjkLetters
35
- }
36
- const ranked = [...usage].sort((a, b) => b[1].count - a[1].count)
37
- const top = ranked[0]
38
- if (total < 20 || top === undefined || ranked[1]?.[1].count === top[1].count) return []
39
- const [font, value] = top
40
- if (overusedFonts.includes(font) === false || config.allowFonts?.some(f => canonicalFont(f) === font) ||
41
- brandDomain(font, snapshot.url) || (chars > 0 && value.chars / chars < 0.05) ||
42
- (cjkCount * 2 > letterCount && value.latin / letterCount < 0.05)) return []
43
- return [{ element: null, message: `Primary font: ${font} (${Math.round(value.count / total * 100)}% of text)`, snippet: font }]
44
- },
7
+ meta: {
8
+ id: "overused-font",
9
+ name: "Overused font",
10
+ category: "slop",
11
+ severity: "warning",
12
+ engine: "page",
13
+ description: "The page's dominant face comes from a frequently repeated set of interface fonts.",
14
+ fixHint: "Choose a face suited to the project, or list the intentional choice in allowFonts.",
15
+ },
16
+ check: ({ snapshot, config }) => {
17
+ const usage = new Map<string, { count: number; chars: number; latin: number }>()
18
+ let total = 0
19
+ let chars = 0
20
+ let letterCount = 0
21
+ let cjkCount = 0
22
+ for (const e of snapshot.elements) {
23
+ if (
24
+ [
25
+ "p",
26
+ "h1",
27
+ "h2",
28
+ "h3",
29
+ "h4",
30
+ "h5",
31
+ "h6",
32
+ "li",
33
+ "td",
34
+ "th",
35
+ "dd",
36
+ "blockquote",
37
+ "figcaption",
38
+ "a",
39
+ "button",
40
+ "label",
41
+ "span",
42
+ ].includes(e.tag) === false ||
43
+ e.ownText.trim() === "" ||
44
+ lineage(snapshot, e).some((n) => /impeccable-(overlay|label|banner|tooltip)/.test(n.attributes["class"] ?? ""))
45
+ )
46
+ continue
47
+ const font = canonicalFont(primaryFont(styleOf(e, "font-family")))
48
+ if (font === "") continue
49
+ const hasBox = lineage(snapshot, e).every(
50
+ (n) =>
51
+ n.attributes["hidden"] === undefined &&
52
+ styleOf(n, "display") !== "none" &&
53
+ ["hidden", "collapse"].includes(styleOf(n, "visibility")) === false &&
54
+ styleOf(n, "content-visibility") !== "hidden",
55
+ )
56
+ const weight = hasBox ? [...e.ownText].length : 0
57
+ const alphabet = hasBox ? letters(e.ownText) : []
58
+ const cjkLetters = alphabet.filter(cjkChar).length
59
+ const value = usage.get(font) ?? { count: 0, chars: 0, latin: 0 }
60
+ usage.set(font, {
61
+ count: value.count + 1,
62
+ chars: value.chars + weight,
63
+ latin: value.latin + alphabet.length - cjkLetters,
64
+ })
65
+ total++
66
+ chars += weight
67
+ letterCount += alphabet.length
68
+ cjkCount += cjkLetters
69
+ }
70
+ const ranked = [...usage].sort((a, b) => b[1].count - a[1].count)
71
+ const top = ranked[0]
72
+ if (total < 20 || top === undefined || ranked[1]?.[1].count === top[1].count) return []
73
+ const [font, value] = top
74
+ if (
75
+ overusedFonts.includes(font) === false ||
76
+ config.allowFonts?.some((f) => canonicalFont(f) === font) ||
77
+ brandDomain(font, snapshot.url) ||
78
+ (chars > 0 && value.chars / chars < 0.05) ||
79
+ (cjkCount * 2 > letterCount && value.latin / letterCount < 0.05)
80
+ )
81
+ return []
82
+ return [
83
+ {
84
+ element: null,
85
+ message: `Primary font: ${font} (${Math.round((value.count / total) * 100)}% of text)`,
86
+ snippet: font,
87
+ },
88
+ ]
89
+ },
45
90
  }