monomind 2.7.12 → 2.7.13

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 (1159) hide show
  1. package/bin/cli.js +55 -4
  2. package/package.json +4 -47
  3. package/bin/npx-safe-launch.js +0 -9
  4. package/packages/@monomind/cli/.claude/agents/architecture/system-design/arch-system-design.md +0 -54
  5. package/packages/@monomind/cli/.claude/agents/consensus/crdt-synchronizer.md +0 -977
  6. package/packages/@monomind/cli/.claude/agents/consensus/quorum-manager.md +0 -106
  7. package/packages/@monomind/cli/.claude/agents/consensus/security-manager.md +0 -602
  8. package/packages/@monomind/cli/.claude/agents/core/coder.md +0 -271
  9. package/packages/@monomind/cli/.claude/agents/core/coordinator.md +0 -133
  10. package/packages/@monomind/cli/.claude/agents/core/planner.md +0 -179
  11. package/packages/@monomind/cli/.claude/agents/core/researcher.md +0 -197
  12. package/packages/@monomind/cli/.claude/agents/core/reviewer.md +0 -336
  13. package/packages/@monomind/cli/.claude/agents/core/tester.md +0 -326
  14. package/packages/@monomind/cli/.claude/agents/design/design-monodesign.md +0 -121
  15. package/packages/@monomind/cli/.claude/agents/engineering/engineering-ai-data-remediation-engineer.md +0 -212
  16. package/packages/@monomind/cli/.claude/agents/engineering/engineering-ai-engineer.md +0 -165
  17. package/packages/@monomind/cli/.claude/agents/engineering/engineering-autonomous-optimization-architect.md +0 -108
  18. package/packages/@monomind/cli/.claude/agents/engineering/engineering-backend-architect.md +0 -254
  19. package/packages/@monomind/cli/.claude/agents/engineering/engineering-code-reviewer.md +0 -95
  20. package/packages/@monomind/cli/.claude/agents/engineering/engineering-data-engineer.md +0 -307
  21. package/packages/@monomind/cli/.claude/agents/engineering/engineering-database-optimizer.md +0 -200
  22. package/packages/@monomind/cli/.claude/agents/engineering/engineering-devops-automator.md +0 -430
  23. package/packages/@monomind/cli/.claude/agents/engineering/engineering-embedded-firmware-engineer.md +0 -174
  24. package/packages/@monomind/cli/.claude/agents/engineering/engineering-feishu-integration-developer.md +0 -607
  25. package/packages/@monomind/cli/.claude/agents/engineering/engineering-frontend-developer.md +0 -249
  26. package/packages/@monomind/cli/.claude/agents/engineering/engineering-git-workflow-master.md +0 -108
  27. package/packages/@monomind/cli/.claude/agents/engineering/engineering-incident-response-commander.md +0 -482
  28. package/packages/@monomind/cli/.claude/agents/engineering/engineering-mobile-app-builder.md +0 -499
  29. package/packages/@monomind/cli/.claude/agents/engineering/engineering-rapid-prototyper.md +0 -463
  30. package/packages/@monomind/cli/.claude/agents/engineering/engineering-security-engineer.md +0 -303
  31. package/packages/@monomind/cli/.claude/agents/engineering/engineering-senior-developer.md +0 -195
  32. package/packages/@monomind/cli/.claude/agents/engineering/engineering-software-architect.md +0 -100
  33. package/packages/@monomind/cli/.claude/agents/engineering/engineering-solidity-smart-contract-engineer.md +0 -528
  34. package/packages/@monomind/cli/.claude/agents/engineering/engineering-sre.md +0 -114
  35. package/packages/@monomind/cli/.claude/agents/engineering/engineering-technical-writer.md +0 -412
  36. package/packages/@monomind/cli/.claude/agents/engineering/engineering-threat-detection-engineer.md +0 -540
  37. package/packages/@monomind/cli/.claude/agents/engineering/engineering-wechat-mini-program-developer.md +0 -351
  38. package/packages/@monomind/cli/.claude/agents/github/code-review-swarm.md +0 -557
  39. package/packages/@monomind/cli/.claude/agents/github/github-modes.md +0 -154
  40. package/packages/@monomind/cli/.claude/agents/github/issue-tracker.md +0 -297
  41. package/packages/@monomind/cli/.claude/agents/github/multi-repo-swarm.md +0 -525
  42. package/packages/@monomind/cli/.claude/agents/github/pr-manager.md +0 -161
  43. package/packages/@monomind/cli/.claude/agents/github/project-board-sync.md +0 -478
  44. package/packages/@monomind/cli/.claude/agents/github/release-manager.md +0 -296
  45. package/packages/@monomind/cli/.claude/agents/github/repo-architect.md +0 -351
  46. package/packages/@monomind/cli/.claude/agents/github/swarm-issue.md +0 -548
  47. package/packages/@monomind/cli/.claude/agents/github/swarm-pr.md +0 -427
  48. package/packages/@monomind/cli/.claude/agents/github/sync-coordinator.md +0 -355
  49. package/packages/@monomind/cli/.claude/agents/github/workflow-automation.md +0 -640
  50. package/packages/@monomind/cli/.claude/agents/goal/goal-planner.md +0 -167
  51. package/packages/@monomind/cli/.claude/agents/hive-mind/collective-intelligence-coordinator.md +0 -93
  52. package/packages/@monomind/cli/.claude/agents/hive-mind/scout-explorer.md +0 -241
  53. package/packages/@monomind/cli/.claude/agents/hive-mind/swarm-memory-manager.md +0 -192
  54. package/packages/@monomind/cli/.claude/agents/hive-mind/worker-specialist.md +0 -216
  55. package/packages/@monomind/cli/.claude/agents/marketing/marketing-competitive-content.md +0 -155
  56. package/packages/@monomind/cli/.claude/agents/marketing/marketing-cro-specialist.md +0 -147
  57. package/packages/@monomind/cli/.claude/agents/marketing/marketing-email-specialist.md +0 -90
  58. package/packages/@monomind/cli/.claude/agents/marketing/marketing-launch-strategist.md +0 -129
  59. package/packages/@monomind/cli/.claude/agents/marketing/marketing-pricing-strategist.md +0 -127
  60. package/packages/@monomind/cli/.claude/agents/optimization/benchmark-suite.md +0 -665
  61. package/packages/@monomind/cli/.claude/agents/optimization/load-balancer.md +0 -431
  62. package/packages/@monomind/cli/.claude/agents/optimization/performance-monitor.md +0 -672
  63. package/packages/@monomind/cli/.claude/agents/optimization/resource-allocator.md +0 -674
  64. package/packages/@monomind/cli/.claude/agents/optimization/topology-optimizer.md +0 -808
  65. package/packages/@monomind/cli/.claude/agents/schemas/architecture-output.json +0 -43
  66. package/packages/@monomind/cli/.claude/agents/schemas/code-review-output.json +0 -28
  67. package/packages/@monomind/cli/.claude/agents/schemas/generic-task-input.json +0 -12
  68. package/packages/@monomind/cli/.claude/agents/schemas/implementation-output.json +0 -18
  69. package/packages/@monomind/cli/.claude/agents/schemas/research-output.json +0 -31
  70. package/packages/@monomind/cli/.claude/agents/schemas/security-audit-output.json +0 -29
  71. package/packages/@monomind/cli/.claude/agents/schemas/test-report-output.json +0 -29
  72. package/packages/@monomind/cli/.claude/agents/specialists/integration-architect.md +0 -94
  73. package/packages/@monomind/cli/.claude/agents/specialized/agentic-identity-trust.md +0 -388
  74. package/packages/@monomind/cli/.claude/agents/specialized/agents-orchestrator.md +0 -368
  75. package/packages/@monomind/cli/.claude/agents/specialized/automation-governance-architect.md +0 -217
  76. package/packages/@monomind/cli/.claude/agents/specialized/blockchain-security-auditor.md +0 -497
  77. package/packages/@monomind/cli/.claude/agents/specialized/compliance-auditor.md +0 -159
  78. package/packages/@monomind/cli/.claude/agents/specialized/identity-graph-operator.md +0 -261
  79. package/packages/@monomind/cli/.claude/agents/specialized/lsp-index-engineer.md +0 -315
  80. package/packages/@monomind/cli/.claude/agents/specialized/mobile/spec-mobile-react-native.md +0 -89
  81. package/packages/@monomind/cli/.claude/agents/specialized/specialized-cultural-intelligence-strategist.md +0 -89
  82. package/packages/@monomind/cli/.claude/agents/specialized/specialized-developer-advocate.md +0 -318
  83. package/packages/@monomind/cli/.claude/agents/specialized/specialized-document-generator.md +0 -56
  84. package/packages/@monomind/cli/.claude/agents/specialized/specialized-mcp-builder.md +0 -64
  85. package/packages/@monomind/cli/.claude/agents/specialized/specialized-model-qa.md +0 -489
  86. package/packages/@monomind/cli/.claude/agents/specialized/specialized-workflow-architect.md +0 -595
  87. package/packages/@monomind/cli/.claude/agents/specialized/zk-steward.md +0 -212
  88. package/packages/@monomind/cli/.claude/agents/swarm/mesh-coordinator.md +0 -97
  89. package/packages/@monomind/cli/.claude/agents/templates/automation-smart-agent.md +0 -185
  90. package/packages/@monomind/cli/.claude/agents/templates/coordinator-swarm-init.md +0 -83
  91. package/packages/@monomind/cli/.claude/agents/testing/production-validator.md +0 -375
  92. package/packages/@monomind/cli/.claude/agents/testing/tdd-london-swarm.md +0 -241
  93. package/packages/@monomind/cli/.claude/agents/testing/testing-accessibility-auditor.md +0 -322
  94. package/packages/@monomind/cli/.claude/agents/testing/testing-api-tester.md +0 -307
  95. package/packages/@monomind/cli/.claude/agents/testing/testing-evidence-collector.md +0 -213
  96. package/packages/@monomind/cli/.claude/agents/testing/testing-performance-benchmarker.md +0 -269
  97. package/packages/@monomind/cli/.claude/agents/testing/testing-test-results-analyzer.md +0 -306
  98. package/packages/@monomind/cli/.claude/agents/testing/testing-tool-evaluator.md +0 -395
  99. package/packages/@monomind/cli/.claude/agents/testing/testing-workflow-optimizer.md +0 -451
  100. package/packages/@monomind/cli/.claude/commands/agents/README.md +0 -14
  101. package/packages/@monomind/cli/.claude/commands/agents/agent-capabilities.md +0 -25
  102. package/packages/@monomind/cli/.claude/commands/agents/agent-coordination.md +0 -32
  103. package/packages/@monomind/cli/.claude/commands/agents/agent-spawning.md +0 -32
  104. package/packages/@monomind/cli/.claude/commands/agents/agent-types.md +0 -30
  105. package/packages/@monomind/cli/.claude/commands/analysis/README.md +0 -18
  106. package/packages/@monomind/cli/.claude/commands/analysis/bottleneck-detect.md +0 -69
  107. package/packages/@monomind/cli/.claude/commands/analysis/performance-bottlenecks.md +0 -59
  108. package/packages/@monomind/cli/.claude/commands/analysis/performance-report.md +0 -52
  109. package/packages/@monomind/cli/.claude/commands/analysis/token-usage.md +0 -47
  110. package/packages/@monomind/cli/.claude/commands/automation/README.md +0 -19
  111. package/packages/@monomind/cli/.claude/commands/automation/auto-agent.md +0 -86
  112. package/packages/@monomind/cli/.claude/commands/automation/self-healing.md +0 -108
  113. package/packages/@monomind/cli/.claude/commands/automation/session-memory.md +0 -89
  114. package/packages/@monomind/cli/.claude/commands/automation/smart-agents.md +0 -81
  115. package/packages/@monomind/cli/.claude/commands/automation/smart-spawn.md +0 -66
  116. package/packages/@monomind/cli/.claude/commands/automation/workflow-select.md +0 -60
  117. package/packages/@monomind/cli/.claude/commands/coordination/README.md +0 -13
  118. package/packages/@monomind/cli/.claude/commands/coordination/agent-spawn.md +0 -69
  119. package/packages/@monomind/cli/.claude/commands/coordination/swarm-init.md +0 -82
  120. package/packages/@monomind/cli/.claude/commands/coordination/task-orchestrate.md +0 -79
  121. package/packages/@monomind/cli/.claude/commands/github/README.md +0 -24
  122. package/packages/@monomind/cli/.claude/commands/github/github-modes.md +0 -151
  123. package/packages/@monomind/cli/.claude/commands/github/issue-tracker.md +0 -291
  124. package/packages/@monomind/cli/.claude/commands/github/pr-manager.md +0 -171
  125. package/packages/@monomind/cli/.claude/commands/github/release-manager.md +0 -343
  126. package/packages/@monomind/cli/.claude/commands/github/repo-architect.md +0 -372
  127. package/packages/@monomind/cli/.claude/commands/github/sync-coordinator.md +0 -297
  128. package/packages/@monomind/cli/.claude/commands/hive-mind/README.md +0 -42
  129. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-consensus.md +0 -72
  130. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-init.md +0 -68
  131. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-memory.md +0 -73
  132. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-spawn.md +0 -82
  133. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-status.md +0 -56
  134. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-stop.md +0 -55
  135. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind.md +0 -87
  136. package/packages/@monomind/cli/.claude/commands/hooks/README.md +0 -66
  137. package/packages/@monomind/cli/.claude/commands/hooks/overview.md +0 -112
  138. package/packages/@monomind/cli/.claude/commands/hooks/post-edit.md +0 -78
  139. package/packages/@monomind/cli/.claude/commands/hooks/post-task.md +0 -62
  140. package/packages/@monomind/cli/.claude/commands/hooks/pre-edit.md +0 -81
  141. package/packages/@monomind/cli/.claude/commands/hooks/pre-task.md +0 -73
  142. package/packages/@monomind/cli/.claude/commands/hooks/session-end.md +0 -82
  143. package/packages/@monomind/cli/.claude/commands/hooks/setup.md +0 -132
  144. package/packages/@monomind/cli/.claude/commands/mastermind/_repeat.md +0 -492
  145. package/packages/@monomind/cli/.claude/commands/mastermind/_taskfile.md +0 -232
  146. package/packages/@monomind/cli/.claude/commands/mastermind/adr.md +0 -9
  147. package/packages/@monomind/cli/.claude/commands/mastermind/approvev1.md +0 -94
  148. package/packages/@monomind/cli/.claude/commands/mastermind/architect.md +0 -52
  149. package/packages/@monomind/cli/.claude/commands/mastermind/autodev.md +0 -28
  150. package/packages/@monomind/cli/.claude/commands/mastermind/brain.md +0 -99
  151. package/packages/@monomind/cli/.claude/commands/mastermind/budget.md +0 -5
  152. package/packages/@monomind/cli/.claude/commands/mastermind/build.md +0 -23
  153. package/packages/@monomind/cli/.claude/commands/mastermind/code-review.md +0 -314
  154. package/packages/@monomind/cli/.claude/commands/mastermind/content.md +0 -23
  155. package/packages/@monomind/cli/.claude/commands/mastermind/createorg.md +0 -143
  156. package/packages/@monomind/cli/.claude/commands/mastermind/createtask.md +0 -372
  157. package/packages/@monomind/cli/.claude/commands/mastermind/debug.md +0 -19
  158. package/packages/@monomind/cli/.claude/commands/mastermind/design.md +0 -17
  159. package/packages/@monomind/cli/.claude/commands/mastermind/do.md +0 -525
  160. package/packages/@monomind/cli/.claude/commands/mastermind/execute.md +0 -17
  161. package/packages/@monomind/cli/.claude/commands/mastermind/finance.md +0 -23
  162. package/packages/@monomind/cli/.claude/commands/mastermind/finish.md +0 -17
  163. package/packages/@monomind/cli/.claude/commands/mastermind/graph-status.md +0 -5
  164. package/packages/@monomind/cli/.claude/commands/mastermind/help.md +0 -133
  165. package/packages/@monomind/cli/.claude/commands/mastermind/idea.md +0 -23
  166. package/packages/@monomind/cli/.claude/commands/mastermind/ideate.md +0 -258
  167. package/packages/@monomind/cli/.claude/commands/mastermind/improve.md +0 -342
  168. package/packages/@monomind/cli/.claude/commands/mastermind/loops.md +0 -5
  169. package/packages/@monomind/cli/.claude/commands/mastermind/marketing.md +0 -23
  170. package/packages/@monomind/cli/.claude/commands/mastermind/master.md +0 -1140
  171. package/packages/@monomind/cli/.claude/commands/mastermind/memory.md +0 -227
  172. package/packages/@monomind/cli/.claude/commands/mastermind/okf-export.md +0 -14
  173. package/packages/@monomind/cli/.claude/commands/mastermind/okf-import.md +0 -15
  174. package/packages/@monomind/cli/.claude/commands/mastermind/ops.md +0 -23
  175. package/packages/@monomind/cli/.claude/commands/mastermind/orgs.md +0 -18
  176. package/packages/@monomind/cli/.claude/commands/mastermind/orgstatus.md +0 -56
  177. package/packages/@monomind/cli/.claude/commands/mastermind/plan.md +0 -23
  178. package/packages/@monomind/cli/.claude/commands/mastermind/receive-review.md +0 -17
  179. package/packages/@monomind/cli/.claude/commands/mastermind/references/antigravity-tools.md +0 -60
  180. package/packages/@monomind/cli/.claude/commands/mastermind/references/claude-code-tools.md +0 -50
  181. package/packages/@monomind/cli/.claude/commands/mastermind/references/codex-tools.md +0 -64
  182. package/packages/@monomind/cli/.claude/commands/mastermind/references/copilot-tools.md +0 -49
  183. package/packages/@monomind/cli/.claude/commands/mastermind/references/gemini-tools.md +0 -63
  184. package/packages/@monomind/cli/.claude/commands/mastermind/references/pi-tools.md +0 -28
  185. package/packages/@monomind/cli/.claude/commands/mastermind/release.md +0 -23
  186. package/packages/@monomind/cli/.claude/commands/mastermind/repeat.md +0 -254
  187. package/packages/@monomind/cli/.claude/commands/mastermind/research.md +0 -23
  188. package/packages/@monomind/cli/.claude/commands/mastermind/review.md +0 -34
  189. package/packages/@monomind/cli/.claude/commands/mastermind/runorg.md +0 -71
  190. package/packages/@monomind/cli/.claude/commands/mastermind/runorgv1.md +0 -159
  191. package/packages/@monomind/cli/.claude/commands/mastermind/sales.md +0 -23
  192. package/packages/@monomind/cli/.claude/commands/mastermind/skill-builder.md +0 -17
  193. package/packages/@monomind/cli/.claude/commands/mastermind/specialagents.md +0 -122
  194. package/packages/@monomind/cli/.claude/commands/mastermind/stoporg.md +0 -78
  195. package/packages/@monomind/cli/.claude/commands/mastermind/swarm.md +0 -158
  196. package/packages/@monomind/cli/.claude/commands/mastermind/taskdev.md +0 -23
  197. package/packages/@monomind/cli/.claude/commands/mastermind/tdd.md +0 -19
  198. package/packages/@monomind/cli/.claude/commands/mastermind/techport.md +0 -27
  199. package/packages/@monomind/cli/.claude/commands/mastermind/topology.md +0 -121
  200. package/packages/@monomind/cli/.claude/commands/mastermind/understand.md +0 -136
  201. package/packages/@monomind/cli/.claude/commands/mastermind/verify.md +0 -19
  202. package/packages/@monomind/cli/.claude/commands/mastermind/worktree.md +0 -17
  203. package/packages/@monomind/cli/.claude/commands/mastermind.md +0 -140
  204. package/packages/@monomind/cli/.claude/commands/memory/README.md +0 -79
  205. package/packages/@monomind/cli/.claude/commands/memory/memory-search.md +0 -77
  206. package/packages/@monomind/cli/.claude/commands/monitoring/README.md +0 -69
  207. package/packages/@monomind/cli/.claude/commands/monitoring/agent-metrics.md +0 -65
  208. package/packages/@monomind/cli/.claude/commands/monitoring/agents.md +0 -71
  209. package/packages/@monomind/cli/.claude/commands/monitoring/status.md +0 -108
  210. package/packages/@monomind/cli/.claude/commands/monobrowse.md +0 -21
  211. package/packages/@monomind/cli/.claude/commands/monoes/README.md +0 -30
  212. package/packages/@monomind/cli/.claude/commands/monoes/install.md +0 -163
  213. package/packages/@monomind/cli/.claude/commands/monoes/monoagent.md +0 -148
  214. package/packages/@monomind/cli/.claude/commands/monoes/monoclip.md +0 -64
  215. package/packages/@monomind/cli/.claude/commands/monoes/monotask.md +0 -137
  216. package/packages/@monomind/cli/.claude/commands/monograph/README.md +0 -102
  217. package/packages/@monomind/cli/.claude/commands/monograph/monograph-build.md +0 -79
  218. package/packages/@monomind/cli/.claude/commands/monograph/monograph-search.md +0 -96
  219. package/packages/@monomind/cli/.claude/commands/monograph/monograph-stats.md +0 -53
  220. package/packages/@monomind/cli/.claude/commands/monograph/monograph-watch.md +0 -63
  221. package/packages/@monomind/cli/.claude/commands/monograph/monograph-wiki.md +0 -91
  222. package/packages/@monomind/cli/.claude/commands/optimization/auto-topology.md +0 -85
  223. package/packages/@monomind/cli/.claude/commands/optimization/performance-optimize.md +0 -79
  224. package/packages/@monomind/cli/.claude/commands/pair/README.md +0 -79
  225. package/packages/@monomind/cli/.claude/commands/pair/examples.md +0 -156
  226. package/packages/@monomind/cli/.claude/commands/pair/modes.md +0 -122
  227. package/packages/@monomind/cli/.claude/commands/pair/session.md +0 -124
  228. package/packages/@monomind/cli/.claude/commands/stream-chain/pipeline.md +0 -116
  229. package/packages/@monomind/cli/.claude/commands/stream-chain/run.md +0 -156
  230. package/packages/@monomind/cli/.claude/commands/swarm/README.md +0 -40
  231. package/packages/@monomind/cli/.claude/commands/swarm/analysis.md +0 -73
  232. package/packages/@monomind/cli/.claude/commands/swarm/development.md +0 -72
  233. package/packages/@monomind/cli/.claude/commands/swarm/examples.md +0 -103
  234. package/packages/@monomind/cli/.claude/commands/swarm/maintenance.md +0 -75
  235. package/packages/@monomind/cli/.claude/commands/swarm/optimization.md +0 -84
  236. package/packages/@monomind/cli/.claude/commands/swarm/research.md +0 -76
  237. package/packages/@monomind/cli/.claude/commands/swarm/swarm.md +0 -79
  238. package/packages/@monomind/cli/.claude/commands/swarm/testing.md +0 -80
  239. package/packages/@monomind/cli/.claude/commands/tokens.md +0 -18
  240. package/packages/@monomind/cli/.claude/commands/truth/start.md +0 -121
  241. package/packages/@monomind/cli/.claude/commands/ts.md +0 -14
  242. package/packages/@monomind/cli/.claude/commands/workflows/README.md +0 -64
  243. package/packages/@monomind/cli/.claude/commands/workflows/development.md +0 -86
  244. package/packages/@monomind/cli/.claude/commands/workflows/research.md +0 -89
  245. package/packages/@monomind/cli/.claude/commands/workflows/workflow-create.md +0 -83
  246. package/packages/@monomind/cli/.claude/commands/workflows/workflow-execute.md +0 -101
  247. package/packages/@monomind/cli/.claude/commands/workflows/workflow-export.md +0 -88
  248. package/packages/@monomind/cli/.claude/helpers/build-skill-registry.cjs +0 -323
  249. package/packages/@monomind/cli/.claude/helpers/control-start.cjs +0 -327
  250. package/packages/@monomind/cli/.claude/helpers/control-stop.cjs +0 -95
  251. package/packages/@monomind/cli/.claude/helpers/event-logger.cjs +0 -266
  252. package/packages/@monomind/cli/.claude/helpers/graphify-freshen.cjs +0 -148
  253. package/packages/@monomind/cli/.claude/helpers/handlers/adr-draft-handler.cjs +0 -78
  254. package/packages/@monomind/cli/.claude/helpers/handlers/agent-start-handler.cjs +0 -132
  255. package/packages/@monomind/cli/.claude/helpers/handlers/budget-status-handler.cjs +0 -14
  256. package/packages/@monomind/cli/.claude/helpers/handlers/capture-handler.cjs +0 -736
  257. package/packages/@monomind/cli/.claude/helpers/handlers/compact-handler.cjs +0 -35
  258. package/packages/@monomind/cli/.claude/helpers/handlers/edit-handler.cjs +0 -178
  259. package/packages/@monomind/cli/.claude/helpers/handlers/gates-handler.cjs +0 -494
  260. package/packages/@monomind/cli/.claude/helpers/handlers/graph-status-handler.cjs +0 -45
  261. package/packages/@monomind/cli/.claude/helpers/handlers/loops-status-handler.cjs +0 -48
  262. package/packages/@monomind/cli/.claude/helpers/handlers/route-handler.cjs +0 -770
  263. package/packages/@monomind/cli/.claude/helpers/handlers/session-handler.cjs +0 -286
  264. package/packages/@monomind/cli/.claude/helpers/handlers/session-restore-handler.cjs +0 -573
  265. package/packages/@monomind/cli/.claude/helpers/handlers/stats-handler.cjs +0 -14
  266. package/packages/@monomind/cli/.claude/helpers/handlers/task-handler.cjs +0 -241
  267. package/packages/@monomind/cli/.claude/helpers/hook-handler.cjs +0 -951
  268. package/packages/@monomind/cli/.claude/helpers/intelligence.cjs +0 -510
  269. package/packages/@monomind/cli/.claude/helpers/learning-service.mjs +0 -61
  270. package/packages/@monomind/cli/.claude/helpers/loop-tracker.cjs +0 -119
  271. package/packages/@monomind/cli/.claude/helpers/mastermind-activate.cjs +0 -35
  272. package/packages/@monomind/cli/.claude/helpers/memory-palace.cjs +0 -461
  273. package/packages/@monomind/cli/.claude/helpers/memory.cjs +0 -193
  274. package/packages/@monomind/cli/.claude/helpers/metrics-db.mjs +0 -87
  275. package/packages/@monomind/cli/.claude/helpers/monolean-activate.cjs +0 -30
  276. package/packages/@monomind/cli/.claude/helpers/monolean-config.cjs +0 -76
  277. package/packages/@monomind/cli/.claude/helpers/monolean-instructions.cjs +0 -109
  278. package/packages/@monomind/cli/.claude/helpers/monolean-propagate.cjs +0 -13
  279. package/packages/@monomind/cli/.claude/helpers/monolean-tracker.cjs +0 -18
  280. package/packages/@monomind/cli/.claude/helpers/router.cjs +0 -571
  281. package/packages/@monomind/cli/.claude/helpers/session.cjs +0 -145
  282. package/packages/@monomind/cli/.claude/helpers/skill-registry.json +0 -4948
  283. package/packages/@monomind/cli/.claude/helpers/statusline.cjs +0 -1368
  284. package/packages/@monomind/cli/.claude/helpers/toggle-statusline.cjs +0 -73
  285. package/packages/@monomind/cli/.claude/helpers/token-tracker.cjs +0 -1034
  286. package/packages/@monomind/cli/.claude/helpers/utils/agent-registrations.cjs +0 -41
  287. package/packages/@monomind/cli/.claude/helpers/utils/fs-helpers.cjs +0 -183
  288. package/packages/@monomind/cli/.claude/helpers/utils/micro-agents.cjs +0 -358
  289. package/packages/@monomind/cli/.claude/helpers/utils/monograph.cjs +0 -707
  290. package/packages/@monomind/cli/.claude/helpers/utils/system-pressure.cjs +0 -46
  291. package/packages/@monomind/cli/.claude/helpers/utils/telemetry.cjs +0 -162
  292. package/packages/@monomind/cli/.claude/settings.json +0 -448
  293. package/packages/@monomind/cli/.claude/skills/agent-browser-testing/SKILL.md +0 -964
  294. package/packages/@monomind/cli/.claude/skills/agentic-jujutsu/SKILL.md +0 -645
  295. package/packages/@monomind/cli/.claude/skills/github-issue-triage/SKILL.md +0 -354
  296. package/packages/@monomind/cli/.claude/skills/github-repo-recap/SKILL.md +0 -207
  297. package/packages/@monomind/cli/.claude/skills/github-toolkit/SKILL.md +0 -60
  298. package/packages/@monomind/cli/.claude/skills/hive-mind-advanced/SKILL.md +0 -694
  299. package/packages/@monomind/cli/.claude/skills/hooks-automation/SKILL.md +0 -1192
  300. package/packages/@monomind/cli/.claude/skills/mastermind-access/SKILL.md +0 -236
  301. package/packages/@monomind/cli/.claude/skills/mastermind-activity/SKILL.md +0 -191
  302. package/packages/@monomind/cli/.claude/skills/mastermind-adapter-manager/SKILL.md +0 -259
  303. package/packages/@monomind/cli/.claude/skills/mastermind-adapters/SKILL.md +0 -204
  304. package/packages/@monomind/cli/.claude/skills/mastermind-agent-detail/SKILL.md +0 -242
  305. package/packages/@monomind/cli/.claude/skills/mastermind-agent-select/SKILL.md +0 -132
  306. package/packages/@monomind/cli/.claude/skills/mastermind-agents/SKILL.md +0 -182
  307. package/packages/@monomind/cli/.claude/skills/mastermind-approval-detail/SKILL.md +0 -259
  308. package/packages/@monomind/cli/.claude/skills/mastermind-approvev1/SKILL.md +0 -191
  309. package/packages/@monomind/cli/.claude/skills/mastermind-architect/SKILL.md +0 -862
  310. package/packages/@monomind/cli/.claude/skills/mastermind-autodev/SKILL.md +0 -360
  311. package/packages/@monomind/cli/.claude/skills/mastermind-backup/SKILL.md +0 -197
  312. package/packages/@monomind/cli/.claude/skills/mastermind-bootstrap/SKILL.md +0 -190
  313. package/packages/@monomind/cli/.claude/skills/mastermind-budgets/SKILL.md +0 -237
  314. package/packages/@monomind/cli/.claude/skills/mastermind-build/SKILL.md +0 -169
  315. package/packages/@monomind/cli/.claude/skills/mastermind-companies/SKILL.md +0 -256
  316. package/packages/@monomind/cli/.claude/skills/mastermind-content/SKILL.md +0 -197
  317. package/packages/@monomind/cli/.claude/skills/mastermind-costs/SKILL.md +0 -151
  318. package/packages/@monomind/cli/.claude/skills/mastermind-createorg/SKILL.md +0 -247
  319. package/packages/@monomind/cli/.claude/skills/mastermind-debug/SKILL.md +0 -277
  320. package/packages/@monomind/cli/.claude/skills/mastermind-delegation/SKILL.md +0 -83
  321. package/packages/@monomind/cli/.claude/skills/mastermind-design/SKILL.md +0 -190
  322. package/packages/@monomind/cli/.claude/skills/mastermind-diagnose/SKILL.md +0 -249
  323. package/packages/@monomind/cli/.claude/skills/mastermind-env/SKILL.md +0 -203
  324. package/packages/@monomind/cli/.claude/skills/mastermind-environments/SKILL.md +0 -250
  325. package/packages/@monomind/cli/.claude/skills/mastermind-execute/SKILL.md +0 -104
  326. package/packages/@monomind/cli/.claude/skills/mastermind-export/SKILL.md +0 -333
  327. package/packages/@monomind/cli/.claude/skills/mastermind-finance/SKILL.md +0 -166
  328. package/packages/@monomind/cli/.claude/skills/mastermind-finish/SKILL.md +0 -251
  329. package/packages/@monomind/cli/.claude/skills/mastermind-goal-detail/SKILL.md +0 -255
  330. package/packages/@monomind/cli/.claude/skills/mastermind-goals/SKILL.md +0 -149
  331. package/packages/@monomind/cli/.claude/skills/mastermind-heartbeatv1/SKILL.md +0 -167
  332. package/packages/@monomind/cli/.claude/skills/mastermind-idea/SKILL.md +0 -1142
  333. package/packages/@monomind/cli/.claude/skills/mastermind-import/SKILL.md +0 -281
  334. package/packages/@monomind/cli/.claude/skills/mastermind-inbox/SKILL.md +0 -226
  335. package/packages/@monomind/cli/.claude/skills/mastermind-instance/SKILL.md +0 -235
  336. package/packages/@monomind/cli/.claude/skills/mastermind-instance-settings/SKILL.md +0 -315
  337. package/packages/@monomind/cli/.claude/skills/mastermind-intake/SKILL.md +0 -83
  338. package/packages/@monomind/cli/.claude/skills/mastermind-invite-landing/SKILL.md +0 -227
  339. package/packages/@monomind/cli/.claude/skills/mastermind-invites/SKILL.md +0 -254
  340. package/packages/@monomind/cli/.claude/skills/mastermind-issue-detail/SKILL.md +0 -291
  341. package/packages/@monomind/cli/.claude/skills/mastermind-issues/SKILL.md +0 -235
  342. package/packages/@monomind/cli/.claude/skills/mastermind-join-queue/SKILL.md +0 -170
  343. package/packages/@monomind/cli/.claude/skills/mastermind-liveness/SKILL.md +0 -392
  344. package/packages/@monomind/cli/.claude/skills/mastermind-marketing/SKILL.md +0 -228
  345. package/packages/@monomind/cli/.claude/skills/mastermind-marketing/references/copywriting-frameworks.md +0 -181
  346. package/packages/@monomind/cli/.claude/skills/mastermind-marketing/references/persuasion-psychology.md +0 -158
  347. package/packages/@monomind/cli/.claude/skills/mastermind-memory/SKILL.md +0 -321
  348. package/packages/@monomind/cli/.claude/skills/mastermind-monitor/SKILL.md +0 -1284
  349. package/packages/@monomind/cli/.claude/skills/mastermind-monotask/SKILL.md +0 -350
  350. package/packages/@monomind/cli/.claude/skills/mastermind-my-issues/SKILL.md +0 -146
  351. package/packages/@monomind/cli/.claude/skills/mastermind-new-agent/SKILL.md +0 -241
  352. package/packages/@monomind/cli/.claude/skills/mastermind-ops/SKILL.md +0 -168
  353. package/packages/@monomind/cli/.claude/skills/mastermind-org-chart/SKILL.md +0 -209
  354. package/packages/@monomind/cli/.claude/skills/mastermind-org-settings/SKILL.md +0 -274
  355. package/packages/@monomind/cli/.claude/skills/mastermind-orgs/SKILL.md +0 -120
  356. package/packages/@monomind/cli/.claude/skills/mastermind-orgstatus/SKILL.md +0 -254
  357. package/packages/@monomind/cli/.claude/skills/mastermind-plan/SKILL.md +0 -217
  358. package/packages/@monomind/cli/.claude/skills/mastermind-plan-to-tasks/SKILL.md +0 -136
  359. package/packages/@monomind/cli/.claude/skills/mastermind-plugin-manager/SKILL.md +0 -241
  360. package/packages/@monomind/cli/.claude/skills/mastermind-plugin-settings/SKILL.md +0 -273
  361. package/packages/@monomind/cli/.claude/skills/mastermind-plugins/SKILL.md +0 -190
  362. package/packages/@monomind/cli/.claude/skills/mastermind-profile/SKILL.md +0 -187
  363. package/packages/@monomind/cli/.claude/skills/mastermind-project-detail/SKILL.md +0 -249
  364. package/packages/@monomind/cli/.claude/skills/mastermind-project-workspace/SKILL.md +0 -244
  365. package/packages/@monomind/cli/.claude/skills/mastermind-projects/SKILL.md +0 -167
  366. package/packages/@monomind/cli/.claude/skills/mastermind-protocol/SKILL.md +0 -404
  367. package/packages/@monomind/cli/.claude/skills/mastermind-receive-review/SKILL.md +0 -213
  368. package/packages/@monomind/cli/.claude/skills/mastermind-release/SKILL.md +0 -168
  369. package/packages/@monomind/cli/.claude/skills/mastermind-repeat/SKILL.md +0 -171
  370. package/packages/@monomind/cli/.claude/skills/mastermind-research/SKILL.md +0 -168
  371. package/packages/@monomind/cli/.claude/skills/mastermind-review/SKILL.md +0 -233
  372. package/packages/@monomind/cli/.claude/skills/mastermind-routine-detail/SKILL.md +0 -253
  373. package/packages/@monomind/cli/.claude/skills/mastermind-routines/SKILL.md +0 -203
  374. package/packages/@monomind/cli/.claude/skills/mastermind-runorg/SKILL.md +0 -43
  375. package/packages/@monomind/cli/.claude/skills/mastermind-runorgv1/SKILL.md +0 -731
  376. package/packages/@monomind/cli/.claude/skills/mastermind-sales/SKILL.md +0 -170
  377. package/packages/@monomind/cli/.claude/skills/mastermind-search/SKILL.md +0 -186
  378. package/packages/@monomind/cli/.claude/skills/mastermind-secrets/SKILL.md +0 -199
  379. package/packages/@monomind/cli/.claude/skills/mastermind-skill-builder/SKILL.md +0 -447
  380. package/packages/@monomind/cli/.claude/skills/mastermind-skills/SKILL.md +0 -156
  381. package/packages/@monomind/cli/.claude/skills/mastermind-stoporg/SKILL.md +0 -147
  382. package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/SKILL.md +0 -377
  383. package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/code-quality-reviewer-prompt.md +0 -60
  384. package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/final-reviewer-prompt.md +0 -144
  385. package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/implementer-prompt.md +0 -114
  386. package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/spec-reviewer-prompt.md +0 -80
  387. package/packages/@monomind/cli/.claude/skills/mastermind-tasks/SKILL.md +0 -152
  388. package/packages/@monomind/cli/.claude/skills/mastermind-tdd/SKILL.md +0 -424
  389. package/packages/@monomind/cli/.claude/skills/mastermind-techport/SKILL.md +0 -777
  390. package/packages/@monomind/cli/.claude/skills/mastermind-threads/SKILL.md +0 -259
  391. package/packages/@monomind/cli/.claude/skills/mastermind-tree-control/SKILL.md +0 -250
  392. package/packages/@monomind/cli/.claude/skills/mastermind-verify/SKILL.md +0 -196
  393. package/packages/@monomind/cli/.claude/skills/mastermind-wiki/SKILL.md +0 -314
  394. package/packages/@monomind/cli/.claude/skills/mastermind-workspace-detail/SKILL.md +0 -317
  395. package/packages/@monomind/cli/.claude/skills/mastermind-workspaces/SKILL.md +0 -261
  396. package/packages/@monomind/cli/.claude/skills/mastermind-worktree/SKILL.md +0 -215
  397. package/packages/@monomind/cli/.claude/skills/memory-toolkit/SKILL.md +0 -75
  398. package/packages/@monomind/cli/.claude/skills/monodesign/SKILL.md +0 -257
  399. package/packages/@monomind/cli/.claude/skills/monodesign/adapt.md +0 -53
  400. package/packages/@monomind/cli/.claude/skills/monodesign/agents/monodesign-asset-producer.md +0 -100
  401. package/packages/@monomind/cli/.claude/skills/monodesign/agents/monodesign-manual-edit-applier.md +0 -103
  402. package/packages/@monomind/cli/.claude/skills/monodesign/animate.md +0 -65
  403. package/packages/@monomind/cli/.claude/skills/monodesign/audit.md +0 -89
  404. package/packages/@monomind/cli/.claude/skills/monodesign/bolder.md +0 -50
  405. package/packages/@monomind/cli/.claude/skills/monodesign/clarify.md +0 -64
  406. package/packages/@monomind/cli/.claude/skills/monodesign/colorize.md +0 -68
  407. package/packages/@monomind/cli/.claude/skills/monodesign/craft.md +0 -51
  408. package/packages/@monomind/cli/.claude/skills/monodesign/critique.md +0 -66
  409. package/packages/@monomind/cli/.claude/skills/monodesign/delight.md +0 -47
  410. package/packages/@monomind/cli/.claude/skills/monodesign/distill.md +0 -56
  411. package/packages/@monomind/cli/.claude/skills/monodesign/document.md +0 -83
  412. package/packages/@monomind/cli/.claude/skills/monodesign/extract.md +0 -74
  413. package/packages/@monomind/cli/.claude/skills/monodesign/harden.md +0 -65
  414. package/packages/@monomind/cli/.claude/skills/monodesign/init.md +0 -30
  415. package/packages/@monomind/cli/.claude/skills/monodesign/layout.md +0 -36
  416. package/packages/@monomind/cli/.claude/skills/monodesign/live.md +0 -34
  417. package/packages/@monomind/cli/.claude/skills/monodesign/onboard.md +0 -50
  418. package/packages/@monomind/cli/.claude/skills/monodesign/optimize.md +0 -64
  419. package/packages/@monomind/cli/.claude/skills/monodesign/overdrive.md +0 -56
  420. package/packages/@monomind/cli/.claude/skills/monodesign/polish.md +0 -68
  421. package/packages/@monomind/cli/.claude/skills/monodesign/quieter.md +0 -57
  422. package/packages/@monomind/cli/.claude/skills/monodesign/reference/adapt.md +0 -312
  423. package/packages/@monomind/cli/.claude/skills/monodesign/reference/adapt.native.md +0 -58
  424. package/packages/@monomind/cli/.claude/skills/monodesign/reference/android.md +0 -40
  425. package/packages/@monomind/cli/.claude/skills/monodesign/reference/animate.md +0 -203
  426. package/packages/@monomind/cli/.claude/skills/monodesign/reference/antipatterns-catalog.md +0 -410
  427. package/packages/@monomind/cli/.claude/skills/monodesign/reference/audit.md +0 -135
  428. package/packages/@monomind/cli/.claude/skills/monodesign/reference/audit.native.md +0 -139
  429. package/packages/@monomind/cli/.claude/skills/monodesign/reference/bolder.md +0 -120
  430. package/packages/@monomind/cli/.claude/skills/monodesign/reference/brand-workflow.md +0 -180
  431. package/packages/@monomind/cli/.claude/skills/monodesign/reference/brand.md +0 -108
  432. package/packages/@monomind/cli/.claude/skills/monodesign/reference/clarify.md +0 -288
  433. package/packages/@monomind/cli/.claude/skills/monodesign/reference/codex.md +0 -105
  434. package/packages/@monomind/cli/.claude/skills/monodesign/reference/cognitive-load.md +0 -106
  435. package/packages/@monomind/cli/.claude/skills/monodesign/reference/color-and-contrast.md +0 -105
  436. package/packages/@monomind/cli/.claude/skills/monodesign/reference/colorize.md +0 -257
  437. package/packages/@monomind/cli/.claude/skills/monodesign/reference/component-specs.md +0 -260
  438. package/packages/@monomind/cli/.claude/skills/monodesign/reference/component-states.md +0 -274
  439. package/packages/@monomind/cli/.claude/skills/monodesign/reference/component-system.md +0 -358
  440. package/packages/@monomind/cli/.claude/skills/monodesign/reference/copy-formulas.md +0 -160
  441. package/packages/@monomind/cli/.claude/skills/monodesign/reference/craft.md +0 -123
  442. package/packages/@monomind/cli/.claude/skills/monodesign/reference/critique.md +0 -780
  443. package/packages/@monomind/cli/.claude/skills/monodesign/reference/delight.md +0 -302
  444. package/packages/@monomind/cli/.claude/skills/monodesign/reference/design-principles.md +0 -246
  445. package/packages/@monomind/cli/.claude/skills/monodesign/reference/distill.md +0 -111
  446. package/packages/@monomind/cli/.claude/skills/monodesign/reference/document.md +0 -429
  447. package/packages/@monomind/cli/.claude/skills/monodesign/reference/extract.md +0 -69
  448. package/packages/@monomind/cli/.claude/skills/monodesign/reference/harden.md +0 -347
  449. package/packages/@monomind/cli/.claude/skills/monodesign/reference/heuristics-scoring.md +0 -234
  450. package/packages/@monomind/cli/.claude/skills/monodesign/reference/hooks.md +0 -92
  451. package/packages/@monomind/cli/.claude/skills/monodesign/reference/image-prompts.md +0 -130
  452. package/packages/@monomind/cli/.claude/skills/monodesign/reference/init.md +0 -221
  453. package/packages/@monomind/cli/.claude/skills/monodesign/reference/interaction-design.md +0 -189
  454. package/packages/@monomind/cli/.claude/skills/monodesign/reference/ios.md +0 -45
  455. package/packages/@monomind/cli/.claude/skills/monodesign/reference/layout.md +0 -185
  456. package/packages/@monomind/cli/.claude/skills/monodesign/reference/live.md +0 -710
  457. package/packages/@monomind/cli/.claude/skills/monodesign/reference/motion-design.md +0 -109
  458. package/packages/@monomind/cli/.claude/skills/monodesign/reference/onboard.md +0 -234
  459. package/packages/@monomind/cli/.claude/skills/monodesign/reference/optimize.md +0 -258
  460. package/packages/@monomind/cli/.claude/skills/monodesign/reference/overdrive.md +0 -130
  461. package/packages/@monomind/cli/.claude/skills/monodesign/reference/personas.md +0 -179
  462. package/packages/@monomind/cli/.claude/skills/monodesign/reference/polish.md +0 -241
  463. package/packages/@monomind/cli/.claude/skills/monodesign/reference/pre-delivery-checklist.md +0 -108
  464. package/packages/@monomind/cli/.claude/skills/monodesign/reference/product.md +0 -60
  465. package/packages/@monomind/cli/.claude/skills/monodesign/reference/quieter.md +0 -99
  466. package/packages/@monomind/cli/.claude/skills/monodesign/reference/responsive-design.md +0 -114
  467. package/packages/@monomind/cli/.claude/skills/monodesign/reference/shape.md +0 -165
  468. package/packages/@monomind/cli/.claude/skills/monodesign/reference/spatial-design.md +0 -100
  469. package/packages/@monomind/cli/.claude/skills/monodesign/reference/teach.md +0 -10
  470. package/packages/@monomind/cli/.claude/skills/monodesign/reference/token-architecture.md +0 -222
  471. package/packages/@monomind/cli/.claude/skills/monodesign/reference/typeset.md +0 -301
  472. package/packages/@monomind/cli/.claude/skills/monodesign/reference/typography.md +0 -159
  473. package/packages/@monomind/cli/.claude/skills/monodesign/reference/ux-research.md +0 -143
  474. package/packages/@monomind/cli/.claude/skills/monodesign/reference/ux-rules.md +0 -211
  475. package/packages/@monomind/cli/.claude/skills/monodesign/reference/ux-writing.md +0 -107
  476. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/command-metadata.json +0 -94
  477. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/context-signals.mjs +0 -260
  478. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/context.mjs +0 -1065
  479. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/critique-storage.mjs +0 -416
  480. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detect-csp.mjs +0 -198
  481. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detect.mjs +0 -33
  482. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/browser/injected/index.mjs +0 -1962
  483. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/cli/main.mjs +0 -321
  484. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/design-system.mjs +0 -814
  485. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/detect-antipatterns-browser.js +0 -5608
  486. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/detect-antipatterns.mjs +0 -50
  487. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/browser/detect-url.mjs +0 -259
  488. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/browser/drivers.mjs +0 -258
  489. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/regex/detect-text.mjs +0 -636
  490. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/static-html/css-cascade.mjs +0 -1015
  491. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/static-html/detect-html.mjs +0 -253
  492. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -198
  493. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/findings.mjs +0 -12
  494. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/fix/css-regions.mjs +0 -181
  495. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/fix/fixers.mjs +0 -373
  496. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/fix/index.mjs +0 -426
  497. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/node/file-system.mjs +0 -198
  498. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/profile/profiler.mjs +0 -166
  499. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/registry/antipatterns.mjs +0 -563
  500. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/rules/checks.mjs +0 -3002
  501. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/color.mjs +0 -124
  502. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/constants.mjs +0 -101
  503. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/fonts.mjs +0 -30
  504. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/inline-ignores.mjs +0 -148
  505. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/page.mjs +0 -7
  506. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/hook-admin.mjs +0 -661
  507. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/hook-before-edit.mjs +0 -516
  508. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/hook-lib.mjs +0 -1776
  509. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/hook.mjs +0 -61
  510. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/design-parser.mjs +0 -842
  511. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/is-generated.mjs +0 -69
  512. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/monodesign-config.mjs +0 -640
  513. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/monodesign-paths.mjs +0 -129
  514. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/provider.mjs +0 -4
  515. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/target-args.mjs +0 -42
  516. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/browser-script-parts.mjs +0 -50
  517. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/completion.mjs +0 -19
  518. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/event-validation.mjs +0 -137
  519. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/insert-ui.mjs +0 -458
  520. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/manual-apply.mjs +0 -939
  521. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/manual-edit-routes.mjs +0 -357
  522. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/manual-edits-buffer.mjs +0 -152
  523. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/session-store.mjs +0 -293
  524. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/svelte-component.mjs +0 -826
  525. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/sveltekit-adapter.mjs +0 -274
  526. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/ui-core.mjs +0 -180
  527. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/vocabulary.mjs +0 -36
  528. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-accept.mjs +0 -812
  529. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-browser-dom.js +0 -146
  530. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-browser-session.js +0 -123
  531. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-browser.js +0 -11240
  532. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-commit-manual-edits.mjs +0 -1241
  533. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-complete.mjs +0 -75
  534. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-copy-edit-agent.mjs +0 -683
  535. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-discard-manual-edits.mjs +0 -51
  536. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-inject.mjs +0 -583
  537. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-insert.mjs +0 -272
  538. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-manual-edit-evidence.mjs +0 -363
  539. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-poll.mjs +0 -384
  540. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-resume.mjs +0 -94
  541. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-server.mjs +0 -1174
  542. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-status.mjs +0 -61
  543. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-target.mjs +0 -30
  544. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-wrap.mjs +0 -894
  545. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live.mjs +0 -297
  546. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/modern-screenshot.umd.js +0 -14
  547. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/palette.mjs +0 -633
  548. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/pin.mjs +0 -221
  549. package/packages/@monomind/cli/.claude/skills/monodesign/shape.md +0 -71
  550. package/packages/@monomind/cli/.claude/skills/monodesign/teach.md +0 -18
  551. package/packages/@monomind/cli/.claude/skills/monodesign/typeset.md +0 -59
  552. package/packages/@monomind/cli/.claude/skills/monolean/SKILL.md +0 -118
  553. package/packages/@monomind/cli/.claude/skills/monolean-audit/SKILL.md +0 -41
  554. package/packages/@monomind/cli/.claude/skills/monolean-debt/SKILL.md +0 -46
  555. package/packages/@monomind/cli/.claude/skills/monolean-help/SKILL.md +0 -60
  556. package/packages/@monomind/cli/.claude/skills/monolean-review/SKILL.md +0 -57
  557. package/packages/@monomind/cli/.claude/skills/monomind/browse-agentcore.md +0 -115
  558. package/packages/@monomind/cli/.claude/skills/monomind/browse-electron.md +0 -188
  559. package/packages/@monomind/cli/.claude/skills/monomind/browse-qa.md +0 -228
  560. package/packages/@monomind/cli/.claude/skills/monomind/browse-references/authentication.md +0 -161
  561. package/packages/@monomind/cli/.claude/skills/monomind/browse-references/trust-boundaries.md +0 -40
  562. package/packages/@monomind/cli/.claude/skills/monomind/browse-references/video-recording.md +0 -83
  563. package/packages/@monomind/cli/.claude/skills/monomind/browse-slack.md +0 -188
  564. package/packages/@monomind/cli/.claude/skills/monomind/browse-vercel.md +0 -239
  565. package/packages/@monomind/cli/.claude/skills/monomind/browse.md +0 -724
  566. package/packages/@monomind/cli/.claude/skills/monomotion/SKILL.md +0 -145
  567. package/packages/@monomind/cli/.claude/skills/monomotion/rules/api-control.md +0 -139
  568. package/packages/@monomind/cli/.claude/skills/monomotion/rules/effects.md +0 -109
  569. package/packages/@monomind/cli/.claude/skills/monomotion/rules/integration.md +0 -140
  570. package/packages/@monomind/cli/.claude/skills/monomotion/rules/scroll.md +0 -131
  571. package/packages/@monomind/cli/.claude/skills/monomotion/rules/sequencing.md +0 -105
  572. package/packages/@monomind/cli/.claude/skills/monomotion/rules/svg.md +0 -101
  573. package/packages/@monomind/cli/.claude/skills/monomotion/rules/text.md +0 -119
  574. package/packages/@monomind/cli/.claude/skills/pair-programming/SKILL.md +0 -1202
  575. package/packages/@monomind/cli/.claude/skills/performance-analysis/SKILL.md +0 -560
  576. package/packages/@monomind/cli/.claude/skills/skill-builder/SKILL.md +0 -910
  577. package/packages/@monomind/cli/.claude/skills/specialagent/SKILL.md +0 -206
  578. package/packages/@monomind/cli/.claude/skills/stop-slop/SKILL.md +0 -67
  579. package/packages/@monomind/cli/.claude/skills/stop-slop/references/examples.md +0 -61
  580. package/packages/@monomind/cli/.claude/skills/stop-slop/references/phrases.md +0 -130
  581. package/packages/@monomind/cli/.claude/skills/stop-slop/references/structures.md +0 -136
  582. package/packages/@monomind/cli/.claude/skills/swarm-advanced/SKILL.md +0 -936
  583. package/packages/@monomind/cli/.claude/skills/swarm-orchestration/SKILL.md +0 -179
  584. package/packages/@monomind/cli/.claude/skills/verification-quality/SKILL.md +0 -674
  585. package/packages/@monomind/cli/README.md +0 -414
  586. package/packages/@monomind/cli/bin/cli.js +0 -379
  587. package/packages/@monomind/cli/bin/mcp-server.js +0 -208
  588. package/packages/@monomind/cli/bin/preinstall.cjs +0 -2
  589. package/packages/@monomind/cli/dist/src/agents/registry-builder.d.ts +0 -64
  590. package/packages/@monomind/cli/dist/src/agents/registry-builder.js +0 -228
  591. package/packages/@monomind/cli/dist/src/autopilot-state.d.ts +0 -77
  592. package/packages/@monomind/cli/dist/src/autopilot-state.js +0 -336
  593. package/packages/@monomind/cli/dist/src/browser/action-builder/analyzer.d.ts +0 -11
  594. package/packages/@monomind/cli/dist/src/browser/action-builder/analyzer.js +0 -64
  595. package/packages/@monomind/cli/dist/src/browser/action-builder/types.d.ts +0 -47
  596. package/packages/@monomind/cli/dist/src/browser/action-builder/types.js +0 -2
  597. package/packages/@monomind/cli/dist/src/browser/adapters/gemini.d.ts +0 -3
  598. package/packages/@monomind/cli/dist/src/browser/adapters/gemini.js +0 -16
  599. package/packages/@monomind/cli/dist/src/browser/adapters/index.d.ts +0 -19
  600. package/packages/@monomind/cli/dist/src/browser/adapters/index.js +0 -23
  601. package/packages/@monomind/cli/dist/src/browser/adapters/instagram.d.ts +0 -3
  602. package/packages/@monomind/cli/dist/src/browser/adapters/instagram.js +0 -17
  603. package/packages/@monomind/cli/dist/src/browser/adapters/linkedin.d.ts +0 -3
  604. package/packages/@monomind/cli/dist/src/browser/adapters/linkedin.js +0 -19
  605. package/packages/@monomind/cli/dist/src/browser/adapters/x.d.ts +0 -3
  606. package/packages/@monomind/cli/dist/src/browser/adapters/x.js +0 -19
  607. package/packages/@monomind/cli/dist/src/browser/dashboard/server.d.ts +0 -9
  608. package/packages/@monomind/cli/dist/src/browser/dashboard/server.js +0 -215
  609. package/packages/@monomind/cli/dist/src/browser/dashboard/ui.html +0 -261
  610. package/packages/@monomind/cli/dist/src/browser/workflow/engine.d.ts +0 -15
  611. package/packages/@monomind/cli/dist/src/browser/workflow/engine.js +0 -127
  612. package/packages/@monomind/cli/dist/src/browser/workflow/expression.d.ts +0 -4
  613. package/packages/@monomind/cli/dist/src/browser/workflow/expression.js +0 -64
  614. package/packages/@monomind/cli/dist/src/browser/workflow/store.d.ts +0 -24
  615. package/packages/@monomind/cli/dist/src/browser/workflow/store.js +0 -145
  616. package/packages/@monomind/cli/dist/src/browser/workflow/types.d.ts +0 -48
  617. package/packages/@monomind/cli/dist/src/browser/workflow/types.js +0 -2
  618. package/packages/@monomind/cli/dist/src/capabilities/cap-code.d.ts +0 -3
  619. package/packages/@monomind/cli/dist/src/capabilities/cap-code.js +0 -20
  620. package/packages/@monomind/cli/dist/src/capabilities/cap-data.d.ts +0 -3
  621. package/packages/@monomind/cli/dist/src/capabilities/cap-data.js +0 -165
  622. package/packages/@monomind/cli/dist/src/capabilities/cap-documents.d.ts +0 -5
  623. package/packages/@monomind/cli/dist/src/capabilities/cap-documents.js +0 -139
  624. package/packages/@monomind/cli/dist/src/capabilities/cap-graph.d.ts +0 -3
  625. package/packages/@monomind/cli/dist/src/capabilities/cap-graph.js +0 -84
  626. package/packages/@monomind/cli/dist/src/capabilities/cap-media.d.ts +0 -3
  627. package/packages/@monomind/cli/dist/src/capabilities/cap-media.js +0 -147
  628. package/packages/@monomind/cli/dist/src/capabilities/cap-timeline.d.ts +0 -3
  629. package/packages/@monomind/cli/dist/src/capabilities/cap-timeline.js +0 -90
  630. package/packages/@monomind/cli/dist/src/capabilities/index.d.ts +0 -10
  631. package/packages/@monomind/cli/dist/src/capabilities/index.js +0 -18
  632. package/packages/@monomind/cli/dist/src/capabilities/manager.d.ts +0 -13
  633. package/packages/@monomind/cli/dist/src/capabilities/manager.js +0 -79
  634. package/packages/@monomind/cli/dist/src/capabilities/scanner.d.ts +0 -10
  635. package/packages/@monomind/cli/dist/src/capabilities/scanner.js +0 -125
  636. package/packages/@monomind/cli/dist/src/capabilities/types.d.ts +0 -64
  637. package/packages/@monomind/cli/dist/src/capabilities/types.js +0 -2
  638. package/packages/@monomind/cli/dist/src/commands/agent-lifecycle.d.ts +0 -17
  639. package/packages/@monomind/cli/dist/src/commands/agent-lifecycle.js +0 -346
  640. package/packages/@monomind/cli/dist/src/commands/agent-ops.d.ts +0 -8
  641. package/packages/@monomind/cli/dist/src/commands/agent-ops.js +0 -277
  642. package/packages/@monomind/cli/dist/src/commands/agent.d.ts +0 -8
  643. package/packages/@monomind/cli/dist/src/commands/agent.js +0 -40
  644. package/packages/@monomind/cli/dist/src/commands/analyze-ast.d.ts +0 -26
  645. package/packages/@monomind/cli/dist/src/commands/analyze-ast.js +0 -284
  646. package/packages/@monomind/cli/dist/src/commands/analyze-diff.d.ts +0 -8
  647. package/packages/@monomind/cli/dist/src/commands/analyze-diff.js +0 -395
  648. package/packages/@monomind/cli/dist/src/commands/analyze-imports.d.ts +0 -11
  649. package/packages/@monomind/cli/dist/src/commands/analyze-imports.js +0 -287
  650. package/packages/@monomind/cli/dist/src/commands/analyze-symbols.d.ts +0 -14
  651. package/packages/@monomind/cli/dist/src/commands/analyze-symbols.js +0 -302
  652. package/packages/@monomind/cli/dist/src/commands/analyze.d.ts +0 -53
  653. package/packages/@monomind/cli/dist/src/commands/analyze.js +0 -217
  654. package/packages/@monomind/cli/dist/src/commands/autopilot.d.ts +0 -15
  655. package/packages/@monomind/cli/dist/src/commands/autopilot.js +0 -370
  656. package/packages/@monomind/cli/dist/src/commands/browse-action.d.ts +0 -4
  657. package/packages/@monomind/cli/dist/src/commands/browse-action.js +0 -244
  658. package/packages/@monomind/cli/dist/src/commands/browse-platform.d.ts +0 -4
  659. package/packages/@monomind/cli/dist/src/commands/browse-platform.js +0 -117
  660. package/packages/@monomind/cli/dist/src/commands/browse-workflow.d.ts +0 -4
  661. package/packages/@monomind/cli/dist/src/commands/browse-workflow.js +0 -183
  662. package/packages/@monomind/cli/dist/src/commands/browse.d.ts +0 -12
  663. package/packages/@monomind/cli/dist/src/commands/browse.js +0 -17
  664. package/packages/@monomind/cli/dist/src/commands/cleanup.d.ts +0 -45
  665. package/packages/@monomind/cli/dist/src/commands/cleanup.js +0 -581
  666. package/packages/@monomind/cli/dist/src/commands/completions.d.ts +0 -10
  667. package/packages/@monomind/cli/dist/src/commands/completions.js +0 -261
  668. package/packages/@monomind/cli/dist/src/commands/config.d.ts +0 -8
  669. package/packages/@monomind/cli/dist/src/commands/config.js +0 -462
  670. package/packages/@monomind/cli/dist/src/commands/crash-reporting.d.ts +0 -8
  671. package/packages/@monomind/cli/dist/src/commands/crash-reporting.js +0 -50
  672. package/packages/@monomind/cli/dist/src/commands/design-detect.d.ts +0 -27
  673. package/packages/@monomind/cli/dist/src/commands/design-detect.js +0 -220
  674. package/packages/@monomind/cli/dist/src/commands/design-palette.d.ts +0 -21
  675. package/packages/@monomind/cli/dist/src/commands/design-palette.js +0 -538
  676. package/packages/@monomind/cli/dist/src/commands/doc.d.ts +0 -7
  677. package/packages/@monomind/cli/dist/src/commands/doc.js +0 -268
  678. package/packages/@monomind/cli/dist/src/commands/doctor-env-checks.d.ts +0 -26
  679. package/packages/@monomind/cli/dist/src/commands/doctor-env-checks.js +0 -194
  680. package/packages/@monomind/cli/dist/src/commands/doctor-monoes-checks.d.ts +0 -12
  681. package/packages/@monomind/cli/dist/src/commands/doctor-monoes-checks.js +0 -160
  682. package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.d.ts +0 -46
  683. package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.js +0 -764
  684. package/packages/@monomind/cli/dist/src/commands/doctor.d.ts +0 -10
  685. package/packages/@monomind/cli/dist/src/commands/doctor.js +0 -232
  686. package/packages/@monomind/cli/dist/src/commands/guidance.d.ts +0 -12
  687. package/packages/@monomind/cli/dist/src/commands/guidance.js +0 -163
  688. package/packages/@monomind/cli/dist/src/commands/hooks-core-commands.d.ts +0 -10
  689. package/packages/@monomind/cli/dist/src/commands/hooks-core-commands.js +0 -377
  690. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.d.ts +0 -11
  691. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.js +0 -417
  692. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.d.ts +0 -6
  693. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.js +0 -219
  694. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-routing.d.ts +0 -7
  695. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-routing.js +0 -399
  696. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-utils.d.ts +0 -42
  697. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-utils.js +0 -220
  698. package/packages/@monomind/cli/dist/src/commands/hooks-extended-commands.d.ts +0 -11
  699. package/packages/@monomind/cli/dist/src/commands/hooks-extended-commands.js +0 -243
  700. package/packages/@monomind/cli/dist/src/commands/hooks-formatting.d.ts +0 -9
  701. package/packages/@monomind/cli/dist/src/commands/hooks-formatting.js +0 -25
  702. package/packages/@monomind/cli/dist/src/commands/hooks-routing-commands.d.ts +0 -15
  703. package/packages/@monomind/cli/dist/src/commands/hooks-routing-commands.js +0 -725
  704. package/packages/@monomind/cli/dist/src/commands/hooks-workers.d.ts +0 -9
  705. package/packages/@monomind/cli/dist/src/commands/hooks-workers.js +0 -547
  706. package/packages/@monomind/cli/dist/src/commands/hooks.d.ts +0 -16
  707. package/packages/@monomind/cli/dist/src/commands/hooks.js +0 -497
  708. package/packages/@monomind/cli/dist/src/commands/index.d.ts +0 -65
  709. package/packages/@monomind/cli/dist/src/commands/index.js +0 -236
  710. package/packages/@monomind/cli/dist/src/commands/init-subcommands.d.ts +0 -8
  711. package/packages/@monomind/cli/dist/src/commands/init-subcommands.js +0 -156
  712. package/packages/@monomind/cli/dist/src/commands/init-upgrade.d.ts +0 -6
  713. package/packages/@monomind/cli/dist/src/commands/init-upgrade.js +0 -203
  714. package/packages/@monomind/cli/dist/src/commands/init-wizard.d.ts +0 -6
  715. package/packages/@monomind/cli/dist/src/commands/init-wizard.js +0 -244
  716. package/packages/@monomind/cli/dist/src/commands/init.d.ts +0 -8
  717. package/packages/@monomind/cli/dist/src/commands/init.js +0 -411
  718. package/packages/@monomind/cli/dist/src/commands/mcp.d.ts +0 -11
  719. package/packages/@monomind/cli/dist/src/commands/mcp.js +0 -747
  720. package/packages/@monomind/cli/dist/src/commands/memory-admin.d.ts +0 -9
  721. package/packages/@monomind/cli/dist/src/commands/memory-admin.js +0 -345
  722. package/packages/@monomind/cli/dist/src/commands/memory-crud.d.ts +0 -9
  723. package/packages/@monomind/cli/dist/src/commands/memory-crud.js +0 -389
  724. package/packages/@monomind/cli/dist/src/commands/memory-list.d.ts +0 -10
  725. package/packages/@monomind/cli/dist/src/commands/memory-list.js +0 -321
  726. package/packages/@monomind/cli/dist/src/commands/memory-transfer.d.ts +0 -8
  727. package/packages/@monomind/cli/dist/src/commands/memory-transfer.js +0 -199
  728. package/packages/@monomind/cli/dist/src/commands/memory.d.ts +0 -14
  729. package/packages/@monomind/cli/dist/src/commands/memory.js +0 -282
  730. package/packages/@monomind/cli/dist/src/commands/monograph.d.ts +0 -8
  731. package/packages/@monomind/cli/dist/src/commands/monograph.js +0 -548
  732. package/packages/@monomind/cli/dist/src/commands/neural-core.d.ts +0 -10
  733. package/packages/@monomind/cli/dist/src/commands/neural-core.js +0 -413
  734. package/packages/@monomind/cli/dist/src/commands/neural-optimize.d.ts +0 -7
  735. package/packages/@monomind/cli/dist/src/commands/neural-optimize.js +0 -330
  736. package/packages/@monomind/cli/dist/src/commands/neural-registry.d.ts +0 -7
  737. package/packages/@monomind/cli/dist/src/commands/neural-registry.js +0 -290
  738. package/packages/@monomind/cli/dist/src/commands/org-observe.d.ts +0 -18
  739. package/packages/@monomind/cli/dist/src/commands/org-observe.js +0 -353
  740. package/packages/@monomind/cli/dist/src/commands/org.d.ts +0 -25
  741. package/packages/@monomind/cli/dist/src/commands/org.js +0 -860
  742. package/packages/@monomind/cli/dist/src/commands/performance.d.ts +0 -10
  743. package/packages/@monomind/cli/dist/src/commands/performance.js +0 -656
  744. package/packages/@monomind/cli/dist/src/commands/platforms.d.ts +0 -11
  745. package/packages/@monomind/cli/dist/src/commands/platforms.js +0 -600
  746. package/packages/@monomind/cli/dist/src/commands/providers.d.ts +0 -10
  747. package/packages/@monomind/cli/dist/src/commands/providers.js +0 -351
  748. package/packages/@monomind/cli/dist/src/commands/report-crash.d.ts +0 -10
  749. package/packages/@monomind/cli/dist/src/commands/report-crash.js +0 -66
  750. package/packages/@monomind/cli/dist/src/commands/route.d.ts +0 -16
  751. package/packages/@monomind/cli/dist/src/commands/route.js +0 -944
  752. package/packages/@monomind/cli/dist/src/commands/search-universal.d.ts +0 -19
  753. package/packages/@monomind/cli/dist/src/commands/search-universal.js +0 -151
  754. package/packages/@monomind/cli/dist/src/commands/security-cve.d.ts +0 -6
  755. package/packages/@monomind/cli/dist/src/commands/security-cve.js +0 -308
  756. package/packages/@monomind/cli/dist/src/commands/security-misc.d.ts +0 -8
  757. package/packages/@monomind/cli/dist/src/commands/security-misc.js +0 -336
  758. package/packages/@monomind/cli/dist/src/commands/security-scan.d.ts +0 -47
  759. package/packages/@monomind/cli/dist/src/commands/security-scan.js +0 -447
  760. package/packages/@monomind/cli/dist/src/commands/security.d.ts +0 -10
  761. package/packages/@monomind/cli/dist/src/commands/security.js +0 -41
  762. package/packages/@monomind/cli/dist/src/commands/session.d.ts +0 -8
  763. package/packages/@monomind/cli/dist/src/commands/session.js +0 -660
  764. package/packages/@monomind/cli/dist/src/commands/start.d.ts +0 -8
  765. package/packages/@monomind/cli/dist/src/commands/start.js +0 -490
  766. package/packages/@monomind/cli/dist/src/commands/status.d.ts +0 -8
  767. package/packages/@monomind/cli/dist/src/commands/status.js +0 -642
  768. package/packages/@monomind/cli/dist/src/commands/swarm.d.ts +0 -8
  769. package/packages/@monomind/cli/dist/src/commands/swarm.js +0 -906
  770. package/packages/@monomind/cli/dist/src/commands/task.d.ts +0 -8
  771. package/packages/@monomind/cli/dist/src/commands/task.js +0 -639
  772. package/packages/@monomind/cli/dist/src/commands/tokens.d.ts +0 -8
  773. package/packages/@monomind/cli/dist/src/commands/tokens.js +0 -206
  774. package/packages/@monomind/cli/dist/src/commands/update.d.ts +0 -8
  775. package/packages/@monomind/cli/dist/src/commands/update.js +0 -288
  776. package/packages/@monomind/cli/dist/src/consensus/audit-writer.d.ts +0 -77
  777. package/packages/@monomind/cli/dist/src/consensus/audit-writer.js +0 -196
  778. package/packages/@monomind/cli/dist/src/consensus/tally.d.ts +0 -19
  779. package/packages/@monomind/cli/dist/src/consensus/tally.js +0 -34
  780. package/packages/@monomind/cli/dist/src/index.d.ts +0 -81
  781. package/packages/@monomind/cli/dist/src/index.js +0 -574
  782. package/packages/@monomind/cli/dist/src/init/claudemd-generator.d.ts +0 -25
  783. package/packages/@monomind/cli/dist/src/init/claudemd-generator.js +0 -624
  784. package/packages/@monomind/cli/dist/src/init/executor.d.ts +0 -47
  785. package/packages/@monomind/cli/dist/src/init/executor.js +0 -2387
  786. package/packages/@monomind/cli/dist/src/init/helpers-generator.d.ts +0 -73
  787. package/packages/@monomind/cli/dist/src/init/helpers-generator.js +0 -1335
  788. package/packages/@monomind/cli/dist/src/init/index.d.ts +0 -13
  789. package/packages/@monomind/cli/dist/src/init/index.js +0 -15
  790. package/packages/@monomind/cli/dist/src/init/mcp-generator.d.ts +0 -26
  791. package/packages/@monomind/cli/dist/src/init/mcp-generator.js +0 -107
  792. package/packages/@monomind/cli/dist/src/init/settings-generator.d.ts +0 -14
  793. package/packages/@monomind/cli/dist/src/init/settings-generator.js +0 -487
  794. package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.d.ts +0 -38
  795. package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.js +0 -602
  796. package/packages/@monomind/cli/dist/src/init/statusline-generator.d.ts +0 -25
  797. package/packages/@monomind/cli/dist/src/init/statusline-generator.js +0 -1358
  798. package/packages/@monomind/cli/dist/src/init/types.d.ts +0 -308
  799. package/packages/@monomind/cli/dist/src/init/types.js +0 -247
  800. package/packages/@monomind/cli/dist/src/knowledge/document-pipeline.d.ts +0 -75
  801. package/packages/@monomind/cli/dist/src/knowledge/document-pipeline.js +0 -556
  802. package/packages/@monomind/cli/dist/src/mcp-client.d.ts +0 -64
  803. package/packages/@monomind/cli/dist/src/mcp-client.js +0 -338
  804. package/packages/@monomind/cli/dist/src/mcp-server.d.ts +0 -170
  805. package/packages/@monomind/cli/dist/src/mcp-server.js +0 -964
  806. package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.d.ts +0 -30
  807. package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.js +0 -603
  808. package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.d.ts +0 -38
  809. package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.js +0 -389
  810. package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.d.ts +0 -75
  811. package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.js +0 -125
  812. package/packages/@monomind/cli/dist/src/mcp-tools/autopilot-tools.d.ts +0 -12
  813. package/packages/@monomind/cli/dist/src/mcp-tools/autopilot-tools.js +0 -237
  814. package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.d.ts +0 -11
  815. package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.js +0 -1111
  816. package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.d.ts +0 -12
  817. package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.js +0 -827
  818. package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.d.ts +0 -8
  819. package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.js +0 -447
  820. package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.d.ts +0 -11
  821. package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.js +0 -866
  822. package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.d.ts +0 -9
  823. package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.js +0 -582
  824. package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.d.ts +0 -10
  825. package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.js +0 -58
  826. package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.d.ts +0 -15
  827. package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.js +0 -634
  828. package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.d.ts +0 -17
  829. package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +0 -1237
  830. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-embedding.d.ts +0 -161
  831. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-embedding.js +0 -516
  832. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-intelligence.d.ts +0 -22
  833. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-intelligence.js +0 -888
  834. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.d.ts +0 -26
  835. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.js +0 -1582
  836. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.d.ts +0 -9
  837. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +0 -51
  838. package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +0 -31
  839. package/packages/@monomind/cli/dist/src/mcp-tools/index.js +0 -31
  840. package/packages/@monomind/cli/dist/src/mcp-tools/knowledge-tools.d.ts +0 -6
  841. package/packages/@monomind/cli/dist/src/mcp-tools/knowledge-tools.js +0 -156
  842. package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.d.ts +0 -35
  843. package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.js +0 -776
  844. package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.d.ts +0 -26
  845. package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.js +0 -136
  846. package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.d.ts +0 -27
  847. package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +0 -2443
  848. package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.d.ts +0 -15
  849. package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.js +0 -506
  850. package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.d.ts +0 -16
  851. package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.js +0 -680
  852. package/packages/@monomind/cli/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.d.ts +0 -261
  853. package/packages/@monomind/cli/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.js +0 -423
  854. package/packages/@monomind/cli/dist/src/mcp-tools/quality/security-compliance/detect-secrets.d.ts +0 -137
  855. package/packages/@monomind/cli/dist/src/mcp-tools/quality/security-compliance/detect-secrets.js +0 -383
  856. package/packages/@monomind/cli/dist/src/mcp-tools/quality-tools.d.ts +0 -14
  857. package/packages/@monomind/cli/dist/src/mcp-tools/quality-tools.js +0 -58
  858. package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.d.ts +0 -17
  859. package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.js +0 -44
  860. package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.d.ts +0 -18
  861. package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.js +0 -576
  862. package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.d.ts +0 -8
  863. package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.js +0 -431
  864. package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.d.ts +0 -9
  865. package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.js +0 -411
  866. package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.d.ts +0 -13
  867. package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.js +0 -561
  868. package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.d.ts +0 -28
  869. package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.js +0 -514
  870. package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.d.ts +0 -10
  871. package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.js +0 -397
  872. package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.d.ts +0 -27
  873. package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.js +0 -76
  874. package/packages/@monomind/cli/dist/src/mcp-tools/types.d.ts +0 -58
  875. package/packages/@monomind/cli/dist/src/mcp-tools/types.js +0 -98
  876. package/packages/@monomind/cli/dist/src/memory/embedding-operations.d.ts +0 -58
  877. package/packages/@monomind/cli/dist/src/memory/embedding-operations.js +0 -262
  878. package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.d.ts +0 -319
  879. package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.js +0 -698
  880. package/packages/@monomind/cli/dist/src/memory/hnsw-operations.d.ts +0 -142
  881. package/packages/@monomind/cli/dist/src/memory/hnsw-operations.js +0 -465
  882. package/packages/@monomind/cli/dist/src/memory/intelligence.d.ts +0 -368
  883. package/packages/@monomind/cli/dist/src/memory/intelligence.js +0 -1456
  884. package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +0 -333
  885. package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +0 -1104
  886. package/packages/@monomind/cli/dist/src/memory/memory-crud.d.ts +0 -67
  887. package/packages/@monomind/cli/dist/src/memory/memory-crud.js +0 -454
  888. package/packages/@monomind/cli/dist/src/memory/memory-initializer.d.ts +0 -101
  889. package/packages/@monomind/cli/dist/src/memory/memory-initializer.js +0 -431
  890. package/packages/@monomind/cli/dist/src/memory/memory-kg.d.ts +0 -186
  891. package/packages/@monomind/cli/dist/src/memory/memory-kg.js +0 -450
  892. package/packages/@monomind/cli/dist/src/memory/memory-migrations.d.ts +0 -30
  893. package/packages/@monomind/cli/dist/src/memory/memory-migrations.js +0 -136
  894. package/packages/@monomind/cli/dist/src/memory/memory-read.d.ts +0 -87
  895. package/packages/@monomind/cli/dist/src/memory/memory-read.js +0 -333
  896. package/packages/@monomind/cli/dist/src/memory/memory-schema.d.ts +0 -13
  897. package/packages/@monomind/cli/dist/src/memory/memory-schema.js +0 -167
  898. package/packages/@monomind/cli/dist/src/memory/query-router.d.ts +0 -44
  899. package/packages/@monomind/cli/dist/src/memory/query-router.js +0 -113
  900. package/packages/@monomind/cli/dist/src/memory/sona-optimizer.d.ts +0 -237
  901. package/packages/@monomind/cli/dist/src/memory/sona-optimizer.js +0 -647
  902. package/packages/@monomind/cli/dist/src/monovector/command-outcomes.d.ts +0 -37
  903. package/packages/@monomind/cli/dist/src/monovector/command-outcomes.js +0 -126
  904. package/packages/@monomind/cli/dist/src/monovector/coverage-router.d.ts +0 -103
  905. package/packages/@monomind/cli/dist/src/monovector/coverage-router.js +0 -341
  906. package/packages/@monomind/cli/dist/src/monovector/coverage-tools.d.ts +0 -14
  907. package/packages/@monomind/cli/dist/src/monovector/coverage-tools.js +0 -115
  908. package/packages/@monomind/cli/dist/src/monovector/diff-classifier.d.ts +0 -174
  909. package/packages/@monomind/cli/dist/src/monovector/diff-classifier.js +0 -738
  910. package/packages/@monomind/cli/dist/src/monovector/index.d.ts +0 -54
  911. package/packages/@monomind/cli/dist/src/monovector/index.js +0 -55
  912. package/packages/@monomind/cli/dist/src/monovector/init-state.d.ts +0 -35
  913. package/packages/@monomind/cli/dist/src/monovector/init-state.js +0 -36
  914. package/packages/@monomind/cli/dist/src/monovector/route-outcomes.d.ts +0 -56
  915. package/packages/@monomind/cli/dist/src/monovector/route-outcomes.js +0 -189
  916. package/packages/@monomind/cli/dist/src/observability/replay-reader.d.ts +0 -40
  917. package/packages/@monomind/cli/dist/src/observability/replay-reader.js +0 -138
  918. package/packages/@monomind/cli/dist/src/orgrt/broker.d.ts +0 -26
  919. package/packages/@monomind/cli/dist/src/orgrt/broker.js +0 -73
  920. package/packages/@monomind/cli/dist/src/orgrt/bus.d.ts +0 -27
  921. package/packages/@monomind/cli/dist/src/orgrt/bus.js +0 -71
  922. package/packages/@monomind/cli/dist/src/orgrt/daemon.d.ts +0 -175
  923. package/packages/@monomind/cli/dist/src/orgrt/daemon.js +0 -965
  924. package/packages/@monomind/cli/dist/src/orgrt/forwarder.d.ts +0 -16
  925. package/packages/@monomind/cli/dist/src/orgrt/forwarder.js +0 -171
  926. package/packages/@monomind/cli/dist/src/orgrt/inbox.d.ts +0 -11
  927. package/packages/@monomind/cli/dist/src/orgrt/inbox.js +0 -91
  928. package/packages/@monomind/cli/dist/src/orgrt/mailbox.d.ts +0 -49
  929. package/packages/@monomind/cli/dist/src/orgrt/mailbox.js +0 -75
  930. package/packages/@monomind/cli/dist/src/orgrt/migrate.d.ts +0 -26
  931. package/packages/@monomind/cli/dist/src/orgrt/migrate.js +0 -118
  932. package/packages/@monomind/cli/dist/src/orgrt/policy.d.ts +0 -28
  933. package/packages/@monomind/cli/dist/src/orgrt/policy.js +0 -146
  934. package/packages/@monomind/cli/dist/src/orgrt/provider.d.ts +0 -9
  935. package/packages/@monomind/cli/dist/src/orgrt/provider.js +0 -55
  936. package/packages/@monomind/cli/dist/src/orgrt/reporting.d.ts +0 -40
  937. package/packages/@monomind/cli/dist/src/orgrt/reporting.js +0 -134
  938. package/packages/@monomind/cli/dist/src/orgrt/scheduler.d.ts +0 -13
  939. package/packages/@monomind/cli/dist/src/orgrt/scheduler.js +0 -48
  940. package/packages/@monomind/cli/dist/src/orgrt/server.d.ts +0 -9
  941. package/packages/@monomind/cli/dist/src/orgrt/server.js +0 -88
  942. package/packages/@monomind/cli/dist/src/orgrt/session.d.ts +0 -62
  943. package/packages/@monomind/cli/dist/src/orgrt/session.js +0 -157
  944. package/packages/@monomind/cli/dist/src/orgrt/templates.d.ts +0 -17
  945. package/packages/@monomind/cli/dist/src/orgrt/templates.js +0 -62
  946. package/packages/@monomind/cli/dist/src/orgrt/test-loop.d.ts +0 -12
  947. package/packages/@monomind/cli/dist/src/orgrt/test-loop.js +0 -108
  948. package/packages/@monomind/cli/dist/src/orgrt/types.d.ts +0 -910
  949. package/packages/@monomind/cli/dist/src/orgrt/types.js +0 -57
  950. package/packages/@monomind/cli/dist/src/output.d.ts +0 -133
  951. package/packages/@monomind/cli/dist/src/output.js +0 -529
  952. package/packages/@monomind/cli/dist/src/parser.d.ts +0 -93
  953. package/packages/@monomind/cli/dist/src/parser.js +0 -651
  954. package/packages/@monomind/cli/dist/src/pricing/model-pricing.d.ts +0 -41
  955. package/packages/@monomind/cli/dist/src/pricing/model-pricing.js +0 -61
  956. package/packages/@monomind/cli/dist/src/production/circuit-breaker.d.ts +0 -121
  957. package/packages/@monomind/cli/dist/src/production/circuit-breaker.js +0 -262
  958. package/packages/@monomind/cli/dist/src/production/error-handler.d.ts +0 -119
  959. package/packages/@monomind/cli/dist/src/production/error-handler.js +0 -324
  960. package/packages/@monomind/cli/dist/src/production/index.d.ts +0 -6
  961. package/packages/@monomind/cli/dist/src/production/index.js +0 -6
  962. package/packages/@monomind/cli/dist/src/production/monitoring.d.ts +0 -181
  963. package/packages/@monomind/cli/dist/src/production/monitoring.js +0 -375
  964. package/packages/@monomind/cli/dist/src/production/rate-limiter.d.ts +0 -125
  965. package/packages/@monomind/cli/dist/src/production/rate-limiter.js +0 -218
  966. package/packages/@monomind/cli/dist/src/production/retry.d.ts +0 -48
  967. package/packages/@monomind/cli/dist/src/production/retry.js +0 -189
  968. package/packages/@monomind/cli/dist/src/prompt.d.ts +0 -44
  969. package/packages/@monomind/cli/dist/src/prompt.js +0 -501
  970. package/packages/@monomind/cli/dist/src/routing/embed-worker.d.ts +0 -2
  971. package/packages/@monomind/cli/dist/src/routing/embed-worker.js +0 -79
  972. package/packages/@monomind/cli/dist/src/routing/embedder.d.ts +0 -31
  973. package/packages/@monomind/cli/dist/src/routing/embedder.js +0 -0
  974. package/packages/@monomind/cli/dist/src/routing/llm-caller.d.ts +0 -24
  975. package/packages/@monomind/cli/dist/src/routing/llm-caller.js +0 -134
  976. package/packages/@monomind/cli/dist/src/routing/route-layer-factory.d.ts +0 -24
  977. package/packages/@monomind/cli/dist/src/routing/route-layer-factory.js +0 -239
  978. package/packages/@monomind/cli/dist/src/services/config-file-manager.d.ts +0 -80
  979. package/packages/@monomind/cli/dist/src/services/config-file-manager.js +0 -401
  980. package/packages/@monomind/cli/dist/src/services/crash-reporter.d.ts +0 -42
  981. package/packages/@monomind/cli/dist/src/services/crash-reporter.js +0 -374
  982. package/packages/@monomind/cli/dist/src/suggest.d.ts +0 -53
  983. package/packages/@monomind/cli/dist/src/suggest.js +0 -197
  984. package/packages/@monomind/cli/dist/src/sync/checker.d.ts +0 -12
  985. package/packages/@monomind/cli/dist/src/sync/checker.js +0 -26
  986. package/packages/@monomind/cli/dist/src/transfer/anonymization/index.d.ts +0 -22
  987. package/packages/@monomind/cli/dist/src/transfer/anonymization/index.js +0 -192
  988. package/packages/@monomind/cli/dist/src/transfer/types.d.ts +0 -245
  989. package/packages/@monomind/cli/dist/src/transfer/types.js +0 -6
  990. package/packages/@monomind/cli/dist/src/types.d.ts +0 -190
  991. package/packages/@monomind/cli/dist/src/types.js +0 -20
  992. package/packages/@monomind/cli/dist/src/ui/collector.mjs +0 -879
  993. package/packages/@monomind/cli/dist/src/ui/dashboard.html +0 -13949
  994. package/packages/@monomind/cli/dist/src/ui/data/agent-avatars.html +0 -763
  995. package/packages/@monomind/cli/dist/src/ui/data/agent-avatars.json +0 -966
  996. package/packages/@monomind/cli/dist/src/ui/data/avatars/account-strategist.svg +0 -58
  997. package/packages/@monomind/cli/dist/src/ui/data/avatars/accounts-payable.svg +0 -54
  998. package/packages/@monomind/cli/dist/src/ui/data/avatars/adaptive-coordinator.svg +0 -55
  999. package/packages/@monomind/cli/dist/src/ui/data/avatars/adaptive-coordinator2.svg +0 -54
  1000. package/packages/@monomind/cli/dist/src/ui/data/avatars/ai-citation.svg +0 -57
  1001. package/packages/@monomind/cli/dist/src/ui/data/avatars/ai-engineer.svg +0 -61
  1002. package/packages/@monomind/cli/dist/src/ui/data/avatars/analytics-reporter.svg +0 -53
  1003. package/packages/@monomind/cli/dist/src/ui/data/avatars/api-tester.svg +0 -53
  1004. package/packages/@monomind/cli/dist/src/ui/data/avatars/architecture.svg +0 -54
  1005. package/packages/@monomind/cli/dist/src/ui/data/avatars/automation-governance.svg +0 -55
  1006. package/packages/@monomind/cli/dist/src/ui/data/avatars/backend-dev.svg +0 -53
  1007. package/packages/@monomind/cli/dist/src/ui/data/avatars/benchmarker.svg +0 -54
  1008. package/packages/@monomind/cli/dist/src/ui/data/avatars/blockchain-auditor.svg +0 -53
  1009. package/packages/@monomind/cli/dist/src/ui/data/avatars/byzantine-coord.svg +0 -57
  1010. package/packages/@monomind/cli/dist/src/ui/data/avatars/case-analyst.svg +0 -57
  1011. package/packages/@monomind/cli/dist/src/ui/data/avatars/cicd-engineer.svg +0 -55
  1012. package/packages/@monomind/cli/dist/src/ui/data/avatars/cloud-architect.svg +0 -54
  1013. package/packages/@monomind/cli/dist/src/ui/data/avatars/code-review-swarm.svg +0 -57
  1014. package/packages/@monomind/cli/dist/src/ui/data/avatars/coder-v119.svg +0 -57
  1015. package/packages/@monomind/cli/dist/src/ui/data/avatars/coder.svg +0 -58
  1016. package/packages/@monomind/cli/dist/src/ui/data/avatars/collective-coord.svg +0 -54
  1017. package/packages/@monomind/cli/dist/src/ui/data/avatars/compliance-auditor.svg +0 -58
  1018. package/packages/@monomind/cli/dist/src/ui/data/avatars/consensus-coordinator.svg +0 -54
  1019. package/packages/@monomind/cli/dist/src/ui/data/avatars/content-creator.svg +0 -54
  1020. package/packages/@monomind/cli/dist/src/ui/data/avatars/crdt-synchronizer.svg +0 -53
  1021. package/packages/@monomind/cli/dist/src/ui/data/avatars/cro-specialist.svg +0 -58
  1022. package/packages/@monomind/cli/dist/src/ui/data/avatars/data-consolidator.svg +0 -54
  1023. package/packages/@monomind/cli/dist/src/ui/data/avatars/data-engineer.svg +0 -53
  1024. package/packages/@monomind/cli/dist/src/ui/data/avatars/database-optimizer.svg +0 -61
  1025. package/packages/@monomind/cli/dist/src/ui/data/avatars/deal-strategist.svg +0 -54
  1026. package/packages/@monomind/cli/dist/src/ui/data/avatars/defender.svg +0 -53
  1027. package/packages/@monomind/cli/dist/src/ui/data/avatars/devops-automator.svg +0 -56
  1028. package/packages/@monomind/cli/dist/src/ui/data/avatars/discovery-coach.svg +0 -54
  1029. package/packages/@monomind/cli/dist/src/ui/data/avatars/email-marketing.svg +0 -57
  1030. package/packages/@monomind/cli/dist/src/ui/data/avatars/embedded-firmware.svg +0 -61
  1031. package/packages/@monomind/cli/dist/src/ui/data/avatars/evidence-collector.svg +0 -57
  1032. package/packages/@monomind/cli/dist/src/ui/data/avatars/experiment-tracker.svg +0 -53
  1033. package/packages/@monomind/cli/dist/src/ui/data/avatars/feedback-synthesizer.svg +0 -54
  1034. package/packages/@monomind/cli/dist/src/ui/data/avatars/finance-tracker.svg +0 -54
  1035. package/packages/@monomind/cli/dist/src/ui/data/avatars/frontend-developer.svg +0 -54
  1036. package/packages/@monomind/cli/dist/src/ui/data/avatars/game-audio-engineer.svg +0 -59
  1037. package/packages/@monomind/cli/dist/src/ui/data/avatars/game-designer.svg +0 -54
  1038. package/packages/@monomind/cli/dist/src/ui/data/avatars/gossip-coordinator.svg +0 -54
  1039. package/packages/@monomind/cli/dist/src/ui/data/avatars/hierarchical-coord.svg +0 -54
  1040. package/packages/@monomind/cli/dist/src/ui/data/avatars/incident-commander.svg +0 -57
  1041. package/packages/@monomind/cli/dist/src/ui/data/avatars/infrastructure.svg +0 -54
  1042. package/packages/@monomind/cli/dist/src/ui/data/avatars/input-validator.svg +0 -53
  1043. package/packages/@monomind/cli/dist/src/ui/data/avatars/ios-developer.svg +0 -54
  1044. package/packages/@monomind/cli/dist/src/ui/data/avatars/issue-tracker.svg +0 -53
  1045. package/packages/@monomind/cli/dist/src/ui/data/avatars/judge.svg +0 -55
  1046. package/packages/@monomind/cli/dist/src/ui/data/avatars/launch-strategist.svg +0 -54
  1047. package/packages/@monomind/cli/dist/src/ui/data/avatars/legal-compliance.svg +0 -53
  1048. package/packages/@monomind/cli/dist/src/ui/data/avatars/level-designer.svg +0 -53
  1049. package/packages/@monomind/cli/dist/src/ui/data/avatars/load-balancer.svg +0 -57
  1050. package/packages/@monomind/cli/dist/src/ui/data/avatars/mcp-builder.svg +0 -53
  1051. package/packages/@monomind/cli/dist/src/ui/data/avatars/memory-coordinator.svg +0 -55
  1052. package/packages/@monomind/cli/dist/src/ui/data/avatars/mesh-coordinator.svg +0 -55
  1053. package/packages/@monomind/cli/dist/src/ui/data/avatars/ml-developer.svg +0 -58
  1054. package/packages/@monomind/cli/dist/src/ui/data/avatars/mobile-app-builder.svg +0 -53
  1055. package/packages/@monomind/cli/dist/src/ui/data/avatars/mobile-dev.svg +0 -54
  1056. package/packages/@monomind/cli/dist/src/ui/data/avatars/model-qa.svg +0 -58
  1057. package/packages/@monomind/cli/dist/src/ui/data/avatars/narrative-designer.svg +0 -58
  1058. package/packages/@monomind/cli/dist/src/ui/data/avatars/outbound-strategist.svg +0 -55
  1059. package/packages/@monomind/cli/dist/src/ui/data/avatars/path-validator.svg +0 -54
  1060. package/packages/@monomind/cli/dist/src/ui/data/avatars/payment-agent.svg +0 -53
  1061. package/packages/@monomind/cli/dist/src/ui/data/avatars/perf-analyzer.svg +0 -58
  1062. package/packages/@monomind/cli/dist/src/ui/data/avatars/pipeline-analyst.svg +0 -54
  1063. package/packages/@monomind/cli/dist/src/ui/data/avatars/planner.svg +0 -55
  1064. package/packages/@monomind/cli/dist/src/ui/data/avatars/pr-manager.svg +0 -54
  1065. package/packages/@monomind/cli/dist/src/ui/data/avatars/pricing-strategist.svg +0 -54
  1066. package/packages/@monomind/cli/dist/src/ui/data/avatars/product-manager.svg +0 -54
  1067. package/packages/@monomind/cli/dist/src/ui/data/avatars/production-validator.svg +0 -54
  1068. package/packages/@monomind/cli/dist/src/ui/data/avatars/project-shepherd.svg +0 -54
  1069. package/packages/@monomind/cli/dist/src/ui/data/avatars/proposal-strategist.svg +0 -54
  1070. package/packages/@monomind/cli/dist/src/ui/data/avatars/prosecutor.svg +0 -57
  1071. package/packages/@monomind/cli/dist/src/ui/data/avatars/pseudocode.svg +0 -53
  1072. package/packages/@monomind/cli/dist/src/ui/data/avatars/queen-coordinator.svg +0 -55
  1073. package/packages/@monomind/cli/dist/src/ui/data/avatars/quorum-manager.svg +0 -53
  1074. package/packages/@monomind/cli/dist/src/ui/data/avatars/raft-manager.svg +0 -53
  1075. package/packages/@monomind/cli/dist/src/ui/data/avatars/reality-checker.svg +0 -58
  1076. package/packages/@monomind/cli/dist/src/ui/data/avatars/recruitment.svg +0 -58
  1077. package/packages/@monomind/cli/dist/src/ui/data/avatars/refinement.svg +0 -53
  1078. package/packages/@monomind/cli/dist/src/ui/data/avatars/release-manager.svg +0 -54
  1079. package/packages/@monomind/cli/dist/src/ui/data/avatars/repo-architect.svg +0 -54
  1080. package/packages/@monomind/cli/dist/src/ui/data/avatars/researcher.svg +0 -58
  1081. package/packages/@monomind/cli/dist/src/ui/data/avatars/resource-allocator.svg +0 -53
  1082. package/packages/@monomind/cli/dist/src/ui/data/avatars/reviewer.svg +0 -53
  1083. package/packages/@monomind/cli/dist/src/ui/data/avatars/safe-executor.svg +0 -53
  1084. package/packages/@monomind/cli/dist/src/ui/data/avatars/sales-coach.svg +0 -53
  1085. package/packages/@monomind/cli/dist/src/ui/data/avatars/sales-engineer.svg +0 -58
  1086. package/packages/@monomind/cli/dist/src/ui/data/avatars/scout-explorer.svg +0 -58
  1087. package/packages/@monomind/cli/dist/src/ui/data/avatars/security-architect.svg +0 -54
  1088. package/packages/@monomind/cli/dist/src/ui/data/avatars/security-auditor.svg +0 -55
  1089. package/packages/@monomind/cli/dist/src/ui/data/avatars/senior-developer.svg +0 -58
  1090. package/packages/@monomind/cli/dist/src/ui/data/avatars/senior-pm.svg +0 -58
  1091. package/packages/@monomind/cli/dist/src/ui/data/avatars/seo-specialist.svg +0 -57
  1092. package/packages/@monomind/cli/dist/src/ui/data/avatars/social-media.svg +0 -54
  1093. package/packages/@monomind/cli/dist/src/ui/data/avatars/solidity-engineer.svg +0 -58
  1094. package/packages/@monomind/cli/dist/src/ui/data/avatars/sparc-coder.svg +0 -58
  1095. package/packages/@monomind/cli/dist/src/ui/data/avatars/sparc-coord.svg +0 -56
  1096. package/packages/@monomind/cli/dist/src/ui/data/avatars/specification.svg +0 -57
  1097. package/packages/@monomind/cli/dist/src/ui/data/avatars/sprint-prioritizer.svg +0 -53
  1098. package/packages/@monomind/cli/dist/src/ui/data/avatars/sre.svg +0 -54
  1099. package/packages/@monomind/cli/dist/src/ui/data/avatars/studio-operations.svg +0 -53
  1100. package/packages/@monomind/cli/dist/src/ui/data/avatars/studio-producer.svg +0 -55
  1101. package/packages/@monomind/cli/dist/src/ui/data/avatars/support-responder.svg +0 -56
  1102. package/packages/@monomind/cli/dist/src/ui/data/avatars/system-architect.svg +0 -54
  1103. package/packages/@monomind/cli/dist/src/ui/data/avatars/task-orchestrator.svg +0 -56
  1104. package/packages/@monomind/cli/dist/src/ui/data/avatars/technical-artist.svg +0 -53
  1105. package/packages/@monomind/cli/dist/src/ui/data/avatars/technical-writer.svg +0 -59
  1106. package/packages/@monomind/cli/dist/src/ui/data/avatars/tester.svg +0 -53
  1107. package/packages/@monomind/cli/dist/src/ui/data/avatars/threat-detection.svg +0 -61
  1108. package/packages/@monomind/cli/dist/src/ui/data/avatars/trend-researcher.svg +0 -54
  1109. package/packages/@monomind/cli/dist/src/ui/data/avatars/trial-director.svg +0 -55
  1110. package/packages/@monomind/cli/dist/src/ui/data/avatars/unity-architect.svg +0 -54
  1111. package/packages/@monomind/cli/dist/src/ui/data/avatars/visionos-engineer.svg +0 -57
  1112. package/packages/@monomind/cli/dist/src/ui/data/avatars/worker-specialist.svg +0 -55
  1113. package/packages/@monomind/cli/dist/src/ui/data/avatars/workflow-architect.svg +0 -57
  1114. package/packages/@monomind/cli/dist/src/ui/data/avatars/workflow-automation.svg +0 -54
  1115. package/packages/@monomind/cli/dist/src/ui/data/avatars/zk-steward.svg +0 -54
  1116. package/packages/@monomind/cli/dist/src/ui/data/known-projects.json +0 -1
  1117. package/packages/@monomind/cli/dist/src/ui/data/mastermind-sessions.json +0 -1
  1118. package/packages/@monomind/cli/dist/src/ui/data/sessions/_index.json +0 -1
  1119. package/packages/@monomind/cli/dist/src/ui/mastermind-diagram-fallback.html +0 -1069
  1120. package/packages/@monomind/cli/dist/src/ui/orgs-files.js +0 -192
  1121. package/packages/@monomind/cli/dist/src/ui/orgs.html +0 -2513
  1122. package/packages/@monomind/cli/dist/src/ui/server.mjs +0 -7256
  1123. package/packages/@monomind/cli/dist/src/ui/sse-manager.mjs +0 -119
  1124. package/packages/@monomind/cli/dist/src/update/checker.d.ts +0 -34
  1125. package/packages/@monomind/cli/dist/src/update/checker.js +0 -278
  1126. package/packages/@monomind/cli/dist/src/update/executor.d.ts +0 -32
  1127. package/packages/@monomind/cli/dist/src/update/executor.js +0 -235
  1128. package/packages/@monomind/cli/dist/src/update/index.d.ts +0 -43
  1129. package/packages/@monomind/cli/dist/src/update/index.js +0 -108
  1130. package/packages/@monomind/cli/dist/src/update/rate-limiter.d.ts +0 -37
  1131. package/packages/@monomind/cli/dist/src/update/rate-limiter.js +0 -190
  1132. package/packages/@monomind/cli/dist/src/update/validator.d.ts +0 -17
  1133. package/packages/@monomind/cli/dist/src/update/validator.js +0 -166
  1134. package/packages/@monomind/cli/dist/src/utils/cosine-similarity.d.ts +0 -22
  1135. package/packages/@monomind/cli/dist/src/utils/cosine-similarity.js +0 -38
  1136. package/packages/@monomind/cli/dist/src/utils/input-guards.d.ts +0 -66
  1137. package/packages/@monomind/cli/dist/src/utils/input-guards.js +0 -263
  1138. package/packages/@monomind/cli/dist/src/utils/json-file.d.ts +0 -33
  1139. package/packages/@monomind/cli/dist/src/utils/json-file.js +0 -57
  1140. package/packages/@monomind/cli/dist/src/utils/parse-jsonl.d.ts +0 -6
  1141. package/packages/@monomind/cli/dist/src/utils/parse-jsonl.js +0 -22
  1142. package/packages/@monomind/cli/dist/src/utils/resource-governor.d.ts +0 -32
  1143. package/packages/@monomind/cli/dist/src/utils/resource-governor.js +0 -115
  1144. package/packages/@monomind/cli/package.json +0 -127
  1145. package/packages/@monomind/cli/scripts/deploy-ipfs-node.sh +0 -153
  1146. package/packages/@monomind/cli/scripts/publish.sh +0 -61
  1147. package/packages/@monomind/cli/scripts/sync-claude-assets.sh +0 -19
  1148. package/packages/@monomind/cli/scripts/understand-analyze.mjs +0 -1078
  1149. package/scripts/build-fs.mjs +0 -75
  1150. package/scripts/build-monovector.sh +0 -10
  1151. package/scripts/generate-agent-avatars.mjs +0 -492
  1152. package/scripts/generate-channel-profile-assets.sh +0 -67
  1153. package/scripts/growth-content-calendar.mjs +0 -260
  1154. package/scripts/growth-profile-kit.mjs +0 -156
  1155. package/scripts/install.sh +0 -392
  1156. package/scripts/publish-monovector.sh +0 -20
  1157. package/scripts/ua-enrich.mjs +0 -229
  1158. package/scripts/ua-import.mjs +0 -288
  1159. package/scripts/verify-appliance.sh +0 -571
@@ -1,3002 +0,0 @@
1
- import {
2
- BORDER_SAFE_TAGS,
3
- GENERIC_FONTS,
4
- KNOWN_SERIF_FONTS,
5
- OVERUSED_FONTS,
6
- SAFE_TAGS,
7
- WCAG_LARGE_BOLD_TEXT_PX,
8
- WCAG_LARGE_TEXT_PX,
9
- isBrandFontOnOwnDomain,
10
- } from '../shared/constants.mjs';
11
- import {
12
- colorToHex,
13
- contrastRatio,
14
- getHue,
15
- hasChroma,
16
- isNeutralColor,
17
- parseGradientColors,
18
- parseRgb,
19
- relativeLuminance,
20
- } from '../shared/color.mjs';
21
- import { extractGoogleFontFamilies } from '../shared/fonts.mjs';
22
-
23
- const DETECTOR_IS_BROWSER = typeof window !== 'undefined';
24
-
25
- // ─── Section 3: Pure Detection ──────────────────────────────────────────────
26
-
27
- function checkBorders(tag, widths, colors, radius) {
28
- if (BORDER_SAFE_TAGS.has(tag)) return [];
29
- const findings = [];
30
- const sides = ['Top', 'Right', 'Bottom', 'Left'];
31
-
32
- for (const side of sides) {
33
- const w = widths[side];
34
- if (w < 1 || isNeutralColor(colors[side])) continue;
35
-
36
- const otherSides = sides.filter(s => s !== side);
37
- const maxOther = Math.max(...otherSides.map(s => widths[s]));
38
- if (!(w >= 2 && (maxOther <= 1 || w >= maxOther * 2))) continue;
39
-
40
- const sn = side.toLowerCase();
41
- const isSide = side === 'Left' || side === 'Right';
42
-
43
- if (isSide) {
44
- if (radius > 0) findings.push({ id: 'side-tab', snippet: `border-${sn}: ${w}px + border-radius: ${radius}px` });
45
- else if (w >= 3) findings.push({ id: 'side-tab', snippet: `border-${sn}: ${w}px` });
46
- } else {
47
- if (radius > 0 && w >= 2) findings.push({ id: 'border-accent-on-rounded', snippet: `border-${sn}: ${w}px + border-radius: ${radius}px` });
48
- }
49
- }
50
-
51
- return findings;
52
- }
53
-
54
- // Returns true if the given text is composed entirely of emoji characters
55
- // (plus whitespace / variation selectors). Emojis render as multicolor glyphs
56
- // regardless of CSS `color`, so contrast checks against the element's text
57
- // color are meaningless for these nodes.
58
- const EMOJI_CHAR_RE = /[\u{1F1E6}-\u{1F1FF}\u{1F300}-\u{1F9FF}\u{1FA00}-\u{1FAFF}\u{2600}-\u{27BF}\u{2300}-\u{23FF}\u{FE0F}\u{200D}\u{1F3FB}-\u{1F3FF}]/u;
59
- const EMOJI_CHARS_GLOBAL = /[\u{1F1E6}-\u{1F1FF}\u{1F300}-\u{1F9FF}\u{1FA00}-\u{1FAFF}\u{2600}-\u{27BF}\u{2300}-\u{23FF}\u{FE0F}\u{200D}\u{1F3FB}-\u{1F3FF}]/gu;
60
- function isEmojiOnlyText(text) {
61
- if (!text) return false;
62
- if (!EMOJI_CHAR_RE.test(text)) return false;
63
- return text.replace(EMOJI_CHARS_GLOBAL, '').trim() === '';
64
- }
65
-
66
- function checkColors(opts) {
67
- const { tag, textColor, bgColor, effectiveBg, effectiveBgStops, fontSize, fontWeight, hasDirectText, isEmojiOnly, bgClip, bgImage, classList } = opts;
68
- if (SAFE_TAGS.has(tag)) {
69
- // Exception for <a> and <button> elements styled as buttons. SAFE_TAGS
70
- // exists to suppress contrast noise on inline links and unstyled controls,
71
- // where the element has no own background and the contrast against the
72
- // ancestor surface is already the intended visual. When the element has
73
- // its own opaque background and direct text, it is a styled button — and
74
- // contrast on its own surface is a real, frequent bug worth flagging.
75
- const isStyledButton = (tag === 'a' || tag === 'button')
76
- && hasDirectText
77
- && bgColor && bgColor.a > 0.5;
78
- if (!isStyledButton) return [];
79
- }
80
- const findings = [];
81
-
82
- if (hasDirectText && textColor && !isEmojiOnly) {
83
- // Run background-dependent checks against either a solid bg or, if the
84
- // ancestor is a gradient, against every gradient stop (use the worst case).
85
- const bgs = effectiveBg ? [effectiveBg] : (effectiveBgStops && effectiveBgStops.length ? effectiveBgStops : null);
86
- if (bgs) {
87
- // Gray on colored background — flag if every stop is chromatic
88
- const textLum = relativeLuminance(textColor);
89
- const isGray = !hasChroma(textColor, 20) && textLum > 0.05 && textLum < 0.85;
90
- if (isGray && bgs.every(b => hasChroma(b, 40))) {
91
- const bgLabel = effectiveBg ? colorToHex(effectiveBg) : `gradient(${bgs.map(colorToHex).join(', ')})`;
92
- findings.push({ id: 'gray-on-color', snippet: `text ${colorToHex(textColor)} on bg ${bgLabel}` });
93
- }
94
-
95
- // Low contrast (WCAG AA) — worst case across all bg stops
96
- const ratios = bgs.map(b => contrastRatio(textColor, b));
97
- let worstIdx = 0;
98
- for (let i = 1; i < ratios.length; i++) if (ratios[i] < ratios[worstIdx]) worstIdx = i;
99
- const ratio = ratios[worstIdx];
100
- const isLargeText = fontSize >= WCAG_LARGE_TEXT_PX || (fontSize >= WCAG_LARGE_BOLD_TEXT_PX && fontWeight >= 700);
101
- const threshold = isLargeText ? 3.0 : 4.5;
102
- if (ratio < threshold) {
103
- // Skip the false-positive class where text has alpha < 1 AND we
104
- // couldn't find an opaque ancestor (effectiveBg is null, we're
105
- // comparing against gradient-stop fallback). In jsdom mode the
106
- // detector can't resolve `var(--X)` color tokens, so a dark
107
- // section sitting between the text and the body's decorative
108
- // gradient is invisible to us — we end up measuring contrast
109
- // against the body's paper-grain noise instead of the real
110
- // local bg. Real low-contrast bugs use alpha=1 and have a
111
- // resolvable opaque ancestor; semi-transparent Tailwind tokens
112
- // like `text-paper/60` on `bg-ink` sections are the FP pattern.
113
- const isAlphaFallbackFP = !DETECTOR_IS_BROWSER && !effectiveBg && (textColor.a != null && textColor.a < 1);
114
- if (!isAlphaFallbackFP) {
115
- findings.push({ id: 'low-contrast', snippet: `${ratio.toFixed(1)}:1 (need ${threshold}:1) — text ${colorToHex(textColor)} on ${colorToHex(bgs[worstIdx])}` });
116
- }
117
- }
118
- }
119
-
120
- // AI palette: purple/violet on headings
121
- if (hasChroma(textColor, 50)) {
122
- const hue = getHue(textColor);
123
- if (hue >= 260 && hue <= 310 && (['h1', 'h2', 'h3'].includes(tag) || fontSize >= 20)) {
124
- findings.push({ id: 'ai-color-palette', snippet: `Purple/violet text (${colorToHex(textColor)}) on heading` });
125
- }
126
- }
127
- }
128
-
129
- // Gradient text
130
- if (bgClip === 'text' && bgImage && bgImage.includes('gradient')) {
131
- findings.push({ id: 'gradient-text', snippet: 'background-clip: text + gradient' });
132
- }
133
-
134
- // Tailwind class checks
135
- if (classList) {
136
- const classStr = typeof classList === 'string' ? classList : Array.from(classList).join(' ');
137
-
138
- const grayMatch = classStr.match(/\btext-(?:gray|slate|zinc|neutral|stone)-\d+\b/);
139
- const colorBgMatch = classStr.match(/\bbg-(?:red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-\d+\b/);
140
- if (grayMatch && colorBgMatch) {
141
- findings.push({ id: 'gray-on-color', snippet: `${grayMatch[0]} on ${colorBgMatch[0]}` });
142
- }
143
-
144
- if (/\bbg-clip-text\b/.test(classStr) && /\bbg-gradient-to-/.test(classStr)) {
145
- findings.push({ id: 'gradient-text', snippet: 'bg-clip-text + bg-gradient (Tailwind)' });
146
- }
147
-
148
- const purpleText = classStr.match(/\btext-(?:purple|violet|indigo)-\d+\b/);
149
- if (purpleText && (['h1', 'h2', 'h3'].includes(tag) || /\btext-(?:[2-9]xl)\b/.test(classStr))) {
150
- findings.push({ id: 'ai-color-palette', snippet: `${purpleText[0]} on heading` });
151
- }
152
-
153
- if (/\bfrom-(?:purple|violet|indigo)-\d+\b/.test(classStr) && /\bto-(?:purple|violet|indigo|blue|cyan|pink|fuchsia)-\d+\b/.test(classStr)) {
154
- findings.push({ id: 'ai-color-palette', snippet: 'Purple/violet gradient (Tailwind)' });
155
- }
156
- }
157
-
158
- return findings;
159
- }
160
-
161
- function isCardLikeFromProps(hasShadow, hasBorder, hasRadius, hasBg) {
162
- if (!hasShadow && !hasBorder) return false;
163
- return hasRadius || hasBg;
164
- }
165
-
166
- const HEADING_TAGS = new Set(['h1', 'h2', 'h3', 'h4', 'h5', 'h6']);
167
-
168
- // Pure check: given a heading and metrics about its previousElementSibling,
169
- // decide if the sibling is the canonical "icon-tile-stacked-above-heading" shape.
170
- //
171
- // Triggers when ALL of the following hold for the sibling:
172
- // • size 32–128px on both axes (not too small, not a hero image)
173
- // • aspect ratio 0.7–1.4 (squarish — excludes wide thumbnails / pill badges)
174
- // • has a non-transparent background-color, background-image, OR a visible border
175
- // (covers solid colors, white-with-border, gradients — anything that visually
176
- // defines a tile)
177
- // • border-radius < width/2 (excludes round avatars; rounded squares pass)
178
- // • contains an <svg> or icon-class <i> element that's smaller than the tile
179
- // • the tile sits above the heading (its bottom is above the heading's top)
180
- function checkIconTile(opts) {
181
- const { headingTag, headingText, headingTop,
182
- siblingTag, siblingWidth, siblingHeight, siblingBottom,
183
- siblingBgColor, siblingBgImage, siblingBorderWidth, siblingBorderRadius,
184
- hasIconChild, iconChildWidth } = opts;
185
- if (!HEADING_TAGS.has(headingTag)) return [];
186
- if (!siblingTag) return [];
187
- // Don't recurse into nested headings (e.g. h2 above h3 in a section header)
188
- if (HEADING_TAGS.has(siblingTag)) return [];
189
-
190
- // Size window: 32–128px on each axis
191
- if (!(siblingWidth >= 32 && siblingWidth <= 128)) return [];
192
- if (!(siblingHeight >= 32 && siblingHeight <= 128)) return [];
193
-
194
- // Squarish aspect ratio
195
- const ratio = siblingWidth / siblingHeight;
196
- if (ratio < 0.7 || ratio > 1.4) return [];
197
-
198
- // Must have something that visually defines the tile
199
- const bgVisible = (siblingBgColor && siblingBgColor.a > 0.1)
200
- || (siblingBgImage && siblingBgImage !== 'none' && siblingBgImage !== '');
201
- const borderVisible = siblingBorderWidth > 0;
202
- if (!bgVisible && !borderVisible) return [];
203
-
204
- // Exclude circles (avatars). Rounded squares pass.
205
- if (siblingBorderRadius >= siblingWidth / 2) return [];
206
-
207
- // Must contain an icon element smaller than the tile
208
- if (!hasIconChild) return [];
209
- if (iconChildWidth && iconChildWidth >= siblingWidth * 0.95) return [];
210
-
211
- // Vertical stacking: tile must end above where the heading starts.
212
- // (Allow the check to skip when both top/bottom are 0 — jsdom layout case.)
213
- if (headingTop && siblingBottom && siblingBottom > headingTop + 4) return [];
214
-
215
- const text = (headingText || '').trim().slice(0, 60);
216
- return [{
217
- id: 'icon-tile-stack',
218
- snippet: `${Math.round(siblingWidth)}x${Math.round(siblingHeight)}px icon tile above ${headingTag} "${text}"`,
219
- }];
220
- }
221
-
222
- // Resolve the primary (non-generic) face from a font-family string and return
223
- // whether the resolved primary is serif. Two paths:
224
- // 1. Primary face is in KNOWN_SERIF_FONTS → serif.
225
- // 2. Primary face is unknown but the stack ends in the generic `serif`
226
- // token → treat as serif. Authors who declare `font-family: 'X', serif`
227
- // almost always have a serif primary; a sans declared with a serif
228
- // fallback is a code smell, not the common case.
229
- // Returns { primary, isSerif } so the snippet can name the face.
230
- function resolveSerif(fontFamily) {
231
- if (!fontFamily) return { primary: null, isSerif: false };
232
- const tokens = fontFamily.split(',').map(f => f.trim().replace(/^['"]|['"]$/g, '').toLowerCase());
233
- const primary = tokens.find(f => f && !GENERIC_FONTS.has(f)) || null;
234
- if (!primary) return { primary: null, isSerif: false };
235
- if (KNOWN_SERIF_FONTS.has(primary)) return { primary, isSerif: true };
236
- if (tokens.includes('serif')) return { primary, isSerif: true };
237
- return { primary, isSerif: false };
238
- }
239
-
240
- function checkItalicSerif(opts) {
241
- const { tag, fontStyle, fontFamily, fontSize, headingText } = opts;
242
- if (fontStyle !== 'italic') return [];
243
- // Anchor the rule on hero-scale text. h1 is the canonical hero element;
244
- // h2 ≥ 48px catches the cases where the design demotes the visual hero
245
- // to an h2 but keeps the size.
246
- if (tag !== 'h1' && !(tag === 'h2' && fontSize >= 48)) return [];
247
- if (fontSize < 48) return [];
248
- const { primary, isSerif } = resolveSerif(fontFamily);
249
- if (!isSerif) return [];
250
-
251
- const text = (headingText || '').trim().slice(0, 60);
252
- return [{
253
- id: 'italic-serif-display',
254
- snippet: `italic serif ${tag} (${primary || 'serif'}) at ${Math.round(fontSize)}px "${text}"`,
255
- }];
256
- }
257
-
258
- // Color saturation check. Returns true when the color has visible
259
- // chroma — i.e., it's an "accent color" rather than near-neutral.
260
- // Handles rgb()/rgba(), #hex, oklch(), and hsl(). var() refs are
261
- // expected to be pre-resolved by the caller.
262
- function isAccentColor(cssColor) {
263
- if (!cssColor) return false;
264
- const s = String(cssColor).trim();
265
- // rgb / rgba — direct channel-distance check.
266
- const rgbM = /rgba?\(\s*(\d+)\s*,?\s+|\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(s.replace(/rgba?\(\s*/, 'rgb(').replace(/,/g, ', '));
267
- const rgbStrict = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(s);
268
- if (rgbStrict) {
269
- const r = +rgbStrict[1], g = +rgbStrict[2], b = +rgbStrict[3];
270
- return (Math.max(r, g, b) - Math.min(r, g, b)) >= 40;
271
- }
272
- // #hex — 3, 4, 6, or 8 digit.
273
- const hexM = /^#([0-9a-f]{3,8})\b/i.exec(s);
274
- if (hexM) {
275
- let h = hexM[1];
276
- if (h.length === 3 || h.length === 4) h = h.split('').map((c) => c + c).join('').slice(0, 6);
277
- else h = h.slice(0, 6);
278
- if (h.length === 6) {
279
- const r = parseInt(h.slice(0, 2), 16);
280
- const g = parseInt(h.slice(2, 4), 16);
281
- const b = parseInt(h.slice(4, 6), 16);
282
- return (Math.max(r, g, b) - Math.min(r, g, b)) >= 40;
283
- }
284
- }
285
- // oklch(L C H) — chroma C is what matters. Typical neutral grays
286
- // have C < 0.02; visible accents are 0.05+. CSS minification can
287
- // collapse spaces between L% and C ("oklch(43%.15 34)"), so we
288
- // extract all numbers and take the second rather than matching a
289
- // strict L-then-whitespace-then-C pattern.
290
- if (/^oklch\(/i.test(s)) {
291
- const nums = s.match(/\d*\.\d+|\d+/g);
292
- if (nums && nums.length >= 2) {
293
- const c = parseFloat(nums[1]);
294
- return !Number.isNaN(c) && c >= 0.05;
295
- }
296
- }
297
- // hsl(H, S%, L%) — saturation > 20% reads as accent.
298
- const hslM = /hsla?\(\s*[\d.]+\s*,\s*([\d.]+)%/i.exec(s);
299
- if (hslM) {
300
- const sat = parseFloat(hslM[1]);
301
- return !Number.isNaN(sat) && sat >= 20;
302
- }
303
- return false;
304
- }
305
-
306
- // Sibling-relationship rule. Anchor on a hero-scale h1, look at the
307
- // previousElementSibling, and gate on EITHER the classic tracked-
308
- // uppercase eyebrow OR the modern accent-colored bold eyebrow.
309
- function checkHeroEyebrow(opts) {
310
- const {
311
- headingTag, headingText, headingFontSize,
312
- siblingTag, siblingText, siblingTextTransform,
313
- siblingFontSize, siblingLetterSpacing,
314
- siblingFontWeight, siblingColor,
315
- } = opts;
316
- if (headingTag !== 'h1') return [];
317
- // We previously gated on headingFontSize >= 48 to anchor "hero scale".
318
- // But modern hero h1s use clamp() / vw / var(--text-*), none of which
319
- // jsdom can resolve — the computed value comes back as "2em" or
320
- // "var(--text-9xl)" and parseFloat returns 2 or NaN. The gate fails
321
- // on virtually every Tailwind v4 / framework build. The other gates
322
- // (sibling text 2-60 chars, font-size ≤ 14px, accent-bold OR
323
- // tracked-caps) are tight enough to avoid false positives on non-
324
- // hero h1s — a tiny tan label directly above any h1 is the
325
- // antipattern regardless of how big the h1 ends up.
326
- if (!siblingTag) return [];
327
- // An h2 above an h1 is a different anti-pattern (heading hierarchy / dual
328
- // headings) — never an eyebrow.
329
- if (HEADING_TAGS.has(siblingTag)) return [];
330
-
331
- const text = (siblingText || '').trim();
332
- if (text.length < 2 || text.length > 60) return [];
333
- if (!(siblingFontSize > 0 && siblingFontSize <= 14)) return [];
334
-
335
- // Branch A: classic tracked-uppercase eyebrow.
336
- const isUppercased = siblingTextTransform === 'uppercase'
337
- || (/[A-Z]/.test(text) && !/[a-z]/.test(text));
338
- const isClassicTracked = isUppercased && siblingLetterSpacing >= 1.6;
339
-
340
- // Branch B: modern accent-bold eyebrow — sentence case, low
341
- // tracking, but bold + accent-colored. The style choices changed;
342
- // the pattern is the same kicker-above-headline anti-pattern.
343
- const weight = Number(siblingFontWeight) || 400;
344
- const isAccentBold = weight >= 700 && isAccentColor(siblingColor || '');
345
-
346
- if (!isClassicTracked && !isAccentBold) return [];
347
-
348
- const headingTextSnippet = (headingText || '').trim().slice(0, 60);
349
- const eyebrowSnippet = text.slice(0, 40);
350
- const style = isClassicTracked ? 'tracked-caps' : 'accent-bold';
351
- return [{
352
- id: 'hero-eyebrow-chip',
353
- snippet: `eyebrow chip (${style}) "${eyebrowSnippet}" above ${headingTag} "${headingTextSnippet}"`,
354
- }];
355
- }
356
-
357
- function checkRepeatedSectionKickers(opts) {
358
- const { candidates, minCount = 3 } = opts;
359
- if (!Array.isArray(candidates) || candidates.length < minCount) return [];
360
- return candidates.map(candidate => ({
361
- id: 'repeated-section-kickers',
362
- snippet: `repeated section kicker "${candidate.kickerText}" before ${candidate.headingTag} "${candidate.headingText}" (${candidates.length} on page)`,
363
- }));
364
- }
365
-
366
- const LAYOUT_TRANSITION_PROPS = new Set([
367
- 'width', 'height', 'padding', 'margin',
368
- 'max-height', 'max-width', 'min-height', 'min-width',
369
- 'padding-top', 'padding-right', 'padding-bottom', 'padding-left',
370
- 'margin-top', 'margin-right', 'margin-bottom', 'margin-left',
371
- ]);
372
-
373
- function checkMotion(opts) {
374
- const { tag, transitionProperty, animationName, timingFunctions, classList } = opts;
375
- if (SAFE_TAGS.has(tag)) return [];
376
- const findings = [];
377
-
378
- // --- Bounce/elastic easing ---
379
- if (animationName && animationName !== 'none' && /bounce|elastic|wobble|jiggle|spring/i.test(animationName)) {
380
- findings.push({ id: 'bounce-easing', snippet: `animation: ${animationName}` });
381
- }
382
- if (classList && /\banimate-bounce\b/.test(classList)) {
383
- findings.push({ id: 'bounce-easing', snippet: 'animate-bounce (Tailwind)' });
384
- }
385
-
386
- // Check timing functions for overshoot cubic-bezier (y values outside [0, 1])
387
- if (timingFunctions) {
388
- const bezierRe = /cubic-bezier\(\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*\)/g;
389
- let m;
390
- while ((m = bezierRe.exec(timingFunctions)) !== null) {
391
- const y1 = parseFloat(m[2]), y2 = parseFloat(m[4]);
392
- if (y1 < -0.1 || y1 > 1.1 || y2 < -0.1 || y2 > 1.1) {
393
- findings.push({ id: 'bounce-easing', snippet: `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` });
394
- break;
395
- }
396
- }
397
- }
398
-
399
- // --- Layout property transition ---
400
- if (transitionProperty && transitionProperty !== 'all' && transitionProperty !== 'none') {
401
- const props = transitionProperty.split(',').map(p => p.trim().toLowerCase());
402
- const layoutFound = props.filter(p => LAYOUT_TRANSITION_PROPS.has(p));
403
- if (layoutFound.length > 0) {
404
- findings.push({ id: 'layout-transition', snippet: `transition: ${layoutFound.join(', ')}` });
405
- }
406
- }
407
-
408
- return findings;
409
- }
410
-
411
- function checkGlow(opts) {
412
- const { boxShadow, effectiveBg } = opts;
413
- if (!boxShadow || boxShadow === 'none') return [];
414
- if (!effectiveBg) return [];
415
-
416
- // Only flag on dark backgrounds (luminance < 0.1)
417
- const bgLum = relativeLuminance(effectiveBg);
418
- if (bgLum >= 0.1) return [];
419
-
420
- // Split multiple shadows (commas not inside parentheses)
421
- const parts = boxShadow.split(/,(?![^(]*\))/);
422
- for (const shadow of parts) {
423
- const colorMatch = shadow.match(/rgba?\([^)]+\)/);
424
- if (!colorMatch) continue;
425
- const color = parseRgb(colorMatch[0]);
426
- if (!color || !hasChroma(color, 30)) continue;
427
-
428
- // Extract px values — in computed style: "color Xpx Ypx BLURpx [SPREADpx]"
429
- const afterColor = shadow.substring(shadow.indexOf(colorMatch[0]) + colorMatch[0].length);
430
- const beforeColor = shadow.substring(0, shadow.indexOf(colorMatch[0]));
431
- const pxVals = [...beforeColor.matchAll(/([\d.]+)px/g), ...afterColor.matchAll(/([\d.]+)px/g)]
432
- .map(m => parseFloat(m[1]));
433
-
434
- // Third value is blur (offset-x, offset-y, blur, [spread])
435
- if (pxVals.length >= 3 && pxVals[2] > 4) {
436
- return [{ id: 'dark-glow', snippet: `Colored glow (${colorToHex(color)}) on dark background` }];
437
- }
438
- }
439
-
440
- return [];
441
- }
442
-
443
- /**
444
- * Regex-on-HTML checks shared between browser and Node page-level detection.
445
- * These don't need DOM access, just the raw HTML string.
446
- */
447
- function checkHtmlPatterns(html) {
448
- const findings = [];
449
-
450
- // --- Color ---
451
-
452
- // AI color palette: purple/violet
453
- const purpleHexRe = /#(?:7c3aed|8b5cf6|a855f7|9333ea|7e22ce|6d28d9|6366f1|764ba2|667eea)\b/gi;
454
- if (purpleHexRe.test(html)) {
455
- const purpleTextRe = /(?:(?:^|;)\s*color\s*:\s*(?:.*?)(?:#(?:7c3aed|8b5cf6|a855f7|9333ea|7e22ce|6d28d9))|gradient.*?#(?:7c3aed|8b5cf6|a855f7|764ba2|667eea))/gi;
456
- if (purpleTextRe.test(html)) {
457
- findings.push({ id: 'ai-color-palette', snippet: 'Purple/violet accent colors detected' });
458
- }
459
- }
460
-
461
- // Gradient text (background-clip: text + gradient)
462
- const gradientRe = /(?:-webkit-)?background-clip\s*:\s*text/gi;
463
- let gm;
464
- while ((gm = gradientRe.exec(html)) !== null) {
465
- const start = Math.max(0, gm.index - 200);
466
- const context = html.substring(start, gm.index + gm[0].length + 200);
467
- if (/gradient/i.test(context)) {
468
- findings.push({ id: 'gradient-text', snippet: 'background-clip: text + gradient' });
469
- break;
470
- }
471
- }
472
- if (/\bbg-clip-text\b/.test(html) && /\bbg-gradient-to-/.test(html)) {
473
- findings.push({ id: 'gradient-text', snippet: 'bg-clip-text + bg-gradient (Tailwind)' });
474
- }
475
-
476
- // --- Layout ---
477
-
478
- // Monotonous spacing
479
- const spacingValues = [];
480
- const spacingRe = /(?:padding|margin)(?:-(?:top|right|bottom|left))?\s*:\s*(\d+)px/gi;
481
- let sm;
482
- while ((sm = spacingRe.exec(html)) !== null) {
483
- const v = parseInt(sm[1], 10);
484
- if (v > 0 && v < 200) spacingValues.push(v);
485
- }
486
- const gapRe = /gap\s*:\s*(\d+)px/gi;
487
- while ((sm = gapRe.exec(html)) !== null) {
488
- spacingValues.push(parseInt(sm[1], 10));
489
- }
490
- const twSpaceRe = /\b(?:p|px|py|pt|pb|pl|pr|m|mx|my|mt|mb|ml|mr|gap)-(\d+)\b/g;
491
- while ((sm = twSpaceRe.exec(html)) !== null) {
492
- spacingValues.push(parseInt(sm[1], 10) * 4);
493
- }
494
- const remSpacingRe = /(?:padding|margin)(?:-(?:top|right|bottom|left))?\s*:\s*([\d.]+)rem/gi;
495
- while ((sm = remSpacingRe.exec(html)) !== null) {
496
- const v = Math.round(parseFloat(sm[1]) * 16);
497
- if (v > 0 && v < 200) spacingValues.push(v);
498
- }
499
- const roundedSpacing = spacingValues.map(v => Math.round(v / 4) * 4);
500
- if (roundedSpacing.length >= 10) {
501
- const counts = {};
502
- for (const v of roundedSpacing) counts[v] = (counts[v] || 0) + 1;
503
- const maxCount = Math.max(...Object.values(counts));
504
- const dominantPct = maxCount / roundedSpacing.length;
505
- const unique = [...new Set(roundedSpacing)].filter(v => v > 0);
506
- if (dominantPct > 0.6 && unique.length <= 3) {
507
- const dominant = Object.entries(counts).sort((a, b) => b[1] - a[1])[0][0];
508
- findings.push({
509
- id: 'monotonous-spacing',
510
- snippet: `~${dominant}px used ${maxCount}/${roundedSpacing.length} times (${Math.round(dominantPct * 100)}%)`,
511
- });
512
- }
513
- }
514
-
515
- // --- Motion ---
516
-
517
- // Bounce/elastic animation names
518
- const bounceRe = /animation(?:-name)?\s*:\s*([^;{}]*(?:bounce|elastic|wobble|jiggle|spring)[^;{}]*)/gi;
519
- const bounceMatch = bounceRe.exec(html);
520
- if (bounceMatch) {
521
- const animationToken = bounceMatch[1]
522
- .split(/[,\s]+/)
523
- .find((part) => /bounce|elastic|wobble|jiggle|spring/i.test(part));
524
- findings.push({ id: 'bounce-easing', snippet: `animation: ${animationToken || bounceMatch[1].trim()}` });
525
- }
526
-
527
- // Overshoot cubic-bezier
528
- const bezierRe = /cubic-bezier\(\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*\)/g;
529
- let bm;
530
- while ((bm = bezierRe.exec(html)) !== null) {
531
- const y1 = parseFloat(bm[2]), y2 = parseFloat(bm[4]);
532
- if (y1 < -0.1 || y1 > 1.1 || y2 < -0.1 || y2 > 1.1) {
533
- findings.push({ id: 'bounce-easing', snippet: `cubic-bezier(${bm[1]}, ${bm[2]}, ${bm[3]}, ${bm[4]})` });
534
- break;
535
- }
536
- }
537
-
538
- // Layout property transitions
539
- const transRe = /transition(?:-property)?\s*:\s*([^;{}]+)/gi;
540
- let tm;
541
- while ((tm = transRe.exec(html)) !== null) {
542
- const val = tm[1].toLowerCase();
543
- if (/\ball\b/.test(val)) continue;
544
- const found = val.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
545
- if (found) {
546
- findings.push({ id: 'layout-transition', snippet: `transition: ${found.join(', ')}` });
547
- break;
548
- }
549
- }
550
-
551
- // --- Dark glow ---
552
-
553
- const darkBgRe = /background(?:-color)?\s*:\s*(?:#(?:0[0-9a-f]|1[0-9a-f]|2[0-3])[0-9a-f]{4}\b|#(?:0|1)[0-9a-f]{2}\b|rgb\(\s*(\d{1,2})\s*,\s*(\d{1,2})\s*,\s*(\d{1,2})\s*\))/gi;
554
- const twDarkBg = /\bbg-(?:gray|slate|zinc|neutral|stone)-(?:9\d{2}|800)\b/;
555
- if (darkBgRe.test(html) || twDarkBg.test(html)) {
556
- const shadowRe = /box-shadow\s*:\s*([^;{}]+)/gi;
557
- let shm;
558
- while ((shm = shadowRe.exec(html)) !== null) {
559
- const val = shm[1];
560
- const colorMatch = val.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
561
- if (!colorMatch) continue;
562
- const [r, g, b] = [+colorMatch[1], +colorMatch[2], +colorMatch[3]];
563
- if ((Math.max(r, g, b) - Math.min(r, g, b)) < 30) continue;
564
- const pxVals = [...val.matchAll(/(\d+)px|(?<![.\d])\b(0)\b(?![.\d])/g)].map(p => +(p[1] || p[2]));
565
- if (pxVals.length >= 3 && pxVals[2] > 4) {
566
- findings.push({ id: 'dark-glow', snippet: `Colored glow (rgb(${r},${g},${b})) on dark page` });
567
- break;
568
- }
569
- }
570
- }
571
-
572
- // --- Provider tells (gated): repeating-gradient stripes (GPT) ---
573
- if (/repeating-(?:linear|radial|conic)-gradient\s*\(/i.test(html)) {
574
- findings.push({ id: 'repeating-stripes-gradient', snippet: 'repeating-gradient decorative stripes' });
575
- }
576
-
577
- // --- Provider tells (gated): two-axis grid-line background (Codex/GPT) ---
578
- // The Codex grid tell is two hairline `linear-gradient(... <color> 1px,
579
- // transparent 1px)` layers (one per axis) tiled by a repeating
580
- // `background-size` cell. Both signals must co-occur in the SAME style block
581
- // (a CSS rule body or one inline `style="..."`): two hairline stops WITHOUT a
582
- // tiling background-size is a fixed crosshair, not a grid, and a single
583
- // hairline is a legitimate ruled line. Scoping to one block also stops
584
- // unrelated single-axis rules on separate elements from adding up across the
585
- // page. Count hairlines only inside `background`/`background-image` values so
586
- // a hairline in an unrelated property (mask-image, border-image) can't stand
587
- // in for the second axis. Colors like `oklch(96% 0.012 82 / 0.055)` carry
588
- // nested parens, so match the hairline stop directly rather than parsing
589
- // whole gradient layers.
590
- {
591
- const hairlineRe = /\b\d{1,3}px\s*,\s*transparent\s+\d{1,3}px/gi;
592
- const gridSizeRe = /background-size\s*:[^;{}"']*\b\d{1,3}px\b/i;
593
- const bgDeclRe = /\bbackground(?:-image)?\s*:\s*([^;{}"']*)/gi;
594
- const blockRe = /\{([^{}]*)\}|style\s*=\s*"([^"]*)"|style\s*=\s*'([^']*)'/gi;
595
- let blk;
596
- while ((blk = blockRe.exec(html)) !== null) {
597
- const block = blk[1] || blk[2] || blk[3] || '';
598
- if (!gridSizeRe.test(block)) continue;
599
- let hairlineCount = 0;
600
- let bm;
601
- bgDeclRe.lastIndex = 0;
602
- while ((bm = bgDeclRe.exec(block)) !== null) {
603
- const stops = bm[1].match(hairlineRe);
604
- if (stops) hairlineCount += stops.length;
605
- }
606
- if (hairlineCount >= 2) {
607
- findings.push({ id: 'codex-grid-background', snippet: 'two-axis grid-line gradient background' });
608
- break;
609
- }
610
- }
611
- }
612
-
613
- // --- Provider tells (gated): "X theater" framing copy (GPT) ---
614
- // Lives here (regex-on-HTML) rather than in the text-content analyzers so it
615
- // runs in the bundled browser path too, not just the CLI/static path.
616
- {
617
- const bodyText = html
618
- .replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, ' ')
619
- .replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, ' ')
620
- .replace(/<[^>]+>/g, ' ');
621
- const tm = /\b(\w+)\s+theater\b/i.exec(bodyText);
622
- if (tm) findings.push({ id: 'theater-slop-phrase', snippet: `"${tm[0].trim()}"` });
623
- }
624
-
625
- // --- Provider tells (gated): image hover transform (Gemini) ---
626
- // A CSS `img...:hover { transform: ... }` rule, or a Tailwind hover:scale /
627
- // hover:rotate / hover:translate utility on an <img>. Each distinct
628
- // mechanism is its own finding.
629
- const imgHoverCss = /\bimg\b[^,{}]*:hover\b[^{}]*\{[^}]*\btransform\s*:\s*(?:scale|rotate|translate|matrix|skew)/i;
630
- if (imgHoverCss.test(html)) {
631
- findings.push({ id: 'image-hover-transform', snippet: 'img:hover { transform } rule' });
632
- }
633
- const imgTagRe = /<img\b[^>]*\bclass\s*=\s*"([^"]*)"/gi;
634
- let im;
635
- while ((im = imgTagRe.exec(html)) !== null) {
636
- if (/\bhover:(?:scale|rotate|translate|skew)-/.test(im[1])) {
637
- findings.push({ id: 'image-hover-transform', snippet: 'Tailwind hover transform on <img>' });
638
- }
639
- }
640
-
641
- return findings;
642
- }
643
-
644
- // ─── Section 4: resolveBackground (unified) ─────────────────────────────────
645
-
646
- // Read the element's own background color, computed-style first, with a
647
- // jsdom-friendly fallback that parses the inline `background:` shorthand
648
- // from the raw style attribute. jsdom (~v29) does not decompose the
649
- // shorthand into `backgroundColor`, so without this fallback the CLI silently
650
- // returns null for any element styled via `background: rgb(...)` or
651
- // `background: #abc`. Real browsers always decompose, so the fallback is
652
- // a no-op there.
653
- function readOwnBackgroundColor(el, computedStyle) {
654
- const bg = parseRgb(computedStyle.backgroundColor);
655
- if (DETECTOR_IS_BROWSER || (bg && bg.a >= 0.1)) return bg;
656
- const rawStyle = el.getAttribute?.('style') || '';
657
- const bgMatch = rawStyle.match(/background(?:-color)?\s*:\s*([^;]+)/i);
658
- const inlineBg = bgMatch ? bgMatch[1].trim() : '';
659
- if (!inlineBg) return bg;
660
- if (/gradient/i.test(inlineBg) || /url\s*\(/i.test(inlineBg)) return bg;
661
- const fromRgb = parseRgb(inlineBg);
662
- if (fromRgb) return fromRgb;
663
- const hexMatch = inlineBg.match(/#([0-9a-f]{6}|[0-9a-f]{3})\b/i);
664
- if (hexMatch) {
665
- const h = hexMatch[1];
666
- if (h.length === 6) {
667
- return { r: parseInt(h.slice(0, 2), 16), g: parseInt(h.slice(2, 4), 16), b: parseInt(h.slice(4, 6), 16), a: 1 };
668
- }
669
- return { r: parseInt(h[0] + h[0], 16), g: parseInt(h[1] + h[1], 16), b: parseInt(h[2] + h[2], 16), a: 1 };
670
- }
671
- return bg;
672
- }
673
-
674
- function resolveBackground(el, win, customPropMap) {
675
- let current = el;
676
- while (current && current.nodeType === 1) {
677
- const style = DETECTOR_IS_BROWSER ? getComputedStyle(current) : win.getComputedStyle(current);
678
- const bgImage = style.backgroundImage || '';
679
- const hasGradientOrUrl = bgImage && bgImage !== 'none' && (/gradient/i.test(bgImage) || /url\s*\(/i.test(bgImage));
680
-
681
- // Try the solid bg-color FIRST. If the element has both a solid color
682
- // and a gradient/url overlay (a common pattern: `background: var(--paper)
683
- // radial-gradient(...)` for paper-grain texture), the solid color is the
684
- // dominant visible surface for contrast purposes; the overlay is
685
- // decorative. The old behavior bailed on any gradient ancestor, which
686
- // caused massive false-positive contrast findings on grain-textured
687
- // body backgrounds.
688
- let bg = parseRgb(style.backgroundColor);
689
- if (!DETECTOR_IS_BROWSER && (!bg || bg.a < 0.1)) {
690
- // jsdom returns literal "var(--X)" / "oklch(...)" strings. Resolve
691
- // through customPropMap so Tailwind v4 color tokens become RGB.
692
- if (customPropMap) {
693
- bg = parseColorResolved(style.backgroundColor, customPropMap);
694
- }
695
- if (!bg || bg.a < 0.1) {
696
- // Inline-style fallback. jsdom doesn't decompose background
697
- // shorthand, so colors set via inline style are otherwise invisible.
698
- const rawStyle = current.getAttribute?.('style') || '';
699
- const bgMatch = rawStyle.match(/background(?:-color)?\s*:\s*([^;]+)/i);
700
- const inlineBg = bgMatch ? bgMatch[1].trim() : '';
701
- if (inlineBg && !/gradient/i.test(inlineBg) && !/url\s*\(/i.test(inlineBg)) {
702
- bg = parseColorResolved(inlineBg, customPropMap) || parseAnyColor(inlineBg);
703
- }
704
- }
705
- }
706
-
707
- if (bg && bg.a > 0.1) {
708
- if (DETECTOR_IS_BROWSER || bg.a >= 0.5) return bg;
709
- }
710
- // No solid bg-color at this level. If THIS level has a gradient/url
711
- // with no underlying solid color we can read:
712
- // • on body/html: assume white. Body-level gradients are almost
713
- // always decorative texture (paper grain, noise) on top of a
714
- // solid bg-color the page set via `background: var(--paper)`
715
- // shorthand — which jsdom can't decompose into bg-color. The
716
- // downstream gradient-stops fallback path produces catastrophic
717
- // false positives in this case (gradient noise stops have
718
- // accidental browns/blacks that look like card backgrounds).
719
- // • on other elements: bail to null and let the caller fall back
720
- // to gradient stops (gradient buttons / hero sections are real
721
- // bgs worth checking against).
722
- if (hasGradientOrUrl) {
723
- if (current.tagName === 'BODY' || current.tagName === 'HTML') {
724
- return { r: 255, g: 255, b: 255, a: 1 };
725
- }
726
- return null;
727
- }
728
- current = current.parentElement;
729
- }
730
- return { r: 255, g: 255, b: 255 };
731
- }
732
-
733
- // Walk parents looking for a gradient background and return its color stops.
734
- // Used as a fallback when resolveBackground() returns null because the
735
- // effective background is a gradient (no single solid color to compare against).
736
- function resolveGradientStops(el, win) {
737
- let current = el;
738
- while (current && current.nodeType === 1) {
739
- const style = DETECTOR_IS_BROWSER ? getComputedStyle(current) : win.getComputedStyle(current);
740
- const bgImage = style.backgroundImage || '';
741
- if (bgImage && bgImage !== 'none' && /gradient/i.test(bgImage)) {
742
- const stops = parseGradientColors(bgImage);
743
- if (stops.length > 0) return stops;
744
- }
745
- if (!DETECTOR_IS_BROWSER) {
746
- // jsdom doesn't decompose `background:` shorthand — peek at the raw inline style
747
- const rawStyle = current.getAttribute?.('style') || '';
748
- const bgMatch = rawStyle.match(/background(?:-image)?\s*:\s*([^;]+)/i);
749
- if (bgMatch && /gradient/i.test(bgMatch[1])) {
750
- const stops = parseGradientColors(bgMatch[1]);
751
- if (stops.length > 0) return stops;
752
- }
753
- }
754
- current = current.parentElement;
755
- }
756
- return null;
757
- }
758
-
759
- // Parse a single CSS length token to pixels. Accepts "12px", "50%", a
760
- // shorthand like "12px 4px" (uses the first value), or empty / null.
761
- // Returns the pixel value, or null when the input is unparseable.
762
- // Percentages convert against `widthPx` when one is supplied. Without a
763
- // usable width (jsdom returns "auto" for many real-world elements,
764
- // which parseFloat collapses to 0), fall back to the raw percentage
765
- // number so callers gating on `> 0` (border-accent-on-rounded,
766
- // isCardLike's hasRadius) still see a positive value, matching the
767
- // original parseFloat("50%") === 50 behavior.
768
- function parseRadiusToPx(value, widthPx) {
769
- if (!value || typeof value !== 'string') return null;
770
- const trimmed = value.trim();
771
- if (!trimmed) return null;
772
- const first = trimmed.split(/\s+/)[0];
773
- const num = parseFloat(first);
774
- if (Number.isNaN(num)) return null;
775
- if (/%$/.test(first)) {
776
- if (widthPx && widthPx > 0) return (num / 100) * widthPx;
777
- return num;
778
- }
779
- return num;
780
- }
781
-
782
- function resolveBorderRadiusPx(el, style, widthPx, win) {
783
- const fromComputed = parseRadiusToPx(style.borderRadius, widthPx);
784
- if (fromComputed !== null) return fromComputed;
785
- return 0;
786
- }
787
-
788
- // ─── Section 5: Element Adapters ────────────────────────────────────────────
789
-
790
- // Browser adapters — call getComputedStyle/getBoundingClientRect on live DOM
791
-
792
- function checkElementBordersDOM(el) {
793
- const tag = el.tagName.toLowerCase();
794
- if (BORDER_SAFE_TAGS.has(tag)) return [];
795
- const rect = el.getBoundingClientRect();
796
- if (rect.width < 20 || rect.height < 20) return [];
797
- const style = getComputedStyle(el);
798
- const sides = ['Top', 'Right', 'Bottom', 'Left'];
799
- const widths = {}, colors = {};
800
- for (const s of sides) {
801
- widths[s] = parseFloat(style[`border${s}Width`]) || 0;
802
- colors[s] = style[`border${s}Color`] || '';
803
- }
804
- return checkBorders(tag, widths, colors, parseFloat(style.borderRadius) || 0);
805
- }
806
-
807
- function checkElementColorsDOM(el) {
808
- const tag = el.tagName.toLowerCase();
809
- // No early SAFE_TAGS bail here — checkColors() does its own gating that
810
- // includes the styled-button exception for <a> / <button> with their own
811
- // opaque background. Bailing here would prevent that exception from firing.
812
- const rect = el.getBoundingClientRect();
813
- if (rect.width < 10 || rect.height < 10) return [];
814
- const style = getComputedStyle(el);
815
- const directText = [...el.childNodes].filter(n => n.nodeType === 3).map(n => n.textContent).join('');
816
- const hasDirectText = directText.trim().length > 0;
817
- const effectiveBg = resolveBackground(el);
818
- return checkColors({
819
- tag,
820
- textColor: parseRgb(style.color),
821
- bgColor: readOwnBackgroundColor(el, style),
822
- effectiveBg,
823
- effectiveBgStops: effectiveBg ? null : resolveGradientStops(el),
824
- fontSize: parseFloat(style.fontSize) || 16,
825
- fontWeight: parseInt(style.fontWeight) || 400,
826
- hasDirectText,
827
- isEmojiOnly: isEmojiOnlyText(directText),
828
- bgClip: style.webkitBackgroundClip || style.backgroundClip || '',
829
- bgImage: style.backgroundImage || '',
830
- classList: el.getAttribute('class') || '',
831
- });
832
- }
833
-
834
- function checkElementIconTileDOM(el) {
835
- const tag = el.tagName.toLowerCase();
836
- if (!HEADING_TAGS.has(tag)) return [];
837
- const sibling = el.previousElementSibling;
838
- if (!sibling) return [];
839
-
840
- const sibRect = sibling.getBoundingClientRect();
841
- const headRect = el.getBoundingClientRect();
842
- const sibStyle = getComputedStyle(sibling);
843
-
844
- // The tile may either contain an <svg>/<i> icon child, OR the tile itself
845
- // may contain an emoji/symbol character directly as its only text content
846
- // (the "card-icon" pattern from many AI-generated demos).
847
- const iconChild = sibling.querySelector('svg, i[data-lucide], i[class*="fa-"], i[class*="icon"]');
848
- const iconRect = iconChild?.getBoundingClientRect();
849
- const sibDirectText = [...sibling.childNodes].filter(n => n.nodeType === 3).map(n => n.textContent).join('');
850
- const hasInlineEmojiIcon = sibling.children.length === 0 && isEmojiOnlyText(sibDirectText);
851
-
852
- return checkIconTile({
853
- headingTag: tag,
854
- headingText: el.textContent || '',
855
- headingTop: headRect.top,
856
- siblingTag: sibling.tagName.toLowerCase(),
857
- siblingWidth: sibRect.width,
858
- siblingHeight: sibRect.height,
859
- siblingBottom: sibRect.bottom,
860
- siblingBgColor: parseRgb(sibStyle.backgroundColor),
861
- siblingBgImage: sibStyle.backgroundImage || '',
862
- siblingBorderWidth: parseFloat(sibStyle.borderTopWidth) || 0,
863
- siblingBorderRadius: parseFloat(sibStyle.borderRadius) || 0,
864
- hasIconChild: !!iconChild || hasInlineEmojiIcon,
865
- iconChildWidth: iconRect?.width || 0,
866
- });
867
- }
868
-
869
- function checkElementItalicSerifDOM(el) {
870
- const tag = el.tagName.toLowerCase();
871
- if (tag !== 'h1' && tag !== 'h2') return [];
872
- const style = getComputedStyle(el);
873
- return checkItalicSerif({
874
- tag,
875
- fontStyle: style.fontStyle || '',
876
- fontFamily: style.fontFamily || '',
877
- fontSize: parseFloat(style.fontSize) || 0,
878
- headingText: el.textContent || '',
879
- });
880
- }
881
-
882
- function checkElementHeroEyebrowDOM(el) {
883
- const tag = el.tagName.toLowerCase();
884
- if (tag !== 'h1') return [];
885
- const sibling = el.previousElementSibling;
886
- if (!sibling) return [];
887
- const headStyle = getComputedStyle(el);
888
- const sibStyle = getComputedStyle(sibling);
889
- return checkHeroEyebrow({
890
- headingTag: tag,
891
- headingText: el.textContent || '',
892
- headingFontSize: parseFloat(headStyle.fontSize) || 0,
893
- siblingTag: sibling.tagName.toLowerCase(),
894
- siblingText: sibling.textContent || '',
895
- siblingTextTransform: sibStyle.textTransform || '',
896
- siblingFontSize: parseFloat(sibStyle.fontSize) || 0,
897
- siblingLetterSpacing: parseFloat(sibStyle.letterSpacing) || 0,
898
- siblingFontWeight: sibStyle.fontWeight || '',
899
- siblingColor: sibStyle.color || '',
900
- });
901
- }
902
-
903
- // Build a map of CSS custom properties declared on :root / :host / html.
904
- // Used to resolve var(--X) refs that jsdom returns verbatim in
905
- // getComputedStyle. Tailwind v4 routes every utility class through
906
- // CSS vars (font-weight: var(--font-weight-bold), font-size:
907
- // var(--text-xs), letter-spacing: var(--tracking-widest)), so without
908
- // resolution every style-based check silently fails on Tailwind v4
909
- // builds — the values come back as literal "var(--font-weight-bold)"
910
- // strings and parseFloat returns NaN.
911
- function buildCustomPropMap(document) {
912
- const map = new Map();
913
- let sheets;
914
- try { sheets = Array.from(document.styleSheets || []); }
915
- catch { return map; }
916
- for (const sheet of sheets) {
917
- let rules;
918
- try { rules = Array.from(sheet.cssRules || []); }
919
- catch { continue; }
920
- for (const rule of rules) {
921
- // Style rules only (type 1). Walk @media / @supports if present.
922
- if (rule.type === 4 /* MEDIA_RULE */ || rule.type === 12 /* SUPPORTS_RULE */) {
923
- try { rules.push(...Array.from(rule.cssRules || [])); } catch { /* ignore */ }
924
- continue;
925
- }
926
- if (rule.type !== 1 /* STYLE_RULE */) continue;
927
- const sel = rule.selectorText || '';
928
- if (!/(^|,\s*)(:root|html|:host)\b/i.test(sel)) continue;
929
- const style = rule.style;
930
- if (!style) continue;
931
- for (let i = 0; i < style.length; i++) {
932
- const prop = style[i];
933
- if (!prop || !prop.startsWith('--')) continue;
934
- const val = style.getPropertyValue(prop).trim();
935
- if (val) map.set(prop, val);
936
- }
937
- }
938
- }
939
- return map;
940
- }
941
-
942
- // Resolve var(--X[, fallback]) refs in a computed-style value string.
943
- // Recurses up to 8 levels for chained refs (--a: var(--b)). Returns
944
- // the original string when no refs are present or the chain doesn't
945
- // resolve. Safe to call on already-resolved values.
946
- function resolveVarRefs(raw, customPropMap, depth = 0) {
947
- if (typeof raw !== 'string' || !raw.includes('var(')) return raw;
948
- if (depth > 8) return raw;
949
- return raw.replace(/var\(\s*(--[a-zA-Z0-9_-]+)\s*(?:,\s*([^)]+))?\)/g, (_m, name, fallback) => {
950
- const v = customPropMap.get(name);
951
- if (v != null) return resolveVarRefs(v, customPropMap, depth + 1);
952
- return fallback ? resolveVarRefs(fallback.trim(), customPropMap, depth + 1) : _m;
953
- });
954
- }
955
-
956
- // OKLCH → sRGB conversion (Björn Ottosson's matrices). L in 0..1 (or %),
957
- // C in 0..~0.4 typical, H in degrees. Returns clamped {r,g,b,a:1} in 0..255.
958
- // Needed because jsdom doesn't compute oklch() values — getComputedStyle
959
- // returns the literal "oklch(...)" string. Without this, the entire
960
- // Tailwind v4 color palette (which is OKLCH-based) is invisible to the
961
- // detector's contrast / color checks.
962
- function oklchToRgb(L, C, H) {
963
- const hRad = (H * Math.PI) / 180;
964
- const a = C * Math.cos(hRad);
965
- const b = C * Math.sin(hRad);
966
- const l_ = L + 0.3963377774 * a + 0.2158037573 * b;
967
- const m_ = L - 0.1055613458 * a - 0.0638541728 * b;
968
- const s_ = L - 0.0894841775 * a - 1.2914855480 * b;
969
- const lc = l_ * l_ * l_, mc = m_ * m_ * m_, sc = s_ * s_ * s_;
970
- const rLin = 4.0767416621 * lc - 3.3077115913 * mc + 0.2309699292 * sc;
971
- const gLin = -1.2684380046 * lc + 2.6097574011 * mc - 0.3413193965 * sc;
972
- const bLin = -0.0041960863 * lc - 0.7034186147 * mc + 1.7076147010 * sc;
973
- const enc = (x) => {
974
- const c = Math.max(0, Math.min(1, x));
975
- return c <= 0.0031308 ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - 0.055;
976
- };
977
- return {
978
- r: Math.round(enc(rLin) * 255),
979
- g: Math.round(enc(gLin) * 255),
980
- b: Math.round(enc(bLin) * 255),
981
- a: 1,
982
- };
983
- }
984
-
985
- // Extended color parser: rgb/rgba/hex/oklch. Returns null on no match.
986
- // Use this when the input might be any CSS color form; use plain parseRgb
987
- // when you only expect computed rgb() values from real browsers.
988
- function parseAnyColor(s) {
989
- if (!s || typeof s !== 'string') return null;
990
- const str = s.trim();
991
- if (str === 'transparent' || str === 'currentcolor' || str === 'inherit') return null;
992
- let m;
993
- m = str.match(/rgba?\(\s*(\d+(?:\.\d+)?)\s*,?\s*(\d+(?:\.\d+)?)\s*,?\s*(\d+(?:\.\d+)?)(?:\s*[,/]\s*([\d.]+))?\s*\)/);
994
- if (m) return { r: Math.round(+m[1]), g: Math.round(+m[2]), b: Math.round(+m[3]), a: m[4] !== undefined ? +m[4] : 1 };
995
- m = str.match(/^#([0-9a-f]{3,8})$/i);
996
- if (m) {
997
- const h = m[1];
998
- if (h.length === 3 || h.length === 4) {
999
- return {
1000
- r: parseInt(h[0] + h[0], 16),
1001
- g: parseInt(h[1] + h[1], 16),
1002
- b: parseInt(h[2] + h[2], 16),
1003
- a: h.length === 4 ? parseInt(h[3] + h[3], 16) / 255 : 1,
1004
- };
1005
- }
1006
- if (h.length === 6 || h.length === 8) {
1007
- return {
1008
- r: parseInt(h.slice(0, 2), 16),
1009
- g: parseInt(h.slice(2, 4), 16),
1010
- b: parseInt(h.slice(4, 6), 16),
1011
- a: h.length === 8 ? parseInt(h.slice(6, 8), 16) / 255 : 1,
1012
- };
1013
- }
1014
- }
1015
- // OKLCH parser. Tailwind v4's CSS minifier squishes the space after
1016
- // `%` ("21.5%.02 50"), so the separator between L and C may be absent.
1017
- // Match L (with optional %), then C and H separated permissively.
1018
- m = str.match(/oklch\(\s*([\d.]+)(%?)\s*[\s,]*\s*([\d.]+)\s*[\s,]+\s*([-\d.]+)(?:deg)?(?:\s*\/\s*([\d.]+)(%)?)?\s*\)/i);
1019
- if (m) {
1020
- const Lnum = parseFloat(m[1]);
1021
- const L = m[2] === '%' ? Lnum / 100 : Lnum;
1022
- const rgb = oklchToRgb(L, parseFloat(m[3]), parseFloat(m[4]));
1023
- if (m[5] !== undefined) {
1024
- const alpha = parseFloat(m[5]);
1025
- rgb.a = m[6] === '%' ? alpha / 100 : alpha;
1026
- }
1027
- return rgb;
1028
- }
1029
- return null;
1030
- }
1031
-
1032
- // Resolve var() refs in a color string (via customPropMap), then parse.
1033
- // Returns null on any failure. Used in jsdom-mode paths where
1034
- // getComputedStyle returns literal "var(--X)" or "oklch(...)" strings.
1035
- function parseColorResolved(str, customPropMap) {
1036
- if (!str) return null;
1037
- const resolved = customPropMap ? resolveVarRefs(str, customPropMap) : str;
1038
- return parseAnyColor(resolved);
1039
- }
1040
-
1041
- const REPEATED_KICKER_SKIP_SELECTOR = [
1042
- 'nav',
1043
- 'form',
1044
- 'table',
1045
- 'thead',
1046
- 'tbody',
1047
- 'tfoot',
1048
- 'figure',
1049
- 'figcaption',
1050
- 'ol',
1051
- 'ul',
1052
- 'li',
1053
- '[role="navigation"]',
1054
- '[aria-label*="breadcrumb" i]',
1055
- '[class*="breadcrumb" i]',
1056
- '[aria-hidden="true"]',
1057
- '[data-monodesign-allow-kickers]',
1058
- ].join(',');
1059
-
1060
- const REPEATED_KICKER_CARD_CONTEXT_SELECTOR = [
1061
- 'article',
1062
- 'button',
1063
- 'a',
1064
- 'li',
1065
- '[role="listitem"]',
1066
- '[role="option"]',
1067
- ].join(',');
1068
-
1069
- function cleanInlineText(el) {
1070
- return [...el.childNodes]
1071
- .filter(n => n.nodeType === 3)
1072
- .map(n => n.textContent)
1073
- .join(' ')
1074
- .replace(/\s+/g, ' ')
1075
- .trim();
1076
- }
1077
-
1078
- function isRepeatedKickerCardContext(heading, kicker) {
1079
- const item = heading.closest?.(REPEATED_KICKER_CARD_CONTEXT_SELECTOR);
1080
- return Boolean(item && (!item.contains || item.contains(kicker)));
1081
- }
1082
-
1083
- function isRepeatedKickerCandidate(opts) {
1084
- const {
1085
- headingTag,
1086
- headingText,
1087
- headingFontSize,
1088
- kickerTag,
1089
- kickerText,
1090
- kickerTextTransform,
1091
- kickerFontSize,
1092
- kickerLetterSpacing,
1093
- } = opts;
1094
- if (!['h2', 'h3', 'h4'].includes(headingTag)) return false;
1095
- if (!headingText || headingText.length < 3) return false;
1096
- if (/^\/[\w-]+/i.test(headingText.replace(/^"|"$/g, '').trim())) return false;
1097
- if (!(headingFontSize >= 20)) return false;
1098
- if (!kickerTag || HEADING_TAGS.has(kickerTag)) return false;
1099
- if (!['p', 'span', 'div', 'small'].includes(kickerTag)) return false;
1100
- if (!kickerText || kickerText.length < 2 || kickerText.length > 34) return false;
1101
- if (/^step\s*\d+/i.test(kickerText) || /^\d{1,2}$/.test(kickerText)) return false;
1102
-
1103
- const isUppercased = kickerTextTransform === 'uppercase'
1104
- || (/[A-Z]/.test(kickerText) && !/[a-z]/.test(kickerText));
1105
- if (!isUppercased) return false;
1106
- if (!(kickerFontSize > 0 && kickerFontSize <= 14)) return false;
1107
- const minTrackedSpacing = Math.max(1, kickerFontSize * 0.08);
1108
- if (!(kickerLetterSpacing >= minTrackedSpacing)) return false;
1109
- return true;
1110
- }
1111
-
1112
- function collectRepeatedSectionKickerCandidates(doc, getStyle, resolveLetterSpacing) {
1113
- const candidates = [];
1114
- for (const heading of doc.querySelectorAll('h2, h3, h4')) {
1115
- if (heading.closest?.(REPEATED_KICKER_SKIP_SELECTOR)) continue;
1116
- const kicker = heading.previousElementSibling;
1117
- if (!kicker || kicker.closest?.(REPEATED_KICKER_SKIP_SELECTOR)) continue;
1118
- if (isRepeatedKickerCardContext(heading, kicker)) continue;
1119
-
1120
- const headingStyle = getStyle(heading);
1121
- const kickerStyle = getStyle(kicker);
1122
- const headingText = (heading.textContent || '').replace(/\s+/g, ' ').trim();
1123
- const kickerText = cleanInlineText(kicker) || (kicker.textContent || '').replace(/\s+/g, ' ').trim();
1124
- const headingFontSize = resolveLetterSpacing(headingStyle.fontSize || '', 16) || parseFloat(headingStyle.fontSize) || 0;
1125
- const kickerFontSize = resolveLetterSpacing(kickerStyle.fontSize || '', 16) || parseFloat(kickerStyle.fontSize) || 0;
1126
- const kickerLetterSpacing = resolveLetterSpacing(kickerStyle.letterSpacing || '', kickerFontSize);
1127
-
1128
- if (!isRepeatedKickerCandidate({
1129
- headingTag: heading.tagName.toLowerCase(),
1130
- headingText,
1131
- headingFontSize,
1132
- kickerTag: kicker.tagName.toLowerCase(),
1133
- kickerText,
1134
- kickerTextTransform: kickerStyle.textTransform || '',
1135
- kickerFontSize,
1136
- kickerLetterSpacing,
1137
- })) {
1138
- continue;
1139
- }
1140
-
1141
- candidates.push({
1142
- headingTag: heading.tagName.toLowerCase(),
1143
- headingText: headingText.replace(/^"|"$/g, '').slice(0, 60),
1144
- kickerText: kickerText.slice(0, 40),
1145
- });
1146
- }
1147
- return candidates;
1148
- }
1149
-
1150
- function checkRepeatedSectionKickersDOM() {
1151
- const candidates = collectRepeatedSectionKickerCandidates(
1152
- document,
1153
- (el) => getComputedStyle(el),
1154
- (value, fontSize) => resolveLengthPx(value, fontSize) || 0,
1155
- );
1156
- return checkRepeatedSectionKickers({ candidates });
1157
- }
1158
-
1159
- function checkElementMotionDOM(el) {
1160
- const tag = el.tagName.toLowerCase();
1161
- if (SAFE_TAGS.has(tag)) return [];
1162
- const style = getComputedStyle(el);
1163
- return checkMotion({
1164
- tag,
1165
- transitionProperty: style.transitionProperty || '',
1166
- animationName: style.animationName || '',
1167
- timingFunctions: [style.animationTimingFunction, style.transitionTimingFunction].filter(Boolean).join(' '),
1168
- classList: el.getAttribute('class') || '',
1169
- });
1170
- }
1171
-
1172
- function checkElementGlowDOM(el) {
1173
- const tag = el.tagName.toLowerCase();
1174
- const style = getComputedStyle(el);
1175
- if (!style.boxShadow || style.boxShadow === 'none') return [];
1176
- // Use parent's background — glow radiates outward, so the surrounding context matters
1177
- // If resolveBackground returns null (gradient), try to infer from the gradient colors
1178
- let parentBg = el.parentElement ? resolveBackground(el.parentElement) : resolveBackground(el);
1179
- if (!parentBg) {
1180
- // Gradient background — sample its colors to determine if it's dark
1181
- let cur = el.parentElement;
1182
- while (cur && cur.nodeType === 1) {
1183
- const bgImage = getComputedStyle(cur).backgroundImage || '';
1184
- const gradColors = parseGradientColors(bgImage);
1185
- if (gradColors.length > 0) {
1186
- // Average the gradient colors
1187
- const avg = { r: 0, g: 0, b: 0 };
1188
- for (const c of gradColors) { avg.r += c.r; avg.g += c.g; avg.b += c.b; }
1189
- avg.r = Math.round(avg.r / gradColors.length);
1190
- avg.g = Math.round(avg.g / gradColors.length);
1191
- avg.b = Math.round(avg.b / gradColors.length);
1192
- parentBg = avg;
1193
- break;
1194
- }
1195
- cur = cur.parentElement;
1196
- }
1197
- }
1198
- return checkGlow({ tag, boxShadow: style.boxShadow, effectiveBg: parentBg });
1199
- }
1200
-
1201
- function checkElementAIPaletteDOM(el) {
1202
- const style = getComputedStyle(el);
1203
- const findings = [];
1204
-
1205
- // Check gradient backgrounds for purple/violet or cyan
1206
- const bgImage = style.backgroundImage || '';
1207
- const gradColors = parseGradientColors(bgImage);
1208
- for (const c of gradColors) {
1209
- if (hasChroma(c, 50)) {
1210
- const hue = getHue(c);
1211
- if (hue >= 260 && hue <= 310) {
1212
- findings.push({ id: 'ai-color-palette', snippet: 'Purple/violet gradient background' });
1213
- break;
1214
- }
1215
- if (hue >= 160 && hue <= 200) {
1216
- findings.push({ id: 'ai-color-palette', snippet: 'Cyan gradient background' });
1217
- break;
1218
- }
1219
- }
1220
- }
1221
-
1222
- // Check for neon text (vivid cyan/purple color on dark background)
1223
- const textColor = parseRgb(style.color);
1224
- if (textColor && hasChroma(textColor, 80)) {
1225
- const hue = getHue(textColor);
1226
- const isAIPalette = (hue >= 160 && hue <= 200) || (hue >= 260 && hue <= 310);
1227
- if (isAIPalette) {
1228
- const parentBg = el.parentElement ? resolveBackground(el.parentElement) : null;
1229
- // Also check gradient parents
1230
- let effectiveBg = parentBg;
1231
- if (!effectiveBg) {
1232
- let cur = el.parentElement;
1233
- while (cur && cur.nodeType === 1) {
1234
- const gi = getComputedStyle(cur).backgroundImage || '';
1235
- const gc = parseGradientColors(gi);
1236
- if (gc.length > 0) {
1237
- const avg = { r: 0, g: 0, b: 0 };
1238
- for (const c of gc) { avg.r += c.r; avg.g += c.g; avg.b += c.b; }
1239
- avg.r = Math.round(avg.r / gc.length);
1240
- avg.g = Math.round(avg.g / gc.length);
1241
- avg.b = Math.round(avg.b / gc.length);
1242
- effectiveBg = avg;
1243
- break;
1244
- }
1245
- cur = cur.parentElement;
1246
- }
1247
- }
1248
- if (effectiveBg && relativeLuminance(effectiveBg) < 0.1) {
1249
- const label = hue >= 260 ? 'Purple/violet' : 'Cyan';
1250
- findings.push({ id: 'ai-color-palette', snippet: `${label} neon text on dark background` });
1251
- }
1252
- }
1253
- }
1254
-
1255
- return findings;
1256
- }
1257
-
1258
- const QUALITY_TEXT_TAGS = new Set(['p', 'li', 'td', 'th', 'dd', 'blockquote', 'figcaption']);
1259
-
1260
- // Resolve a CSS font-size value to pixels by walking up the parent chain.
1261
- // Browsers resolve em/rem/% to px in getComputedStyle, but jsdom returns the
1262
- // specified value verbatim — so for the Node path we walk parents ourselves.
1263
- function resolveFontSizePx(el, win) {
1264
- const chain = []; // raw font-size strings, leaf → root
1265
- let cur = el;
1266
- while (cur && cur.nodeType === 1) {
1267
- const fs = (win ? win.getComputedStyle(cur) : getComputedStyle(cur)).fontSize;
1268
- chain.push(fs || '');
1269
- cur = cur.parentElement;
1270
- }
1271
- // Walk root → leaf, resolving each value relative to its parent context.
1272
- let px = 16; // root default
1273
- for (let i = chain.length - 1; i >= 0; i--) {
1274
- const v = chain[i];
1275
- if (!v || v === 'inherit') continue;
1276
- const num = parseFloat(v);
1277
- if (isNaN(num)) continue;
1278
- if (v.endsWith('px')) px = num;
1279
- else if (v.endsWith('rem')) px = num * 16;
1280
- else if (v.endsWith('em')) px = num * px;
1281
- else if (v.endsWith('%')) px = (num / 100) * px;
1282
- else px = num; // unitless — already resolved
1283
- }
1284
- return px;
1285
- }
1286
-
1287
- // Resolve a CSS length value (line-height, letter-spacing, etc.) given a
1288
- // known font-size context. Returns null for "normal" / unparseable values.
1289
- function resolveLengthPx(value, fontSizePx) {
1290
- if (!value || value === 'normal' || value === 'auto' || value === 'inherit') return null;
1291
- const num = parseFloat(value);
1292
- if (isNaN(num)) return null;
1293
- if (value.endsWith('px')) return num;
1294
- if (value.endsWith('rem')) return num * 16;
1295
- if (value.endsWith('em')) return num * fontSizePx;
1296
- if (value.endsWith('%')) return (num / 100) * fontSizePx;
1297
- // Unitless line-height = multiplier, return px equivalent
1298
- return num * fontSizePx;
1299
- }
1300
-
1301
- function cssColorIsTransparent(value) {
1302
- if (!value) return true;
1303
- const str = String(value).trim().toLowerCase();
1304
- if (!str || str === 'transparent' || str === 'rgba(0, 0, 0, 0)') return true;
1305
- const parsed = parseAnyColor(str);
1306
- if (parsed) return (parsed.a ?? 1) <= 0.05;
1307
- return /^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*0(?:\.0+)?\s*\)$/.test(str);
1308
- }
1309
-
1310
- function colorsNearlyMatch(a, b) {
1311
- const ca = parseAnyColor(a);
1312
- const cb = parseAnyColor(b);
1313
- if (!ca || !cb) return false;
1314
- const alphaDelta = Math.abs((ca.a ?? 1) - (cb.a ?? 1));
1315
- const channelDelta = Math.max(
1316
- Math.abs(ca.r - cb.r),
1317
- Math.abs(ca.g - cb.g),
1318
- Math.abs(ca.b - cb.b),
1319
- );
1320
- return alphaDelta <= 0.03 && channelDelta <= 3;
1321
- }
1322
-
1323
- function getComputedStyleFor(win, el) {
1324
- if (win && typeof win.getComputedStyle === 'function') {
1325
- try { return win.getComputedStyle(el); } catch {}
1326
- }
1327
- if (typeof getComputedStyle === 'function') {
1328
- try { return getComputedStyle(el); } catch {}
1329
- }
1330
- return null;
1331
- }
1332
-
1333
- function hasVisibleBackgroundBoundary(style, el, win) {
1334
- const bg = style?.backgroundColor || '';
1335
- if (cssColorIsTransparent(bg)) return false;
1336
-
1337
- let parent = el?.parentElement || null;
1338
- while (parent) {
1339
- const parentStyle = getComputedStyleFor(win, parent);
1340
- const parentBg = parentStyle?.backgroundColor || '';
1341
- if (!cssColorIsTransparent(parentBg)) {
1342
- return !colorsNearlyMatch(bg, parentBg);
1343
- }
1344
- parent = parent.parentElement;
1345
- }
1346
-
1347
- return true;
1348
- }
1349
-
1350
- const TEXT_EDGE_TAGS = new Set(['A', 'BUTTON', 'CODE', 'DD', 'DT', 'FIGCAPTION', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'LI', 'P', 'PRE', 'SPAN', 'TD', 'TH']);
1351
-
1352
- function hasMeaningfulDirectText(node) {
1353
- if (!node?.childNodes) return false;
1354
- for (const child of node.childNodes) {
1355
- if (child.nodeType === 3 && child.textContent.trim().length > 4) return true;
1356
- }
1357
- return false;
1358
- }
1359
-
1360
- function textDescendantsFlushSides(el, rect) {
1361
- const flush = { top: false, right: false, bottom: false, left: false };
1362
- if (!rect || !el?.querySelectorAll) return flush;
1363
- const TEXT_EDGE_THRESHOLD = 4;
1364
- const candidates = el.querySelectorAll('a, button, code, dd, dt, figcaption, h1, h2, h3, h4, h5, h6, li, p, pre, span, td, th');
1365
- for (const node of candidates) {
1366
- if (!TEXT_EDGE_TAGS.has(node.tagName) || !hasMeaningfulDirectText(node)) continue;
1367
- let nodeRect = null;
1368
- try { nodeRect = node.getBoundingClientRect(); } catch {}
1369
- if (!nodeRect || nodeRect.width <= 0 || nodeRect.height <= 0) continue;
1370
- if (nodeRect.bottom < rect.top || nodeRect.top > rect.bottom || nodeRect.right < rect.left || nodeRect.left > rect.right) continue;
1371
- if (nodeRect.top - rect.top <= TEXT_EDGE_THRESHOLD) flush.top = true;
1372
- if (rect.right - nodeRect.right <= TEXT_EDGE_THRESHOLD) flush.right = true;
1373
- if (rect.bottom - nodeRect.bottom <= TEXT_EDGE_THRESHOLD) flush.bottom = true;
1374
- if (nodeRect.left - rect.left <= TEXT_EDGE_THRESHOLD) flush.left = true;
1375
- }
1376
- return flush;
1377
- }
1378
-
1379
- // Pure quality checks. Most run on computed CSS and DOM-only inputs (work in
1380
- // jsdom and the browser). Two checks (line-length, cramped-padding) gate on
1381
- // element rect dimensions, which jsdom can't compute — pass `rect: null` from
1382
- // the Node adapter to skip those.
1383
- //
1384
- // Both adapters resolve font-size, line-height and letter-spacing to pixels
1385
- // before calling this so the pure function only deals with numbers.
1386
- function checkQuality(opts) {
1387
- const { el, tag, style, hasDirectText, textLen, fontSize, lineHeightPx, letterSpacingPx, rect, lineMax = 80, viewportWidth = 0, win = null } = opts;
1388
- const findings = [];
1389
- // Skip browser extension injected elements
1390
- const elId = el.id || '';
1391
- if (elId.startsWith('claude-') || elId.startsWith('cic-')) return findings;
1392
-
1393
- // --- Line length too long --- (browser-only: needs rect.width)
1394
- if (rect && hasDirectText && QUALITY_TEXT_TAGS.has(tag) && rect.width > 0 && textLen > lineMax) {
1395
- const charsPerLine = rect.width / (fontSize * 0.5);
1396
- if (charsPerLine > lineMax + 5) {
1397
- findings.push({ id: 'line-length', snippet: `~${Math.round(charsPerLine)} chars/line (aim for <${lineMax})` });
1398
- }
1399
- }
1400
-
1401
- // --- Cramped padding --- (browser-only: needs rect to skip small badges/labels)
1402
- // Vertical and horizontal thresholds are independent because line-height
1403
- // already provides built-in vertical breathing room (the line box is taller
1404
- // than the cap height), but horizontal has no equivalent. Both scale with
1405
- // font-size — bigger text demands proportionally more padding.
1406
- // vertical: max(4px, fontSize × 0.3)
1407
- // horizontal: max(8px, fontSize × 0.5)
1408
- const isInlineCode = tag === 'code' && !(el.closest && el.closest('pre'));
1409
- if (!isInlineCode && rect && hasDirectText && textLen > 20 && rect.width > 100 && rect.height > 30) {
1410
- const borders = {
1411
- top: parseFloat(style.borderTopWidth) || 0,
1412
- right: parseFloat(style.borderRightWidth) || 0,
1413
- bottom: parseFloat(style.borderBottomWidth) || 0,
1414
- left: parseFloat(style.borderLeftWidth) || 0,
1415
- };
1416
- const borderCount = Object.values(borders).filter(w => w > 0).length;
1417
- const hasBg = hasVisibleBackgroundBoundary(style, el, win);
1418
- if (borderCount >= 2 || hasBg) {
1419
- const vPads = [], hPads = [];
1420
- if (hasBg || borders.top > 0) vPads.push(parseFloat(style.paddingTop) || 0);
1421
- if (hasBg || borders.bottom > 0) vPads.push(parseFloat(style.paddingBottom) || 0);
1422
- if (hasBg || borders.left > 0) hPads.push(parseFloat(style.paddingLeft) || 0);
1423
- if (hasBg || borders.right > 0) hPads.push(parseFloat(style.paddingRight) || 0);
1424
-
1425
- const vMin = vPads.length ? Math.min(...vPads) : Infinity;
1426
- const hMin = hPads.length ? Math.min(...hPads) : Infinity;
1427
- const vThresh = Math.max(4, fontSize * 0.3);
1428
- const hThresh = Math.max(8, fontSize * 0.5);
1429
-
1430
- // Emit at most one finding per element — pick whichever axis is worse.
1431
- if (vMin < vThresh) {
1432
- findings.push({ id: 'cramped-padding', snippet: `${vMin}px vertical padding (need ≥${vThresh.toFixed(1)}px for ${fontSize}px text)` });
1433
- } else if (hMin < hThresh) {
1434
- findings.push({ id: 'cramped-padding', snippet: `${hMin}px horizontal padding (need ≥${hThresh.toFixed(1)}px for ${fontSize}px text)` });
1435
- }
1436
- }
1437
- }
1438
-
1439
- // --- Flush against a visible boundary ---
1440
- // Fires when a container has a visible boundary (border, outline, OR a
1441
- // non-transparent background) AND near-zero padding on the bounded
1442
- // side(s) AND text-bearing children land flush against the boundary.
1443
- //
1444
- // Distinct from cramped-padding: that rule needs the element itself to
1445
- // have direct text (hasDirectText). This rule targets the OPPOSITE
1446
- // shape — a container with NO direct text, only children — which is
1447
- // exactly what cramped-padding misses (a section wrapping a label +
1448
- // list lands a free pass).
1449
- //
1450
- // The classic shape: agent writes `padding: 28px 0 0` shorthand on a
1451
- // section that also has a border, zeroing horizontal padding so the
1452
- // text-bearing children touch the side borders. Background and
1453
- // outline count too: a colored card with zero padding has the same
1454
- // visual failure mode.
1455
- {
1456
- const FLUSH_SKIP_TAGS = new Set(['HTML', 'BODY', 'MAIN', 'HEADER', 'FOOTER', 'NAV', 'ARTICLE', 'ASIDE', 'BUTTON', 'A', 'LABEL', 'SUMMARY', 'CODE', 'PRE', 'INPUT', 'TEXTAREA', 'SELECT', 'FORM', 'FIGURE', 'TABLE', 'TBODY', 'THEAD', 'TR', 'TD', 'TH']);
1457
- const upperTag = tag ? tag.toUpperCase() : '';
1458
- const elPosition = style.position || '';
1459
- if (
1460
- !FLUSH_SKIP_TAGS.has(upperTag) &&
1461
- !hasDirectText &&
1462
- !['fixed', 'absolute'].includes(elPosition) &&
1463
- el.children && el.children.length > 0
1464
- ) {
1465
- const borderW = {
1466
- top: parseFloat(style.borderTopWidth) || 0,
1467
- right: parseFloat(style.borderRightWidth) || 0,
1468
- bottom: parseFloat(style.borderBottomWidth) || 0,
1469
- left: parseFloat(style.borderLeftWidth) || 0,
1470
- };
1471
- const borderVisible = {
1472
- top: borderW.top > 0 && !cssColorIsTransparent(style.borderTopColor),
1473
- right: borderW.right > 0 && !cssColorIsTransparent(style.borderRightColor),
1474
- bottom: borderW.bottom > 0 && !cssColorIsTransparent(style.borderBottomColor),
1475
- left: borderW.left > 0 && !cssColorIsTransparent(style.borderLeftColor),
1476
- };
1477
- // Outline detection. jsdom decomposes `border` shorthand into
1478
- // border{Top,…}Width/Color but does NOT decompose `outline` —
1479
- // the longhands come back empty when the value was set via the
1480
- // shorthand. Fall back to parsing `style.outline` ourselves.
1481
- let outlineW = parseFloat(style.outlineWidth) || 0;
1482
- let outlineStyleVal = style.outlineStyle || '';
1483
- let outlineColorVal = style.outlineColor || '';
1484
- if (!outlineW && style.outline) {
1485
- const wMatch = style.outline.match(/(\d+(?:\.\d+)?)\s*px/);
1486
- if (wMatch) outlineW = parseFloat(wMatch[1]) || 0;
1487
- if (!outlineStyleVal) {
1488
- outlineStyleVal = /\b(solid|dashed|dotted|double|groove|ridge|inset|outset)\b/.test(style.outline) ? 'solid' : '';
1489
- }
1490
- if (!outlineColorVal) {
1491
- const cMatch = style.outline.match(/(rgba?\([^)]+\)|#[0-9a-fA-F]{3,8}|[a-zA-Z]+)\s*$/);
1492
- if (cMatch) outlineColorVal = cMatch[1];
1493
- }
1494
- }
1495
- const outlineVisible = outlineW > 0 && !cssColorIsTransparent(outlineColorVal) && outlineStyleVal && outlineStyleVal !== 'none';
1496
- const bgVisible = hasVisibleBackgroundBoundary(style, el, win);
1497
-
1498
- const anyVisible = borderVisible.top || borderVisible.right || borderVisible.bottom || borderVisible.left || outlineVisible || bgVisible;
1499
- if (anyVisible) {
1500
- // Resolve padding to px (jsdom returns raw "1.5rem" etc., not the
1501
- // computed px value; parseFloat would strip the unit and treat
1502
- // 1.5rem as 1.5px, false-flagging legitimate insets).
1503
- const pad = {
1504
- top: resolveLengthPx(style.paddingTop, fontSize) ?? 0,
1505
- right: resolveLengthPx(style.paddingRight, fontSize) ?? 0,
1506
- bottom: resolveLengthPx(style.paddingBottom, fontSize) ?? 0,
1507
- left: resolveLengthPx(style.paddingLeft, fontSize) ?? 0,
1508
- };
1509
- const PAD_THRESHOLD = 2;
1510
- // Children-insulate-this-side: a side is insulated if ANY direct
1511
- // child has its own padding ≥ 4px on that side. Rationale: in
1512
- // typical flow, only the first/last (or leftmost/rightmost)
1513
- // children actually sit at the parent's edges. If even one of
1514
- // them has its own padding, the visual flush is broken on that
1515
- // side. Classic example: a column-flow card frame where the
1516
- // top child (header) has padding-top:12 and the bottom child
1517
- // (footer) has padding-bottom:8 — the parent's padding:0 doesn't
1518
- // matter; nothing is actually flush. The `any-child-insulates`
1519
- // heuristic accepts some false negatives (a card with one heavily
1520
- // padded middle child won't flag) for far fewer false positives.
1521
- const CHILD_INSULATE_THRESHOLD = 4;
1522
- const childrenInsulate = { top: false, right: false, bottom: false, left: false };
1523
- for (const child of el.children) {
1524
- let childStyle = getComputedStyleFor(win, child);
1525
- if (!childStyle) continue;
1526
- const childPad = {
1527
- top: resolveLengthPx(childStyle.paddingTop, fontSize) ?? 0,
1528
- right: resolveLengthPx(childStyle.paddingRight, fontSize) ?? 0,
1529
- bottom: resolveLengthPx(childStyle.paddingBottom, fontSize) ?? 0,
1530
- left: resolveLengthPx(childStyle.paddingLeft, fontSize) ?? 0,
1531
- };
1532
- const childMargin = {
1533
- top: resolveLengthPx(childStyle.marginTop, fontSize) ?? 0,
1534
- right: resolveLengthPx(childStyle.marginRight, fontSize) ?? 0,
1535
- bottom: resolveLengthPx(childStyle.marginBottom, fontSize) ?? 0,
1536
- left: resolveLengthPx(childStyle.marginLeft, fontSize) ?? 0,
1537
- };
1538
- if (rect && typeof child.getBoundingClientRect === 'function') {
1539
- try {
1540
- const childRect = child.getBoundingClientRect();
1541
- if (childRect && childRect.width > 0 && childRect.height > 0) {
1542
- if (childRect.top - rect.top >= CHILD_INSULATE_THRESHOLD) childrenInsulate.top = true;
1543
- if (rect.right - childRect.right >= CHILD_INSULATE_THRESHOLD) childrenInsulate.right = true;
1544
- if (rect.bottom - childRect.bottom >= CHILD_INSULATE_THRESHOLD) childrenInsulate.bottom = true;
1545
- if (childRect.left - rect.left >= CHILD_INSULATE_THRESHOLD) childrenInsulate.left = true;
1546
- }
1547
- } catch {}
1548
- }
1549
- for (const s of ['top', 'right', 'bottom', 'left']) {
1550
- if (childPad[s] >= CHILD_INSULATE_THRESHOLD || childMargin[s] >= CHILD_INSULATE_THRESHOLD) {
1551
- childrenInsulate[s] = true;
1552
- }
1553
- }
1554
- }
1555
-
1556
- const textFlush = rect ? textDescendantsFlushSides(el, rect) : null;
1557
- const fullBleedBgBand = rect && viewportWidth > 0 && rect.width >= viewportWidth * 0.94 && bgVisible && !outlineVisible;
1558
- const flushSides = [];
1559
- for (const side of ['top', 'right', 'bottom', 'left']) {
1560
- const bgBoundsSide = bgVisible && !(fullBleedBgBand && (side === 'left' || side === 'right'));
1561
- const sideBounded = borderVisible[side] || outlineVisible || bgBoundsSide;
1562
- if (sideBounded && pad[side] <= PAD_THRESHOLD && !childrenInsulate[side] && (!textFlush || textFlush[side])) {
1563
- flushSides.push(side);
1564
- }
1565
- }
1566
-
1567
- if (flushSides.length > 0) {
1568
- // Confirm at least one direct child has substantial text content
1569
- // (> 4 chars). Without this, the flush is harmless: e.g. an
1570
- // image-only card.
1571
- let hasTextChild = false;
1572
- for (const child of el.children) {
1573
- const childText = (child.textContent || '').trim();
1574
- if (childText.length > 4) { hasTextChild = true; break; }
1575
- }
1576
- if (hasTextChild) {
1577
- const cls = (typeof el.className === 'string' && el.className.trim())
1578
- ? el.className.trim().split(/\s+/)[0]
1579
- : '';
1580
- const boundaryParts = [];
1581
- const borderSidesVisible = ['top', 'right', 'bottom', 'left'].filter(s => borderVisible[s]);
1582
- if (borderSidesVisible.length === 4) boundaryParts.push('border');
1583
- else if (borderSidesVisible.length > 0) boundaryParts.push(`border-${borderSidesVisible.join('/')}`);
1584
- if (outlineVisible) boundaryParts.push('outline');
1585
- if (bgVisible) boundaryParts.push('bg');
1586
- const sidesLabel = flushSides.length === 4 ? 'all sides' : flushSides.join('/');
1587
- const ident = cls
1588
- ? `<${tag.toLowerCase()}> "${cls}"`
1589
- : `<${tag.toLowerCase()}>`;
1590
- findings.push({
1591
- id: 'cramped-padding',
1592
- snippet: `${ident}: children flush against ${boundaryParts.join('+')} on ${sidesLabel} (no inset)`,
1593
- });
1594
- }
1595
- }
1596
- }
1597
- }
1598
- }
1599
-
1600
- // --- Body text touching viewport edge --- (browser-only: needs rect)
1601
- // Catches the failure mode where the agent ships body paragraphs
1602
- // with NO container providing horizontal padding — text bleeds
1603
- // directly to the viewport edge. Different from cramped-padding,
1604
- // which requires a colored/bordered container. Here the failure
1605
- // is the absence of the container entirely.
1606
- //
1607
- // Gate aggressively to avoid false positives:
1608
- // - <p> or <li> only (body content; not headings, not nav, not
1609
- // wrappers)
1610
- // - text > 40 chars (paragraph-like, not a label)
1611
- // - rect.width > 50% of viewport (real body, not a pull-quote)
1612
- // - rect.left < 16 OR rect.right > viewport - 16 (actually
1613
- // touching the edge)
1614
- // - not inside <nav> or <header> (those legitimately bleed)
1615
- // - element itself has no background-color (intentional full-bleed
1616
- // sections set a bg-color and provide their own internal padding)
1617
- if (rect && hasDirectText && textLen > 40 && ['P', 'LI'].includes(tag.toUpperCase()) && viewportWidth > 0) {
1618
- const inNavHeader = el.closest && (el.closest('nav') || el.closest('header'));
1619
- const hasOwnBg = style.backgroundColor && style.backgroundColor !== 'rgba(0, 0, 0, 0)' && style.backgroundColor !== 'transparent';
1620
- const isPositioned = ['fixed', 'absolute'].includes(style.position || '');
1621
- const widthRatio = rect.width / viewportWidth;
1622
- const leftClose = rect.left < 16;
1623
- const rightClose = rect.right > viewportWidth - 16;
1624
- if (!inNavHeader && !hasOwnBg && !isPositioned && widthRatio > 0.5 && (leftClose || rightClose)) {
1625
- const which = leftClose && rightClose
1626
- ? `left ${Math.round(rect.left)}px / right ${Math.round(viewportWidth - rect.right)}px`
1627
- : leftClose
1628
- ? `left ${Math.round(rect.left)}px`
1629
- : `right ${Math.round(viewportWidth - rect.right)}px`;
1630
- findings.push({ id: 'body-text-viewport-edge', snippet: `<${tag.toLowerCase()}> with ${textLen}-char body bleeds to viewport edge (${which})` });
1631
- }
1632
- }
1633
-
1634
- // --- Tight line height ---
1635
- if (hasDirectText && textLen > 50 && !['h1','h2','h3','h4','h5','h6'].includes(tag)) {
1636
- if (lineHeightPx != null && fontSize > 0) {
1637
- const ratio = lineHeightPx / fontSize;
1638
- if (ratio > 0 && ratio < 1.3) {
1639
- findings.push({ id: 'tight-leading', snippet: `line-height ${ratio.toFixed(2)}x (need >=1.3)` });
1640
- }
1641
- }
1642
- }
1643
-
1644
- // --- Justified text (without hyphens) ---
1645
- if (hasDirectText && style.textAlign === 'justify') {
1646
- const hyphens = style.hyphens || style.webkitHyphens || '';
1647
- if (hyphens !== 'auto') {
1648
- findings.push({ id: 'justified-text', snippet: 'text-align: justify without hyphens: auto' });
1649
- }
1650
- }
1651
-
1652
- // --- Tiny body text ---
1653
- // Only flag actual body content, not UI labels (buttons, tabs, badges, captions, footer text, etc.)
1654
- if (hasDirectText && textLen > 20 && fontSize < 12) {
1655
- const skipTags = ['sub', 'sup', 'code', 'kbd', 'samp', 'var', 'caption', 'figcaption'];
1656
- const inUIContext = el.closest && el.closest('button, a, label, summary, pre, [role="button"], [role="link"], [role="tab"], [role="menuitem"], [role="option"], nav, footer, [aria-hidden="true"], [class*="badge" i], [class*="caption" i], [class*="chip" i], [class*="code" i], [class*="console" i], [class*="diff" i], [class*="label" i], [class*="meta" i], [class*="mock" i], [class*="pill" i], [class*="preview" i], [class*="tag" i], [class*="terminal" i], [class*="writes" i]');
1657
- const isUppercase = style.textTransform === 'uppercase';
1658
- if (!skipTags.includes(tag) && !inUIContext && !isUppercase) {
1659
- findings.push({ id: 'tiny-text', snippet: `${fontSize}px body text` });
1660
- }
1661
- }
1662
-
1663
- // --- All-caps body text ---
1664
- if (hasDirectText && textLen > 30 && style.textTransform === 'uppercase') {
1665
- if (!['h1','h2','h3','h4','h5','h6'].includes(tag)) {
1666
- findings.push({ id: 'all-caps-body', snippet: `text-transform: uppercase on ${textLen} chars of body text` });
1667
- }
1668
- }
1669
-
1670
- // --- Wide letter spacing on body text ---
1671
- if (hasDirectText && textLen > 20 && style.textTransform !== 'uppercase') {
1672
- if (letterSpacingPx != null && letterSpacingPx > 0 && fontSize > 0) {
1673
- const trackingEm = letterSpacingPx / fontSize;
1674
- if (trackingEm > 0.05) {
1675
- findings.push({ id: 'wide-tracking', snippet: `letter-spacing: ${trackingEm.toFixed(2)}em on body text` });
1676
- }
1677
- }
1678
- }
1679
-
1680
- // --- Crushed letter spacing (mirror of wide-tracking) ---
1681
- // Tracking pulled tighter than ~-0.05em crushes characters into each other.
1682
- // Optical tightening that display type legitimately wants (around -0.02em)
1683
- // stays well above this floor.
1684
- if (hasDirectText && textLen > 20 && fontSize > 0) {
1685
- if (letterSpacingPx != null && letterSpacingPx < 0) {
1686
- const trackingEm = letterSpacingPx / fontSize;
1687
- if (trackingEm <= -0.05) {
1688
- const excerpt = (el.textContent || '').trim().replace(/\s+/g, ' ').slice(0, 40);
1689
- findings.push({ id: 'extreme-negative-tracking', snippet: `letter-spacing: ${trackingEm.toFixed(2)}em — "${excerpt}"` });
1690
- }
1691
- }
1692
- }
1693
-
1694
- return findings;
1695
- }
1696
-
1697
- function checkElementQualityDOM(el) {
1698
- const tag = el.tagName.toLowerCase();
1699
- const style = getComputedStyle(el);
1700
- const hasDirectText = [...el.childNodes].some(n => n.nodeType === 3 && n.textContent.trim().length > 10);
1701
- const textLen = el.textContent?.trim().length || 0;
1702
- // Browser getComputedStyle resolves everything to px — direct parseFloat
1703
- // works.
1704
- const fontSize = parseFloat(style.fontSize) || 16;
1705
- const lineHeightPx = resolveLengthPx(style.lineHeight, fontSize);
1706
- const letterSpacingPx = resolveLengthPx(style.letterSpacing, fontSize);
1707
- const rect = el.getBoundingClientRect();
1708
- const lineMax = (typeof window !== 'undefined' && window.__MONODESIGN_CONFIG__?.lineLengthMax) || 80;
1709
- const viewportWidth = (typeof window !== 'undefined' ? window.innerWidth : 0) || 0;
1710
- return checkQuality({ el, tag, style, hasDirectText, textLen, fontSize, lineHeightPx, letterSpacingPx, rect, lineMax, viewportWidth, win: typeof window !== 'undefined' ? window : null });
1711
- }
1712
-
1713
- // Pure page-level skipped-heading walk. Takes a Document so it works in both
1714
- // the browser and jsdom.
1715
- function checkPageQualityFromDoc(doc) {
1716
- const findings = [];
1717
- const headings = doc.querySelectorAll('h1, h2, h3, h4, h5, h6');
1718
- let prevLevel = 0;
1719
- let prevText = '';
1720
- for (const h of headings) {
1721
- const level = parseInt(h.tagName[1]);
1722
- const text = (h.textContent || '').trim().replace(/\s+/g, ' ').slice(0, 60);
1723
- if (prevLevel > 0 && level > prevLevel + 1) {
1724
- findings.push({
1725
- id: 'skipped-heading',
1726
- snippet: `<h${prevLevel}> "${prevText}" followed by <h${level}> "${text}" (missing h${prevLevel + 1})`,
1727
- });
1728
- }
1729
- prevLevel = level;
1730
- prevText = text;
1731
- }
1732
- return findings;
1733
- }
1734
-
1735
- // Browser adapter (returns the legacy { type, detail } shape used by the overlay loop)
1736
- function checkPageQualityDOM() {
1737
- return checkPageQualityFromDoc(document).map(f => ({ type: f.id, detail: f.snippet }));
1738
- }
1739
-
1740
- // Node adapters — take pre-extracted jsdom computed style
1741
-
1742
- // jsdom doesn't lay out OR resolve em/rem/% to px — so we pre-resolve every
1743
- // CSS length the rule needs ourselves (walking the parent chain for
1744
- // font-size inheritance), and pass `rect: null` to skip the two rules that
1745
- // genuinely need element rects (line-length, cramped-padding).
1746
- function checkElementQuality(el, style, tag, window) {
1747
- const hasDirectText = [...el.childNodes].some(n => n.nodeType === 3 && n.textContent.trim().length > 10);
1748
- const textLen = el.textContent?.trim().length || 0;
1749
- const fontSize = resolveFontSizePx(el, window);
1750
- const lineHeightPx = resolveLengthPx(style.lineHeight, fontSize);
1751
- const letterSpacingPx = resolveLengthPx(style.letterSpacing, fontSize);
1752
- return checkQuality({ el, tag, style, hasDirectText, textLen, fontSize, lineHeightPx, letterSpacingPx, rect: null, win: window });
1753
- }
1754
-
1755
- function checkElementBorders(tag, style, overrides, resolvedRadius) {
1756
- const sides = ['Top', 'Right', 'Bottom', 'Left'];
1757
- const widths = {}, colors = {};
1758
- for (const s of sides) {
1759
- widths[s] = parseFloat(style[`border${s}Width`]) || 0;
1760
- colors[s] = style[`border${s}Color`] || '';
1761
- // jsdom silently drops any border shorthand containing var(), leaving
1762
- // both width and color empty on the computed style. When the detectHtml
1763
- // pre-pass pulled a resolved value off the rule, use it to fill in the
1764
- // missing side so the side-tab check can run. Real browsers resolve
1765
- // var() natively, so this fallback is a no-op in the browser path.
1766
- if (widths[s] === 0 && overrides && overrides[s]) {
1767
- widths[s] = overrides[s].width;
1768
- colors[s] = overrides[s].color;
1769
- } else if (colors[s] && colors[s].startsWith('var(') && overrides && overrides[s]) {
1770
- // Longhand case: jsdom kept the width but left the color as the
1771
- // literal `var(...)` string. Substitute the resolved color.
1772
- colors[s] = overrides[s].color;
1773
- }
1774
- }
1775
- // resolvedRadius lets the caller pre-resolve the radius via
1776
- // resolveBorderRadiusPx so the value survives jsdom 29.1.0's broken
1777
- // shorthand serialization. Falls back to the computed value for tests
1778
- // and browser callers that don't pre-resolve.
1779
- const radius = resolvedRadius != null
1780
- ? resolvedRadius
1781
- : (parseFloat(style.borderRadius) || 0);
1782
- return checkBorders(tag, widths, colors, radius);
1783
- }
1784
-
1785
- function checkElementColors(el, style, tag, window, customPropMap, hasAnchorInheritRule) {
1786
- const directText = [...el.childNodes].filter(n => n.nodeType === 3).map(n => n.textContent).join('');
1787
- const hasDirectText = directText.trim().length > 0;
1788
-
1789
- const effectiveBg = resolveBackground(el, window, customPropMap);
1790
- // jsdom returns literal "var(--X)" / "oklch(...)" for color, so plain
1791
- // parseRgb misses Tailwind-tokenized text colors. Resolve through the
1792
- // customPropMap first; fall back to parseRgb for vanilla rgb() pages.
1793
- let textColor = customPropMap ? parseColorResolved(style.color, customPropMap) : null;
1794
- if (!textColor) textColor = parseRgb(style.color);
1795
-
1796
- // Anchor-inherit FP workaround: jsdom's UA stylesheet has `:link { color:
1797
- // blue }` at high specificity. The page's `a { color: inherit }` rule
1798
- // (Tailwind v4 preflight) loses to jsdom even though it WINS in real
1799
- // browsers (Chrome's UA wraps :link in :where() — zero specificity).
1800
- // When the page declares the inherit rule AND we see jsdom's default
1801
- // link blue on an anchor, walk to the nearest non-anchor ancestor and
1802
- // use its color instead.
1803
- if (
1804
- hasAnchorInheritRule &&
1805
- textColor &&
1806
- textColor.r === 0 && textColor.g === 0 && textColor.b === 238 &&
1807
- (tag === 'a' || el.closest?.('a'))
1808
- ) {
1809
- let cur = el.parentElement;
1810
- while (cur && cur.tagName !== 'HTML') {
1811
- if (cur.tagName !== 'A') {
1812
- const ps = window.getComputedStyle(cur);
1813
- const inh = (customPropMap ? parseColorResolved(ps.color, customPropMap) : null) || parseRgb(ps.color);
1814
- if (inh && !(inh.r === 0 && inh.g === 0 && inh.b === 238)) {
1815
- textColor = inh;
1816
- break;
1817
- }
1818
- }
1819
- cur = cur.parentElement;
1820
- }
1821
- }
1822
-
1823
- return checkColors({
1824
- tag,
1825
- textColor,
1826
- bgColor: readOwnBackgroundColor(el, style),
1827
- effectiveBg,
1828
- effectiveBgStops: effectiveBg ? null : resolveGradientStops(el, window),
1829
- fontSize: parseFloat(style.fontSize) || 16,
1830
- fontWeight: parseInt(style.fontWeight) || 400,
1831
- hasDirectText,
1832
- isEmojiOnly: isEmojiOnlyText(directText),
1833
- bgClip: style.webkitBackgroundClip || style.backgroundClip || '',
1834
- bgImage: style.backgroundImage || '',
1835
- classList: el.getAttribute?.('class') || el.className || '',
1836
- });
1837
- }
1838
-
1839
- function checkElementIconTile(el, tag, window) {
1840
- if (!HEADING_TAGS.has(tag)) return [];
1841
- const sibling = el.previousElementSibling;
1842
- if (!sibling) return [];
1843
-
1844
- const sibStyle = window.getComputedStyle(sibling);
1845
- // jsdom doesn't lay out — read explicit pixel dimensions from CSS instead.
1846
- const sibWidth = parseFloat(sibStyle.width) || 0;
1847
- const sibHeight = parseFloat(sibStyle.height) || 0;
1848
-
1849
- const iconChild = sibling.querySelector('svg, i[data-lucide], i[class*="fa-"], i[class*="icon"]');
1850
- let iconWidth = 0;
1851
- if (iconChild) {
1852
- const iconStyle = window.getComputedStyle(iconChild);
1853
- iconWidth = parseFloat(iconStyle.width) || parseFloat(iconChild.getAttribute('width')) || 0;
1854
- }
1855
- // Or: tile contains an emoji/symbol character directly as its only content
1856
- const sibDirectText = [...sibling.childNodes].filter(n => n.nodeType === 3).map(n => n.textContent).join('');
1857
- const hasInlineEmojiIcon = sibling.children.length === 0 && isEmojiOnlyText(sibDirectText);
1858
-
1859
- return checkIconTile({
1860
- headingTag: tag,
1861
- headingText: el.textContent || '',
1862
- headingTop: 0, // jsdom: no layout, skip vertical-stacking gate
1863
- siblingTag: sibling.tagName.toLowerCase(),
1864
- siblingWidth: sibWidth,
1865
- siblingHeight: sibHeight,
1866
- siblingBottom: 0,
1867
- siblingBgColor: parseRgb(sibStyle.backgroundColor),
1868
- siblingBgImage: sibStyle.backgroundImage || '',
1869
- siblingBorderWidth: parseFloat(sibStyle.borderTopWidth) || 0,
1870
- siblingBorderRadius: resolveBorderRadiusPx(sibling, sibStyle, sibWidth, window),
1871
- hasIconChild: !!iconChild || hasInlineEmojiIcon,
1872
- iconChildWidth: iconWidth,
1873
- });
1874
- }
1875
-
1876
- function checkElementItalicSerif(el, style, tag) {
1877
- if (tag !== 'h1' && tag !== 'h2') return [];
1878
- return checkItalicSerif({
1879
- tag,
1880
- fontStyle: style.fontStyle || '',
1881
- fontFamily: style.fontFamily || '',
1882
- fontSize: parseFloat(style.fontSize) || 0,
1883
- headingText: el.textContent || '',
1884
- });
1885
- }
1886
-
1887
- function checkElementHeroEyebrow(el, style, tag, window, customPropMap) {
1888
- if (tag !== 'h1') return [];
1889
- const sibling = el.previousElementSibling;
1890
- if (!sibling) return [];
1891
- const sibStyle = window.getComputedStyle(sibling);
1892
- // Resolve Tailwind v4 CSS-variable wrappers (font-weight:var(--font-weight-bold)
1893
- // etc.) before parsing. jsdom returns these verbatim from getComputedStyle;
1894
- // without resolution every style-based gate fails silently on Tailwind v4 builds.
1895
- const fontSizeRaw = customPropMap ? resolveVarRefs(sibStyle.fontSize, customPropMap) : sibStyle.fontSize;
1896
- const fontWeightRaw = customPropMap ? resolveVarRefs(sibStyle.fontWeight, customPropMap) : sibStyle.fontWeight;
1897
- const letterSpacingRaw = customPropMap ? resolveVarRefs(sibStyle.letterSpacing, customPropMap) : sibStyle.letterSpacing;
1898
- const colorRaw = customPropMap ? resolveVarRefs(sibStyle.color, customPropMap) : sibStyle.color;
1899
- const headingFontSizeRaw = customPropMap ? resolveVarRefs(style.fontSize, customPropMap) : style.fontSize;
1900
- const siblingFontSize = parseFloat(fontSizeRaw) || 0;
1901
- // resolveLengthPx returns null for 'normal' / 'auto'; coerce to 0 so the
1902
- // gate falls through cleanly. jsdom returns letter-spacing verbatim
1903
- // (e.g. '0.15em'), unlike real browsers, so this conversion is required.
1904
- return checkHeroEyebrow({
1905
- headingTag: tag,
1906
- headingText: el.textContent || '',
1907
- headingFontSize: parseFloat(headingFontSizeRaw) || 0,
1908
- siblingTag: sibling.tagName.toLowerCase(),
1909
- siblingText: sibling.textContent || '',
1910
- siblingTextTransform: sibStyle.textTransform || '',
1911
- siblingFontSize,
1912
- siblingLetterSpacing: resolveLengthPx(letterSpacingRaw, siblingFontSize) || 0,
1913
- siblingFontWeight: fontWeightRaw || '',
1914
- siblingColor: colorRaw || '',
1915
- });
1916
- }
1917
-
1918
- function checkRepeatedSectionKickersFromDoc(doc, win) {
1919
- const candidates = collectRepeatedSectionKickerCandidates(
1920
- doc,
1921
- (el) => win.getComputedStyle(el),
1922
- (value, fontSize) => resolveLengthPx(value, fontSize) || 0,
1923
- );
1924
- return checkRepeatedSectionKickers({ candidates });
1925
- }
1926
-
1927
- function checkElementMotion(tag, style) {
1928
- return checkMotion({
1929
- tag,
1930
- transitionProperty: style.transitionProperty || '',
1931
- animationName: style.animationName || '',
1932
- timingFunctions: [style.animationTimingFunction, style.transitionTimingFunction].filter(Boolean).join(' '),
1933
- classList: '',
1934
- });
1935
- }
1936
-
1937
- function checkElementGlow(tag, style, effectiveBg) {
1938
- if (!style.boxShadow || style.boxShadow === 'none') return [];
1939
- return checkGlow({ tag, boxShadow: style.boxShadow, effectiveBg });
1940
- }
1941
-
1942
- // ─── Section 6: Page-Level Checks ───────────────────────────────────────────
1943
-
1944
- // Browser page-level checks — use document/getComputedStyle globals
1945
-
1946
- function checkTypography() {
1947
- const findings = [];
1948
-
1949
- // Walk actual text-bearing elements and tally font usage by *computed style*.
1950
- // This is much more accurate than scanning CSS rules — it ignores rules that
1951
- // exist in the stylesheet but apply to nothing (e.g. demo classes showing
1952
- // anti-patterns), and counts what the user actually sees.
1953
- const fontUsage = new Map(); // primary font name → count of elements
1954
- let totalTextElements = 0;
1955
- for (const el of document.querySelectorAll('p, h1, h2, h3, h4, h5, h6, li, td, th, dd, blockquote, figcaption, a, button, label, span')) {
1956
- // Skip monodesign's own elements
1957
- if (el.closest && el.closest('.monodesign-overlay, .monodesign-label, .monodesign-banner, .monodesign-tooltip')) continue;
1958
- // Only count elements that actually have visible direct text
1959
- const hasText = [...el.childNodes].some(n => n.nodeType === 3 && n.textContent.trim().length > 0);
1960
- if (!hasText) continue;
1961
- const style = getComputedStyle(el);
1962
- const ff = style.fontFamily;
1963
- if (!ff) continue;
1964
- const stack = ff.split(',').map(f => f.trim().replace(/^['"]|['"]$/g, '').toLowerCase());
1965
- const primary = stack.find(f => f && !GENERIC_FONTS.has(f));
1966
- if (!primary) continue;
1967
- fontUsage.set(primary, (fontUsage.get(primary) || 0) + 1);
1968
- totalTextElements++;
1969
- }
1970
-
1971
- if (totalTextElements >= 20) {
1972
- // A font is "primary" if it's used by at least 15% of text elements
1973
- const PRIMARY_THRESHOLD = 0.15;
1974
- for (const [font, count] of fontUsage) {
1975
- const share = count / totalTextElements;
1976
- if (share < PRIMARY_THRESHOLD) continue;
1977
- if (!OVERUSED_FONTS.has(font)) continue;
1978
- if (isBrandFontOnOwnDomain(font)) continue;
1979
- findings.push({ type: 'overused-font', detail: `Primary font: ${font} (${Math.round(share * 100)}% of text)` });
1980
- }
1981
-
1982
- // Single-font check: only one distinct primary font across all text
1983
- if (fontUsage.size === 1) {
1984
- const only = [...fontUsage.keys()][0];
1985
- findings.push({ type: 'single-font', detail: `only font used is ${only}` });
1986
- }
1987
- }
1988
-
1989
- const sizes = new Set();
1990
- for (const el of document.querySelectorAll('h1,h2,h3,h4,h5,h6,p,span,a,li,td,th,label,button,div')) {
1991
- const fs = parseFloat(getComputedStyle(el).fontSize);
1992
- if (fs > 0 && fs < 200) sizes.add(Math.round(fs * 10) / 10);
1993
- }
1994
- if (sizes.size >= 3) {
1995
- const sorted = [...sizes].sort((a, b) => a - b);
1996
- const ratio = sorted[sorted.length - 1] / sorted[0];
1997
- if (ratio < 2.0) {
1998
- findings.push({ type: 'flat-type-hierarchy', detail: `Sizes: ${sorted.map(s => s + 'px').join(', ')} (ratio ${ratio.toFixed(1)}:1)` });
1999
- }
2000
- }
2001
-
2002
- return findings;
2003
- }
2004
-
2005
- function isCardLikeDOM(el) {
2006
- const tag = el.tagName.toLowerCase();
2007
- if (SAFE_TAGS.has(tag) || ['input','select','textarea','img','video','canvas','picture'].includes(tag)) return false;
2008
- const style = getComputedStyle(el);
2009
- const cls = el.getAttribute('class') || '';
2010
- const hasShadow = (style.boxShadow && style.boxShadow !== 'none') || /\bshadow(?:-sm|-md|-lg|-xl|-2xl)?\b/.test(cls);
2011
- const hasBorder = /\bborder\b/.test(cls);
2012
- const hasRadius = parseFloat(style.borderRadius) > 0 || /\brounded(?:-sm|-md|-lg|-xl|-2xl|-full)?\b/.test(cls);
2013
- const hasBg = (style.backgroundColor && style.backgroundColor !== 'rgba(0, 0, 0, 0)') || /\bbg-(?:white|gray-\d+|slate-\d+)\b/.test(cls);
2014
- return isCardLikeFromProps(hasShadow, hasBorder, hasRadius, hasBg);
2015
- }
2016
-
2017
- function checkLayout() {
2018
- const findings = [];
2019
- const flaggedEls = new Set();
2020
-
2021
- for (const el of document.querySelectorAll('*')) {
2022
- if (!isCardLikeDOM(el) || flaggedEls.has(el)) continue;
2023
- const cls = el.getAttribute('class') || '';
2024
- const style = getComputedStyle(el);
2025
- if (style.position === 'absolute' || style.position === 'fixed') continue;
2026
- if (/\b(?:dropdown|popover|tooltip|menu|modal|dialog)\b/i.test(cls)) continue;
2027
- if ((el.textContent?.trim().length || 0) < 10) continue;
2028
- const rect = el.getBoundingClientRect();
2029
- if (rect.width < 50 || rect.height < 30) continue;
2030
-
2031
- let parent = el.parentElement;
2032
- while (parent) {
2033
- if (isCardLikeDOM(parent)) { flaggedEls.add(el); break; }
2034
- parent = parent.parentElement;
2035
- }
2036
- }
2037
-
2038
- for (const el of flaggedEls) {
2039
- let isAncestor = false;
2040
- for (const other of flaggedEls) {
2041
- if (other !== el && el.contains(other)) { isAncestor = true; break; }
2042
- }
2043
- if (!isAncestor) findings.push({ type: 'nested-cards', detail: 'Card inside card', el });
2044
- }
2045
-
2046
- return findings;
2047
- }
2048
-
2049
- // Node page-level checks — take document/window as parameters
2050
-
2051
- function checkPageTypography(doc, win) {
2052
- const findings = [];
2053
-
2054
- const fonts = new Set();
2055
- const overusedFound = new Set();
2056
-
2057
- for (const sheet of doc.styleSheets) {
2058
- let rules;
2059
- try { rules = sheet.cssRules || sheet.rules; } catch { continue; }
2060
- if (!rules) continue;
2061
- for (const rule of rules) {
2062
- if (rule.type !== 1) continue;
2063
- const ff = rule.style?.fontFamily;
2064
- if (!ff) continue;
2065
- const stack = ff.split(',').map(f => f.trim().replace(/^['"]|['"]$/g, '').toLowerCase());
2066
- const primary = stack.find(f => f && !GENERIC_FONTS.has(f));
2067
- if (primary) {
2068
- fonts.add(primary);
2069
- if (OVERUSED_FONTS.has(primary)) overusedFound.add(primary);
2070
- }
2071
- }
2072
- }
2073
-
2074
- // Check Google Fonts links in HTML
2075
- const html = doc.documentElement?.outerHTML || '';
2076
- for (const f of extractGoogleFontFamilies(html)) {
2077
- fonts.add(f);
2078
- if (OVERUSED_FONTS.has(f)) overusedFound.add(f);
2079
- }
2080
-
2081
- // Also parse raw HTML/style content for font-family (jsdom may not expose all via CSSOM)
2082
- const ffRe = /font-family\s*:\s*([^;}]+)/gi;
2083
- let fm;
2084
- while ((fm = ffRe.exec(html)) !== null) {
2085
- for (const f of fm[1].split(',').map(f => f.trim().replace(/^['"]|['"]$/g, '').toLowerCase())) {
2086
- if (f && !GENERIC_FONTS.has(f)) {
2087
- fonts.add(f);
2088
- if (OVERUSED_FONTS.has(f)) overusedFound.add(f);
2089
- }
2090
- }
2091
- }
2092
-
2093
- for (const font of overusedFound) {
2094
- findings.push({ id: 'overused-font', snippet: `Primary font: ${font}` });
2095
- }
2096
-
2097
- // Single font
2098
- if (fonts.size === 1) {
2099
- const els = doc.querySelectorAll('*');
2100
- if (els.length >= 20) {
2101
- findings.push({ id: 'single-font', snippet: `only font used is ${[...fonts][0]}` });
2102
- }
2103
- }
2104
-
2105
- // Flat type hierarchy
2106
- const sizes = new Set();
2107
- const textEls = doc.querySelectorAll('h1, h2, h3, h4, h5, h6, p, span, a, li, td, th, label, button, div');
2108
- for (const el of textEls) {
2109
- const fontSize = parseFloat(win.getComputedStyle(el).fontSize);
2110
- // Filter out sub-8px values (jsdom doesn't resolve relative units properly)
2111
- if (fontSize >= 8 && fontSize < 200) sizes.add(Math.round(fontSize * 10) / 10);
2112
- }
2113
- if (sizes.size >= 3) {
2114
- const sorted = [...sizes].sort((a, b) => a - b);
2115
- const ratio = sorted[sorted.length - 1] / sorted[0];
2116
- if (ratio < 2.0) {
2117
- findings.push({ id: 'flat-type-hierarchy', snippet: `Sizes: ${sorted.map(s => s + 'px').join(', ')} (ratio ${ratio.toFixed(1)}:1)` });
2118
- }
2119
- }
2120
-
2121
- return findings;
2122
- }
2123
-
2124
- function isCardLike(el, win) {
2125
- const tag = el.tagName.toLowerCase();
2126
- if (SAFE_TAGS.has(tag) || ['input', 'select', 'textarea', 'img', 'video', 'canvas', 'picture'].includes(tag)) return false;
2127
-
2128
- const style = win.getComputedStyle(el);
2129
- const rawStyle = el.getAttribute?.('style') || '';
2130
- const cls = el.getAttribute?.('class') || '';
2131
-
2132
- const hasShadow = (style.boxShadow && style.boxShadow !== 'none') ||
2133
- /\bshadow(?:-sm|-md|-lg|-xl|-2xl)?\b/.test(cls) || /box-shadow/i.test(rawStyle);
2134
- const hasBorder = /\bborder\b/.test(cls);
2135
- const widthPx = parseFloat(style.width) || 0;
2136
- const hasRadius = resolveBorderRadiusPx(el, style, widthPx, win) > 0 ||
2137
- /\brounded(?:-sm|-md|-lg|-xl|-2xl|-full)?\b/.test(cls) || /border-radius/i.test(rawStyle);
2138
- const hasBg = /\bbg-(?:white|gray-\d+|slate-\d+)\b/.test(cls) ||
2139
- /background(?:-color)?\s*:\s*(?!transparent)/i.test(rawStyle);
2140
-
2141
- return isCardLikeFromProps(hasShadow, hasBorder, hasRadius, hasBg);
2142
- }
2143
-
2144
- function checkPageLayout(doc, win) {
2145
- const findings = [];
2146
-
2147
- // Nested cards
2148
- const allEls = doc.querySelectorAll('*');
2149
- const flaggedEls = new Set();
2150
- for (const el of allEls) {
2151
- if (!isCardLike(el, win)) continue;
2152
- if (flaggedEls.has(el)) continue;
2153
-
2154
- const tag = el.tagName.toLowerCase();
2155
- const cls = el.getAttribute?.('class') || '';
2156
- const rawStyle = el.getAttribute?.('style') || '';
2157
-
2158
- if (['pre', 'code'].includes(tag)) continue;
2159
- if (/\b(?:absolute|fixed)\b/.test(cls) || /position\s*:\s*(?:absolute|fixed)/i.test(rawStyle)) continue;
2160
- if ((el.textContent?.trim().length || 0) < 10) continue;
2161
- if (/\b(?:dropdown|popover|tooltip|menu|modal|dialog)\b/i.test(cls)) continue;
2162
-
2163
- // Walk up to find card-like ancestor
2164
- let parent = el.parentElement;
2165
- while (parent) {
2166
- if (isCardLike(parent, win)) {
2167
- flaggedEls.add(el);
2168
- break;
2169
- }
2170
- parent = parent.parentElement;
2171
- }
2172
- }
2173
-
2174
- // Only report innermost nested cards
2175
- for (const el of flaggedEls) {
2176
- let isAncestorOfFlagged = false;
2177
- for (const other of flaggedEls) {
2178
- if (other !== el && el.contains(other)) {
2179
- isAncestorOfFlagged = true;
2180
- break;
2181
- }
2182
- }
2183
- if (!isAncestorOfFlagged) {
2184
- findings.push({ id: 'nested-cards', snippet: `Card inside card (${el.tagName.toLowerCase()})` });
2185
- }
2186
- }
2187
-
2188
- return findings;
2189
- }
2190
-
2191
- // ─── Cream / beige palette (the default "tasteful" AI surface) ────────────────
2192
- // A warm, lightly-tinted off-white page background — light, with R≥G≥B and a
2193
- // small warm tint (not white, not a strong color). The current reflex surface.
2194
- function isCreamColor(rgb) {
2195
- if (!rgb) return false;
2196
- const { r, g, b } = rgb;
2197
- if (Math.min(r, g, b) < 209) return false; // must be light
2198
- if (!(r >= g && g >= b)) return false; // warm ordering
2199
- const warmth = r - b;
2200
- return warmth >= 6 && warmth <= 48; // tinted, not white, not strong
2201
- }
2202
-
2203
- // Tailwind background utilities that render as a warm off-white surface. The
2204
- // static engine doesn't fetch Tailwind's CSS, so a `bg-amber-50` on <body>
2205
- // resolves to nothing in computed style — catch it from the class list
2206
- // instead. Candidate tokens map to their actual Tailwind hex and are still
2207
- // filtered through isCreamColor, so neutral grays (stone) and over-saturated
2208
- // shades drop out on their own.
2209
- const TAILWIND_BG_HEX = {
2210
- 'bg-amber-50': '#fffbeb', 'bg-amber-100': '#fef3c7',
2211
- 'bg-orange-50': '#fff7ed', 'bg-orange-100': '#ffedd5',
2212
- 'bg-yellow-50': '#fefce8',
2213
- 'bg-stone-50': '#fafaf9', 'bg-stone-100': '#f5f5f4', 'bg-stone-200': '#e7e5e4',
2214
- };
2215
-
2216
- function creamFromClassList(cls) {
2217
- if (!cls) return null;
2218
- // Arbitrary value: bg-[#f5f0e6] / bg-[rgb(245_240_230)] (underscores = spaces).
2219
- const arb = cls.match(/\bbg-\[([^\]]+)\]/);
2220
- if (arb && isCreamColor(parseAnyColor(arb[1].replace(/_/g, ' ')))) return `bg-[${arb[1]}]`;
2221
- // Named warm-light utilities.
2222
- for (const [tok, hex] of Object.entries(TAILWIND_BG_HEX)) {
2223
- if (new RegExp(`(^|\\s)${tok}($|\\s)`).test(cls) && isCreamColor(parseAnyColor(hex))) return tok;
2224
- }
2225
- return null;
2226
- }
2227
-
2228
- function checkCreamPalette(doc, win) {
2229
- const findings = [];
2230
- const body = doc.body || (doc.querySelector ? doc.querySelector('body') : null);
2231
- if (!body) return findings;
2232
- const html = doc.documentElement;
2233
- const getCS = (el) => (win ? win.getComputedStyle(el) : getComputedStyle(el));
2234
-
2235
- // 1. Computed background — covers inline / <style> / linked CSS, and Tailwind
2236
- // once it's actually rendered (browser path).
2237
- let bg = readOwnBackgroundColor(body, getCS(body));
2238
- if (!bg || bg.a === 0) {
2239
- if (html) bg = readOwnBackgroundColor(html, getCS(html));
2240
- }
2241
- if (isCreamColor(bg)) {
2242
- findings.push({ id: 'cream-palette', snippet: `cream/beige page background rgb(${bg.r}, ${bg.g}, ${bg.b})` });
2243
- return findings;
2244
- }
2245
-
2246
- // 2. Tailwind class fallback — for the static path, where utility classes
2247
- // never resolve to computed CSS.
2248
- for (const el of [body, html]) {
2249
- const tok = creamFromClassList(el && el.getAttribute ? el.getAttribute('class') : '');
2250
- if (tok) {
2251
- findings.push({ id: 'cream-palette', snippet: `cream/beige page background (Tailwind ${tok})` });
2252
- break;
2253
- }
2254
- }
2255
- return findings;
2256
- }
2257
-
2258
- // ─── Oversized hero headline ────────────────────────────────────────────────
2259
- // Fires when a *long* headline is set at display size and actually dominates
2260
- // the viewport. A punchy one- or two-word headline at the same size is a
2261
- // legitimate stylistic choice, and a large-but-contained two-line hero should
2262
- // pass too — length and viewport share together are the tell.
2263
- const OVERSIZED_H1_FONT_PX = 72;
2264
- const OVERSIZED_H1_MIN_CHARS = 40;
2265
- const OVERSIZED_H1_MIN_VIEWPORT_HEIGHT_RATIO = 0.28;
2266
- const OVERSIZED_H1_MIN_VIEWPORT_AREA_RATIO = 0.25;
2267
- function checkOversizedH1({ tag, fontSize, headingText, rect = null, viewportWidth = 0, viewportHeight = 0 }) {
2268
- if (tag !== 'h1') return [];
2269
- const textLen = headingText.length;
2270
- if (fontSize >= OVERSIZED_H1_FONT_PX && textLen >= OVERSIZED_H1_MIN_CHARS) {
2271
- let viewportDetail = '';
2272
- if (rect && viewportWidth > 0 && viewportHeight > 0) {
2273
- const heightRatio = rect.height / viewportHeight;
2274
- const areaRatio = (rect.width * rect.height) / (viewportWidth * viewportHeight);
2275
- const dominatesViewport = heightRatio >= OVERSIZED_H1_MIN_VIEWPORT_HEIGHT_RATIO
2276
- || areaRatio >= OVERSIZED_H1_MIN_VIEWPORT_AREA_RATIO;
2277
- if (!dominatesViewport) return [];
2278
- viewportDetail = `, ${Math.round(heightRatio * 100)}vh`;
2279
- }
2280
- return [{ id: 'oversized-h1', snippet: `${Math.round(fontSize)}px h1, ${textLen} chars${viewportDetail} "${headingText.slice(0, 60)}"` }];
2281
- }
2282
- return [];
2283
- }
2284
-
2285
- function checkElementOversizedH1(el, style, tag, window) {
2286
- if (tag !== 'h1') return [];
2287
- const fontSize = resolveFontSizePx(el, window);
2288
- const headingText = (el.textContent || '').trim().replace(/\s+/g, ' ');
2289
- return checkOversizedH1({ tag, fontSize, headingText });
2290
- }
2291
-
2292
- function checkElementOversizedH1DOM(el) {
2293
- const tag = el.tagName.toLowerCase();
2294
- if (tag !== 'h1') return [];
2295
- const style = getComputedStyle(el);
2296
- const fontSize = parseFloat(style.fontSize) || 0;
2297
- const headingText = (el.textContent || '').trim().replace(/\s+/g, ' ');
2298
- const rect = el.getBoundingClientRect();
2299
- const viewportWidth = (typeof window !== 'undefined' ? window.innerWidth : 0) || 0;
2300
- const viewportHeight = (typeof window !== 'undefined' ? window.innerHeight : 0) || 0;
2301
- return checkOversizedH1({ tag, fontSize, headingText, rect, viewportWidth, viewportHeight });
2302
- }
2303
-
2304
- // ─── GPT tell: hairline border + wide diffuse shadow (gated --gpt) ────────────
2305
- const CSS_COLOR_TOKEN_RE = /(?:rgba?|hsla?|oklch|oklab|lab|lch|color)\([^)]*\)|#[0-9a-fA-F]{3,8}\b|\b(?:black|white|transparent|currentcolor)\b/gi;
2306
-
2307
- function shadowLayerAlpha(layer) {
2308
- CSS_COLOR_TOKEN_RE.lastIndex = 0;
2309
- const match = CSS_COLOR_TOKEN_RE.exec(layer);
2310
- if (!match) return 1;
2311
- if (match[0].toLowerCase() === 'transparent') return 0;
2312
- const parsed = parseAnyColor(match[0]);
2313
- return parsed ? (parsed.a ?? 1) : 1;
2314
- }
2315
-
2316
- function shadowMaxBlurPx(boxShadow, { minAlpha = 0 } = {}) {
2317
- if (!boxShadow || boxShadow === 'none') return 0;
2318
- let maxBlur = 0;
2319
- // Split into layers on commas not inside parentheses (rgba(...) etc.).
2320
- for (const layer of boxShadow.split(/,(?![^()]*\))/)) {
2321
- if (shadowLayerAlpha(layer) < minAlpha) continue;
2322
- // Strip colors and keywords (rgba()/hsl()/hex/named/inset/px), leaving the
2323
- // ordered length tokens: offsetX offsetY blur [spread]. Static jsdom keeps
2324
- // unitless zeros ("0 0 24px"); browsers normalize to px ("0px 0px 24px") —
2325
- // both reduce to the same numbers here.
2326
- const cleaned = layer.replace(CSS_COLOR_TOKEN_RE, ' ').replace(/\b[a-z]+\b/gi, ' ');
2327
- const nums = [...cleaned.matchAll(/-?\d*\.?\d+/g)].map(m => parseFloat(m[0]));
2328
- if (nums.length >= 3) maxBlur = Math.max(maxBlur, nums[2]);
2329
- }
2330
- return maxBlur;
2331
- }
2332
-
2333
- function cssColorAlpha(value) {
2334
- if (cssColorIsTransparent(value)) return 0;
2335
- const parsed = parseAnyColor(value);
2336
- return parsed ? (parsed.a ?? 1) : 1;
2337
- }
2338
-
2339
- function checkGptThinBorderWideShadow({ borderWidths, borderColors, boxShadow }) {
2340
- const visibleThinBorders = borderWidths
2341
- .map((width, index) => ({ width, alpha: cssColorAlpha(borderColors?.[index] || '') }))
2342
- .filter(({ width, alpha }) => width > 0 && width <= 1.5 && alpha >= 0.28);
2343
- const maxBorder = Math.max(0, ...visibleThinBorders.map(({ width }) => width));
2344
- const blur = shadowMaxBlurPx(boxShadow, { minAlpha: 0.12 });
2345
- if (visibleThinBorders.length >= 2 && blur >= 16) {
2346
- return [{ id: 'gpt-thin-border-wide-shadow', snippet: `${maxBorder}px border + ${Math.round(blur)}px shadow blur` }];
2347
- }
2348
- return [];
2349
- }
2350
-
2351
- function borderWidthsFromStyle(style) {
2352
- return [
2353
- parseFloat(style.borderTopWidth) || 0,
2354
- parseFloat(style.borderRightWidth) || 0,
2355
- parseFloat(style.borderBottomWidth) || 0,
2356
- parseFloat(style.borderLeftWidth) || 0,
2357
- ];
2358
- }
2359
-
2360
- function borderColorsFromStyle(style) {
2361
- return [
2362
- style.borderTopColor || '',
2363
- style.borderRightColor || '',
2364
- style.borderBottomColor || '',
2365
- style.borderLeftColor || '',
2366
- ];
2367
- }
2368
-
2369
- function checkElementGptBorderShadow(el, style) {
2370
- return checkGptThinBorderWideShadow({ borderWidths: borderWidthsFromStyle(style), borderColors: borderColorsFromStyle(style), boxShadow: style.boxShadow || '' });
2371
- }
2372
-
2373
- function checkElementGptBorderShadowDOM(el) {
2374
- const style = getComputedStyle(el);
2375
- return checkGptThinBorderWideShadow({ borderWidths: borderWidthsFromStyle(style), borderColors: borderColorsFromStyle(style), boxShadow: style.boxShadow || '' });
2376
- }
2377
-
2378
- // ─── Clipped overflow container ───────────────────────────────────────────────
2379
- // A clipping container (overflow hidden/clip, not a scroll region) wrapping an
2380
- // absolutely/fixed-positioned descendant clips popovers/menus that must escape.
2381
- function classSelector(el) {
2382
- const cls = (el.getAttribute ? el.getAttribute('class') : el.className) || '';
2383
- const tokens = String(cls).trim().split(/\s+/).filter(Boolean);
2384
- const tag = el.tagName ? el.tagName.toLowerCase() : 'el';
2385
- return tokens.length ? `${tag}.${tokens.join('.')}` : tag;
2386
- }
2387
-
2388
- function positionedChildIsDecorative(child) {
2389
- if (!child || typeof child.getAttribute !== 'function') return false;
2390
- if (child.closest?.('[aria-hidden="true"]')) return true;
2391
- const role = (child.getAttribute('role') || '').toLowerCase();
2392
- if (role === 'none' || role === 'presentation') return true;
2393
- const tag = child.tagName ? child.tagName.toLowerCase() : '';
2394
- if (['img', 'svg', 'canvas', 'video'].includes(tag)) return true;
2395
- const ident = `${child.getAttribute('class') || ''} ${child.getAttribute('id') || ''}`;
2396
- if (
2397
- /\b(art|bg|background|badge|blob|crop|decor|dot|glow|grain|image|mask|ornament|overlay|photo|scrim|shadow|shine|texture)\b/i.test(ident) &&
2398
- !positionedChildHasSubstantiveContent(child)
2399
- ) {
2400
- return true;
2401
- }
2402
- return false;
2403
- }
2404
-
2405
- const POSITIONED_CHILD_INTERACTIVE_SELECTOR = [
2406
- 'a[href]',
2407
- 'button',
2408
- 'input',
2409
- 'select',
2410
- 'summary',
2411
- 'textarea',
2412
- '[tabindex]:not([tabindex="-1"])',
2413
- '[role="button"]',
2414
- '[role="dialog"]',
2415
- '[role="link"]',
2416
- '[role="listbox"]',
2417
- '[role="menu"]',
2418
- '[role="menuitem"]',
2419
- '[role="option"]',
2420
- '[role="tooltip"]',
2421
- ].join(',');
2422
-
2423
- function positionedChildHasSubstantiveContent(child) {
2424
- const text = (child.textContent || '').replace(/\s+/g, ' ').trim();
2425
- if (text.length > 0) return true;
2426
- if (typeof child.matches === 'function') {
2427
- try {
2428
- if (child.matches(POSITIONED_CHILD_INTERACTIVE_SELECTOR)) return true;
2429
- } catch {}
2430
- }
2431
- if (typeof child.querySelector === 'function') {
2432
- try {
2433
- if (child.querySelector(POSITIONED_CHILD_INTERACTIVE_SELECTOR)) return true;
2434
- } catch {}
2435
- }
2436
- return false;
2437
- }
2438
-
2439
- function clippingContainerIsIntentionalViewport(el) {
2440
- if (!el || typeof el.getAttribute !== 'function') return false;
2441
- const roleDescription = (el.getAttribute('aria-roledescription') || '').toLowerCase();
2442
- if (/\b(carousel|slider)\b/.test(roleDescription)) return true;
2443
- const ident = `${el.getAttribute('class') || ''} ${el.getAttribute('id') || ''}`.toLowerCase();
2444
- return /\b(carousel|comparison|compare|fisheye|marquee|preview|scroller|slider|slideshow|split|viewport)\b/.test(ident) ||
2445
- /\b(demo-area|demo-stage|demo-viewport)\b/.test(ident);
2446
- }
2447
-
2448
- function elementRect(el) {
2449
- if (!el || typeof el.getBoundingClientRect !== 'function') return null;
2450
- try {
2451
- const rect = el.getBoundingClientRect();
2452
- if (!rect) return null;
2453
- const values = [rect.top, rect.right, rect.bottom, rect.left, rect.width, rect.height];
2454
- if (!values.every(Number.isFinite)) return null;
2455
- if (rect.width <= 0 && rect.height <= 0) return null;
2456
- return rect;
2457
- } catch {
2458
- return null;
2459
- }
2460
- }
2461
-
2462
- function positionedStyleImpliesEscape(style) {
2463
- const values = [
2464
- style.top,
2465
- style.right,
2466
- style.bottom,
2467
- style.left,
2468
- style.inset,
2469
- style.insetBlock,
2470
- style.insetInline,
2471
- style.insetBlockStart,
2472
- style.insetBlockEnd,
2473
- style.insetInlineStart,
2474
- style.insetInlineEnd,
2475
- ].filter(Boolean).map(value => String(value).trim().toLowerCase());
2476
- for (const value of values) {
2477
- if (/(^|[\s(])-+(?:\d|\.)/.test(value)) return true;
2478
- if (/(^|[\s(])100(?:\.0+)?%/.test(value)) return true;
2479
- }
2480
- return false;
2481
- }
2482
-
2483
- function positionedChildEscapesClip(el, child, clipX, clipY) {
2484
- const parentRect = elementRect(el);
2485
- const childRect = elementRect(child);
2486
- if (!parentRect || !childRect) return null;
2487
- const threshold = 2;
2488
- return Boolean(
2489
- (clipX && (childRect.left < parentRect.left - threshold || childRect.right > parentRect.right + threshold)) ||
2490
- (clipY && (childRect.top < parentRect.top - threshold || childRect.bottom > parentRect.bottom + threshold))
2491
- );
2492
- }
2493
-
2494
- function checkClippedOverflow(el, style, getStyle) {
2495
- const clips = (v) => v === 'hidden' || v === 'clip';
2496
- const scrolls = (v) => v === 'auto' || v === 'scroll';
2497
- const ox = style.overflowX || '', oy = style.overflowY || '', ov = style.overflow || '';
2498
- const clipX = clips(ox) || clips(ov);
2499
- const clipY = clips(oy) || clips(ov);
2500
- const anyClip = clipX || clipY;
2501
- const anyScroll = scrolls(ox) || scrolls(oy) || scrolls(ov);
2502
- if (!anyClip || anyScroll) return [];
2503
- if (clippingContainerIsIntentionalViewport(el)) return [];
2504
- if (!el.querySelectorAll) return [];
2505
- for (const child of el.querySelectorAll('*')) {
2506
- const childStyle = getStyle(child);
2507
- const pos = childStyle.position || '';
2508
- if (pos === 'absolute' || pos === 'fixed') {
2509
- if (positionedChildIsDecorative(child)) continue;
2510
- const escapes = positionedChildEscapesClip(el, child, clipX, clipY);
2511
- if (escapes === false) continue;
2512
- if (escapes === null && !positionedStyleImpliesEscape(childStyle)) continue;
2513
- return [{ id: 'clipped-overflow-container', snippet: `${classSelector(el)} clips a positioned child` }];
2514
- }
2515
- }
2516
- return [];
2517
- }
2518
-
2519
- function checkElementClippedOverflow(el, style, tag, window) {
2520
- return checkClippedOverflow(el, style, (n) => window.getComputedStyle(n));
2521
- }
2522
-
2523
- function checkElementClippedOverflowDOM(el) {
2524
- const style = getComputedStyle(el);
2525
- return checkClippedOverflow(el, style, (n) => getComputedStyle(n));
2526
- }
2527
-
2528
- // ─── Text overflow (browser-only: needs scrollWidth/clientWidth) ──────────────
2529
- const TEXT_OVERFLOW_SKIP_TAGS = new Set(['pre', 'code', 'textarea', 'svg', 'canvas', 'select', 'option', 'marquee']);
2530
-
2531
- function metricLengthPx(value, fontSizePx = 16) {
2532
- if (typeof value === 'number' && Number.isFinite(value)) return value;
2533
- if (typeof value !== 'string') return null;
2534
- return resolveLengthPx(value, fontSizePx);
2535
- }
2536
-
2537
- function firstMetricLengthPx(fontSizePx, ...values) {
2538
- for (const value of values) {
2539
- const parsed = metricLengthPx(value, fontSizePx);
2540
- if (parsed !== null) return parsed;
2541
- }
2542
- return null;
2543
- }
2544
-
2545
- function expandBoxShorthand(parts) {
2546
- if (parts.length === 1) return [parts[0], parts[0], parts[0], parts[0]];
2547
- if (parts.length === 2) return [parts[0], parts[1], parts[0], parts[1]];
2548
- if (parts.length === 3) return [parts[0], parts[1], parts[2], parts[1]];
2549
- return [parts[0], parts[1], parts[2], parts[3]];
2550
- }
2551
-
2552
- function clippedByInset(clipPath) {
2553
- const match = String(clipPath || '').trim().toLowerCase().match(/^inset\s*\(([^)]*)\)$/);
2554
- if (!match) return false;
2555
- const beforeRound = match[1].split(/\s+round\s+/)[0].trim();
2556
- if (!beforeRound) return false;
2557
- const values = expandBoxShorthand(beforeRound.split(/\s+/).slice(0, 4));
2558
- const percents = values.map(value => String(value).trim().match(/^(-?\d+(?:\.\d+)?)%$/));
2559
- if (percents.some(match => !match)) return false;
2560
- const [top, right, bottom, left] = percents.map(match => parseFloat(match[1]));
2561
- return top + bottom >= 100 || left + right >= 100;
2562
- }
2563
-
2564
- function clippedByRect(clip) {
2565
- const match = String(clip || '').trim().toLowerCase().match(/^rect\s*\(([^)]*)\)$/);
2566
- if (!match) return false;
2567
- const values = match[1].split(/[,\s]+/).map(value => value.trim()).filter(Boolean);
2568
- if (values.length !== 4) return false;
2569
- const [top, right, bottom, left] = values.map(value => metricLengthPx(value, 16));
2570
- if ([top, right, bottom, left].some(value => value === null)) return false;
2571
- return bottom <= top || right <= left;
2572
- }
2573
-
2574
- function isScreenReaderOnlyTextStyle(style, metrics = {}) {
2575
- if (!style) return false;
2576
- const overflowValues = [style.overflow, style.overflowX, style.overflowY]
2577
- .map(value => String(value || '').toLowerCase());
2578
- const clipsOverflow = overflowValues.some(value => value === 'hidden' || value === 'clip');
2579
-
2580
- const fontSize = metricLengthPx(style.fontSize, 16) || 16;
2581
- const width = firstMetricLengthPx(fontSize, metrics.width, metrics.clientWidth, style.width, style.inlineSize);
2582
- const height = firstMetricLengthPx(fontSize, metrics.height, metrics.clientHeight, style.height, style.blockSize);
2583
- const isTiny = width !== null && height !== null && width <= 2 && height <= 2;
2584
- const isAbsolutelyHidden = String(style.position || '').toLowerCase() === 'absolute' && isTiny && clipsOverflow;
2585
-
2586
- const clipPath = String(style.clipPath || style.webkitClipPath || '').trim();
2587
- const clip = String(style.clip || '').trim();
2588
- return isAbsolutelyHidden || clippedByInset(clipPath) || clippedByRect(clip);
2589
- }
2590
-
2591
- function isRenderedForBrowserRule(el) {
2592
- for (let cur = el; cur && cur.nodeType === 1; cur = cur.parentElement) {
2593
- if (cur.getAttribute?.('aria-hidden') === 'true') return false;
2594
- const style = getComputedStyle(cur);
2595
- const visibility = String(style.visibility || '').toLowerCase();
2596
- if (style.display === 'none' || visibility === 'hidden' || visibility === 'collapse') return false;
2597
- if ((parseFloat(style.opacity) || 0) <= 0.01) return false;
2598
- if (String(style.contentVisibility || '').toLowerCase() === 'hidden') return false;
2599
- }
2600
- return true;
2601
- }
2602
-
2603
- function checkElementTextOverflowDOM(el) {
2604
- const tag = el.tagName.toLowerCase();
2605
- if (TEXT_OVERFLOW_SKIP_TAGS.has(tag)) return [];
2606
- if (!isRenderedForBrowserRule(el)) return [];
2607
- // Only the element that actually owns overflowing text — not its ancestors,
2608
- // which inherit a wider scrollWidth from the spilling descendant.
2609
- const hasDirectText = [...el.childNodes].some(n => n.nodeType === 3 && n.textContent.trim().length > 0);
2610
- if (!hasDirectText) return [];
2611
- const style = getComputedStyle(el);
2612
- const rect = el.getBoundingClientRect ? el.getBoundingClientRect() : null;
2613
- if (isScreenReaderOnlyTextStyle(style, {
2614
- width: rect?.width,
2615
- height: rect?.height,
2616
- clientWidth: el.clientWidth,
2617
- clientHeight: el.clientHeight,
2618
- })) return [];
2619
- const isScrollRegion = (s) => /(auto|scroll)/.test(s.overflowX || '') || /(auto|scroll)/.test(s.overflow || '');
2620
- if (isScrollRegion(style)) return [];
2621
- // A scrollable ancestor means this overflow is intentional and scrollable.
2622
- for (let p = el.parentElement; p; p = p.parentElement) {
2623
- if (isScrollRegion(getComputedStyle(p))) return [];
2624
- }
2625
- const delta = el.scrollWidth - el.clientWidth;
2626
- if (el.clientWidth > 0 && delta >= 16) {
2627
- return [{ id: 'text-overflow', snippet: `${classSelector(el)} overflows its box by ${Math.round(delta)}px` }];
2628
- }
2629
- return [];
2630
- }
2631
-
2632
- // ─── Section 7: Stylesheet-level accessibility rules ─────────────────────────
2633
- // These operate on raw CSS text (concatenated <style> blocks + linked sheets),
2634
- // not per-element computed style — because :hover / :focus-visible / @media
2635
- // conditions can't be read off a resting element. Shared by the regex, static
2636
- // and browser engines (each hands over its own CSS text).
2637
-
2638
- // Parse flat CSS into { selector, body, dark } tuples, tracking one level of
2639
- // dark-scheme context (a `@media (prefers-color-scheme: dark)` ancestor).
2640
- // @supports / @layer / @container / @scope are transparently descended.
2641
- // @font-face / @keyframes and other at-rules are skipped.
2642
- function collectCssRules(css, dark = false, depth = 0) {
2643
- const out = [];
2644
- if (!css || depth > 6) return out;
2645
- const src = css.replace(/\/\*[\s\S]*?\*\//g, '');
2646
- let i = 0;
2647
- while (i < src.length) {
2648
- const braceStart = src.indexOf('{', i);
2649
- if (braceStart === -1) break;
2650
- const prelude = src.slice(i, braceStart).trim();
2651
- let d = 1, j = braceStart + 1;
2652
- for (; j < src.length; j++) {
2653
- if (src[j] === '{') d++;
2654
- else if (src[j] === '}') { d--; if (d === 0) break; }
2655
- }
2656
- const body = src.slice(braceStart + 1, j);
2657
- i = j + 1;
2658
- if (!prelude) continue;
2659
- if (prelude.startsWith('@')) {
2660
- const atName = prelude.slice(1).split(/[\s(]/)[0].toLowerCase();
2661
- if (['media', 'supports', 'layer', 'container', 'scope'].includes(atName)) {
2662
- const isDarkMedia = atName === 'media' && /prefers-color-scheme\s*:\s*dark/i.test(prelude);
2663
- out.push(...collectCssRules(body, dark || isDarkMedia, depth + 1));
2664
- }
2665
- continue;
2666
- }
2667
- for (const sel of prelude.split(',').map(s => s.trim()).filter(Boolean)) {
2668
- out.push({ selector: sel, body, dark });
2669
- }
2670
- }
2671
- return out;
2672
- }
2673
-
2674
- // --- missing-focus-visible ---
2675
- function selectorTargetsInteractive(sel) {
2676
- return /(^|[\s>+~(,])(a|button|input|select|textarea|summary)(\b|[.:#[])/i.test(sel)
2677
- || /:focus\b/i.test(sel)
2678
- || /\[role\s*=\s*["']?button["']?\]/i.test(sel);
2679
- }
2680
-
2681
- function checkFocusVisible(cssText) {
2682
- if (!cssText) return [];
2683
- const rules = collectCssRules(cssText);
2684
- let suppressor = null;
2685
- let hasFocusVisible = false;
2686
- let hasFocusReplacement = false;
2687
- for (const r of rules) {
2688
- const sel = r.selector.toLowerCase();
2689
- const body = r.body.toLowerCase();
2690
- if (/:focus-visible/.test(sel)) {
2691
- // Any :focus-visible styling counts as deliberate focus handling.
2692
- hasFocusVisible = true;
2693
- }
2694
- const suppresses = /outline\s*:\s*(none|0(?:px)?)\b/.test(body)
2695
- || /outline-style\s*:\s*none/.test(body)
2696
- || /outline-width\s*:\s*0(?:px)?\b/.test(body);
2697
- if (suppresses && selectorTargetsInteractive(sel) && !/:focus-visible/.test(sel)) {
2698
- suppressor = suppressor || r;
2699
- }
2700
- // A plain :focus rule that draws a visible affordance is a valid fallback.
2701
- if (/:focus\b/.test(sel) && !/:focus-visible/.test(sel)) {
2702
- const olVal = /outline\s*:\s*([^;}]+)/.exec(body);
2703
- const outlineReplaces = olVal && !/^\s*(none|0(?:px)?|inherit|initial|unset)\s*$/.test(olVal[1]);
2704
- if (/box-shadow\s*:/.test(body)
2705
- || outlineReplaces
2706
- || /outline-(?:color|width|style)\s*:\s*(?!none|0(?:px)?\b)/.test(body)
2707
- || /border(?:-\w+)?(?:-color)?\s*:/.test(body)) {
2708
- hasFocusReplacement = true;
2709
- }
2710
- }
2711
- }
2712
- if (suppressor && !hasFocusVisible && !hasFocusReplacement) {
2713
- return [{ id: 'missing-focus-visible', snippet: `"${suppressor.selector}" removes outline with no :focus-visible replacement` }];
2714
- }
2715
- return [];
2716
- }
2717
-
2718
- // --- hover-only-affordance ---
2719
- function lastCompound(sel) {
2720
- const parts = sel.split(/\s*[>+~]\s*|\s+/).filter(Boolean);
2721
- const last = parts[parts.length - 1] || sel;
2722
- return last.replace(/:{1,2}[a-z-]+(\([^)]*\))?/gi, '').trim().toLowerCase();
2723
- }
2724
- function bodyRevealsVisible(body) {
2725
- const b = body.toLowerCase();
2726
- if (/display\s*:\s*(block|flex|grid|inline(?:-\w+)?|table|list-item)/.test(b)) return true;
2727
- if (/visibility\s*:\s*visible/.test(b)) return true;
2728
- if (/opacity\s*:\s*(?:1(?:\.0+)?|0?\.[1-9]\d*|\.\d*[1-9])\b/.test(b)) return true;
2729
- return false;
2730
- }
2731
- function bodyHidesByDefault(body) {
2732
- const b = body.toLowerCase();
2733
- return /display\s*:\s*none/.test(b)
2734
- || /visibility\s*:\s*hidden/.test(b)
2735
- || /opacity\s*:\s*0(?:\.0+)?\b/.test(b);
2736
- }
2737
- function checkHoverOnlyAffordance(cssText) {
2738
- if (!cssText) return [];
2739
- const rules = collectCssRules(cssText);
2740
- const focusTargets = new Set();
2741
- const hiddenTargets = new Set();
2742
- for (const r of rules) {
2743
- const sel = r.selector;
2744
- if (/:(focus|focus-within|focus-visible|active)\b/i.test(sel) && bodyRevealsVisible(r.body)) {
2745
- focusTargets.add(lastCompound(sel));
2746
- }
2747
- if (!/:hover\b/i.test(sel) && bodyHidesByDefault(r.body)) {
2748
- hiddenTargets.add(lastCompound(sel));
2749
- }
2750
- }
2751
- const findings = [];
2752
- const seen = new Set();
2753
- for (const r of rules) {
2754
- const sel = r.selector;
2755
- if (!/:hover\b/i.test(sel)) continue;
2756
- if (!bodyRevealsVisible(r.body)) continue;
2757
- const parts = sel.split(/\s*[>+~]\s*|\s+/).filter(Boolean);
2758
- if (parts.length < 2) continue; // hover on the subject itself — can't hide+reveal
2759
- if (/:hover\b/i.test(parts[parts.length - 1])) continue; // :hover is on the revealed subject
2760
- const target = lastCompound(sel);
2761
- if (!target || !hiddenTargets.has(target)) continue;
2762
- if (focusTargets.has(target)) continue;
2763
- if (seen.has(target)) continue;
2764
- seen.add(target);
2765
- findings.push({ id: 'hover-only-affordance', snippet: `"${target}" is revealed on :hover with no focus/active equivalent` });
2766
- }
2767
- return findings;
2768
- }
2769
-
2770
- // --- dark-scheme-contrast-blindspot ---
2771
- const DARK_SCOPE_RE = /(?:^|[\s>+~(,])(?:html|:root|body)?(?:\.dark|\.theme-dark|\.dark-mode)\b|\[data-theme\s*[~|]?=\s*["']?dark["']?\]|\[data-mode\s*=\s*["']?dark["']?\]|\[data-color-scheme\s*=\s*["']?dark["']?\]/i;
2772
- function stripDarkScope(sel) {
2773
- return sel
2774
- .replace(/(?:html|:root|body)?(?:\.dark|\.theme-dark|\.dark-mode)\b/gi, '')
2775
- .replace(/\[data-(?:theme|mode|color-scheme)\s*[~|]?=\s*["']?dark["']?\]/gi, '')
2776
- .replace(/\s*[>+~]\s*/g, ' ')
2777
- .replace(/\s+/g, ' ')
2778
- .trim();
2779
- }
2780
- function normalizeSelKey(sel) {
2781
- return sel.replace(/\s*[>+~]\s*/g, ' ').replace(/\s+/g, ' ').trim().toLowerCase();
2782
- }
2783
- function declHasColor(body) { return /(?:^|[;{\s])color\s*:/i.test(body); }
2784
- function declHasBg(body) { return /(?:^|[;{\s])background(?:-color)?\s*:/i.test(body); }
2785
- function checkDarkSchemeContrast(cssText) {
2786
- if (!cssText) return [];
2787
- const rules = collectCssRules(cssText);
2788
- const hasDarkMedia = /@media[^{]*prefers-color-scheme\s*:\s*dark/i.test(cssText);
2789
- const hasDarkSelectors = rules.some(r => DARK_SCOPE_RE.test(r.selector));
2790
- if (!hasDarkMedia && !hasDarkSelectors) return [];
2791
-
2792
- const light = new Map(); // base selector → { color, bg }
2793
- const darkAgg = new Map();
2794
- for (const r of rules) {
2795
- const scopedDark = DARK_SCOPE_RE.test(r.selector);
2796
- const isDark = r.dark || scopedDark;
2797
- if (isDark) {
2798
- const base = normalizeSelKey(scopedDark ? stripDarkScope(r.selector) : r.selector);
2799
- if (!base) continue;
2800
- const e = darkAgg.get(base) || { color: false, bg: false };
2801
- if (declHasColor(r.body)) e.color = true;
2802
- if (declHasBg(r.body)) e.bg = true;
2803
- darkAgg.set(base, e);
2804
- } else {
2805
- const base = normalizeSelKey(r.selector);
2806
- if (!base) continue;
2807
- const e = light.get(base) || { color: false, bg: false };
2808
- if (declHasColor(r.body)) e.color = true;
2809
- if (declHasBg(r.body)) e.bg = true;
2810
- light.set(base, e);
2811
- }
2812
- }
2813
-
2814
- const findings = [];
2815
- for (const [base, d] of darkAgg) {
2816
- if (d.color === d.bg) continue; // sets both or neither — not a split pair
2817
- const lp = light.get(base);
2818
- if (!lp || !(lp.color && lp.bg)) continue; // light scheme must pair both
2819
- const changed = d.bg ? 'background' : 'text color';
2820
- const missing = d.bg ? 'text color' : 'background';
2821
- findings.push({ id: 'dark-scheme-contrast-blindspot', snippet: `"${base}" overrides ${changed} in dark scheme but not ${missing}` });
2822
- }
2823
- return findings;
2824
- }
2825
-
2826
- // --- image-missing-dimensions ---
2827
- function checkImageDimensions({ hasWidthAttr, hasHeightAttr, style }) {
2828
- const s = String(style || '').toLowerCase();
2829
- if (hasWidthAttr && hasHeightAttr) return [];
2830
- if (/aspect-?ratio\s*:/.test(s)) return [];
2831
- const heightM = /(?:^|[;{\s])height\s*:\s*([^;]+)/.exec(s);
2832
- if (heightM && !/^\s*(auto|inherit|initial|unset|0(?:px)?)\s*$/.test(heightM[1])) return [];
2833
- return [{ id: 'image-missing-dimensions', snippet: '<img> without width/height attributes or CSS aspect-ratio (layout shift risk)' }];
2834
- }
2835
-
2836
- function checkElementImageDimensions(el, style) {
2837
- const hasWidthAttr = (el.getAttribute?.('width') ?? el.attribs?.width) != null;
2838
- const hasHeightAttr = (el.getAttribute?.('height') ?? el.attribs?.height) != null;
2839
- const parts = [el.getAttribute?.('style') || el.attribs?.style || ''];
2840
- const ar = style && (style.aspectRatio || style['aspect-ratio']);
2841
- if (ar && ar !== 'auto') parts.push(`aspect-ratio:${ar}`);
2842
- const h = style && style.height;
2843
- if (h && h !== 'auto' && h !== '') parts.push(`height:${h}`);
2844
- return checkImageDimensions({ hasWidthAttr, hasHeightAttr, style: parts.join(';') });
2845
- }
2846
-
2847
- function checkElementImageDimensionsDOM(el) {
2848
- // Only <img> can have this problem. The static engine gets this for free —
2849
- // it registers the rule with `selector: 'img'` (engines/static-html/
2850
- // detect-html.mjs) — but the DOM walker calls every check against every
2851
- // element, so the tag filter has to live here. Without it this rule fired on
2852
- // <head>, <meta>, <title> and <style>: a clean 84-line fixture reported 43
2853
- // findings, all of them "an <img> ships without width and height".
2854
- if (el.tagName !== 'IMG') return [];
2855
- const hasWidthAttr = el.getAttribute('width') != null;
2856
- const hasHeightAttr = el.getAttribute('height') != null;
2857
- // Browser computed `height` always resolves to a used px value after layout,
2858
- // so it can't tell a reserved height from a rendered one — only use inline
2859
- // style + the computed aspect-ratio (which stays 'auto' unless authored).
2860
- const parts = [el.getAttribute('style') || ''];
2861
- const style = getComputedStyle(el);
2862
- const ar = style.aspectRatio || '';
2863
- if (ar && ar !== 'auto') parts.push(`aspect-ratio:${ar}`);
2864
- return checkImageDimensions({ hasWidthAttr, hasHeightAttr, style: parts.join(';') });
2865
- }
2866
-
2867
- // --- small-touch-target ---
2868
- const CLICKABLE_INPUT_TYPES = new Set(['button', 'submit', 'reset', 'checkbox', 'radio', 'image']);
2869
- const CLICKABLE_ROLES = new Set(['button', 'link', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'tab', 'switch', 'checkbox', 'radio', 'option']);
2870
- function isClickableControl(tag, role, href, inputType) {
2871
- if (tag === 'button' || tag === 'select' || tag === 'summary') return true;
2872
- if (tag === 'a') return href != null && href !== '';
2873
- if (tag === 'input') return CLICKABLE_INPUT_TYPES.has(String(inputType || '').toLowerCase());
2874
- if (role && CLICKABLE_ROLES.has(role)) return true;
2875
- return false;
2876
- }
2877
- function checkSmallTouchTarget({ tag, role, href, inputType, widthPx, heightPx, isInlineLinkInProse }) {
2878
- if (!isClickableControl(tag, role, href, inputType)) return [];
2879
- if (isInlineLinkInProse) return [];
2880
- if (!(widthPx > 0) || !(heightPx > 0)) return [];
2881
- if (widthPx >= 44 && heightPx >= 44) return [];
2882
- const roleLabel = role && !['button', 'a', 'input', 'select'].includes(tag) ? `[role=${role}]` : '';
2883
- return [{ id: 'small-touch-target', snippet: `<${tag}>${roleLabel} renders ${Math.round(widthPx)}x${Math.round(heightPx)}px (min 44x44)` }];
2884
- }
2885
-
2886
- const PROSE_ANCESTOR_SELECTOR = 'p,li,blockquote,figcaption,dd,dt';
2887
- function checkElementSmallTouchTarget(el, style, tag) {
2888
- // Static path: only provable when width AND height are explicit px lengths
2889
- // (jsdom performs no layout; rem/%/auto can't be resolved to a real box).
2890
- const wRaw = style.width || '';
2891
- const hRaw = style.height || '';
2892
- if (!/px\s*$/.test(wRaw) || !/px\s*$/.test(hRaw)) return [];
2893
- const widthPx = parseFloat(wRaw);
2894
- const heightPx = parseFloat(hRaw);
2895
- const href = el.getAttribute?.('href');
2896
- const role = (el.getAttribute?.('role') || '').toLowerCase();
2897
- const inputType = el.getAttribute?.('type') || '';
2898
- // An <a> is a prose text link unless it is explicitly laid out as a block
2899
- // (button-like). jsdom returns '' for the default inline display, so key
2900
- // off "not blockish" rather than "== inline".
2901
- const isBlockish = /^(block|flex|grid|inline-block|inline-flex|table)/.test(style.display || '');
2902
- const inProse = !!(el.closest && el.closest(PROSE_ANCESTOR_SELECTOR));
2903
- const isInlineLinkInProse = tag === 'a' && !isBlockish && inProse;
2904
- return checkSmallTouchTarget({ tag, role, href, inputType, widthPx, heightPx, isInlineLinkInProse });
2905
- }
2906
-
2907
- function checkElementSmallTouchTargetDOM(el) {
2908
- const tag = el.tagName.toLowerCase();
2909
- const rect = el.getBoundingClientRect();
2910
- if (!(rect.width > 0) || !(rect.height > 0)) return [];
2911
- const href = el.getAttribute('href');
2912
- const role = (el.getAttribute('role') || '').toLowerCase();
2913
- const inputType = el.getAttribute('type') || '';
2914
- const style = getComputedStyle(el);
2915
- const isBlockish = /^(block|flex|grid|inline-block|inline-flex|table)/.test(style.display || '');
2916
- const inProse = !!(el.closest && el.closest(PROSE_ANCESTOR_SELECTOR));
2917
- const isInlineLinkInProse = tag === 'a' && !isBlockish && inProse;
2918
- return checkSmallTouchTarget({ tag, role, href, inputType, widthPx: rect.width, heightPx: rect.height, isInlineLinkInProse });
2919
- }
2920
-
2921
- export {
2922
- checkBorders,
2923
- isEmojiOnlyText,
2924
- checkColors,
2925
- isCardLikeFromProps,
2926
- checkIconTile,
2927
- resolveSerif,
2928
- checkItalicSerif,
2929
- isAccentColor,
2930
- checkHeroEyebrow,
2931
- checkRepeatedSectionKickers,
2932
- checkMotion,
2933
- checkGlow,
2934
- checkHtmlPatterns,
2935
- readOwnBackgroundColor,
2936
- resolveBackground,
2937
- resolveGradientStops,
2938
- parseRadiusToPx,
2939
- resolveBorderRadiusPx,
2940
- checkElementBordersDOM,
2941
- checkElementColorsDOM,
2942
- checkElementIconTileDOM,
2943
- checkElementItalicSerifDOM,
2944
- checkElementHeroEyebrowDOM,
2945
- buildCustomPropMap,
2946
- resolveVarRefs,
2947
- oklchToRgb,
2948
- parseAnyColor,
2949
- parseColorResolved,
2950
- cleanInlineText,
2951
- isRepeatedKickerCandidate,
2952
- collectRepeatedSectionKickerCandidates,
2953
- checkRepeatedSectionKickersDOM,
2954
- checkElementMotionDOM,
2955
- checkElementGlowDOM,
2956
- checkElementAIPaletteDOM,
2957
- resolveFontSizePx,
2958
- resolveLengthPx,
2959
- checkQuality,
2960
- checkElementQualityDOM,
2961
- checkPageQualityFromDoc,
2962
- checkPageQualityDOM,
2963
- checkElementQuality,
2964
- checkElementBorders,
2965
- checkElementColors,
2966
- checkElementIconTile,
2967
- checkElementItalicSerif,
2968
- checkElementHeroEyebrow,
2969
- checkRepeatedSectionKickersFromDoc,
2970
- checkElementMotion,
2971
- checkElementGlow,
2972
- checkTypography,
2973
- isCardLikeDOM,
2974
- checkLayout,
2975
- checkPageTypography,
2976
- isCardLike,
2977
- checkPageLayout,
2978
- isCreamColor,
2979
- checkCreamPalette,
2980
- checkOversizedH1,
2981
- checkElementOversizedH1,
2982
- checkElementOversizedH1DOM,
2983
- shadowMaxBlurPx,
2984
- checkGptThinBorderWideShadow,
2985
- checkElementGptBorderShadow,
2986
- checkElementGptBorderShadowDOM,
2987
- checkClippedOverflow,
2988
- checkElementClippedOverflow,
2989
- checkElementClippedOverflowDOM,
2990
- isScreenReaderOnlyTextStyle,
2991
- checkElementTextOverflowDOM,
2992
- collectCssRules,
2993
- checkFocusVisible,
2994
- checkHoverOnlyAffordance,
2995
- checkDarkSchemeContrast,
2996
- checkImageDimensions,
2997
- checkElementImageDimensions,
2998
- checkElementImageDimensionsDOM,
2999
- checkSmallTouchTarget,
3000
- checkElementSmallTouchTarget,
3001
- checkElementSmallTouchTargetDOM,
3002
- };