@monoes/monomindcli 2.16.4 → 2.16.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (412) hide show
  1. package/.claude/agents/github/repo-architect.md +1 -1
  2. package/.claude/agents/specialists/integration-architect.md +9 -13
  3. package/.claude/commands/agents/agent-capabilities.md +1 -0
  4. package/.claude/commands/agents/agent-coordination.md +1 -0
  5. package/.claude/commands/agents/agent-spawning.md +1 -0
  6. package/.claude/commands/agents/agent-types.md +1 -0
  7. package/.claude/commands/analysis/bottleneck-detect.md +1 -0
  8. package/.claude/commands/analysis/performance-bottlenecks.md +1 -0
  9. package/.claude/commands/analysis/performance-report.md +1 -0
  10. package/.claude/commands/analysis/token-usage.md +1 -0
  11. package/.claude/commands/automation/README.md +1 -1
  12. package/.claude/commands/automation/auto-agent.md +1 -0
  13. package/.claude/commands/automation/self-healing.md +1 -0
  14. package/.claude/commands/automation/session-memory.md +1 -0
  15. package/.claude/commands/automation/smart-agents.md +1 -0
  16. package/.claude/commands/automation/smart-spawn.md +1 -0
  17. package/.claude/commands/automation/workflow-select.md +22 -27
  18. package/.claude/commands/coordination/README.md +2 -2
  19. package/.claude/commands/coordination/agent-spawn.md +1 -0
  20. package/.claude/commands/coordination/monoswarm-init.md +9 -8
  21. package/.claude/commands/coordination/task-orchestrate.md +6 -5
  22. package/.claude/commands/github/README.md +1 -1
  23. package/.claude/commands/github/github-modes.md +1 -0
  24. package/.claude/commands/github/issue-tracker.md +1 -0
  25. package/.claude/commands/github/pr-manager.md +1 -0
  26. package/.claude/commands/github/release-manager.md +1 -2
  27. package/.claude/commands/github/repo-architect.md +1 -0
  28. package/.claude/commands/github/sync-coordinator.md +1 -0
  29. package/.claude/commands/hooks/overview.md +1 -0
  30. package/.claude/commands/hooks/post-edit.md +1 -0
  31. package/.claude/commands/hooks/post-task.md +1 -0
  32. package/.claude/commands/hooks/pre-edit.md +1 -0
  33. package/.claude/commands/hooks/pre-task.md +1 -0
  34. package/.claude/commands/hooks/session-end.md +1 -0
  35. package/.claude/commands/hooks/setup.md +1 -0
  36. package/.claude/commands/mastermind/adr.md +3 -1
  37. package/.claude/commands/mastermind/brain.md +3 -1
  38. package/.claude/commands/mastermind/budget.md +3 -1
  39. package/.claude/commands/mastermind/code-review.md +3 -1
  40. package/.claude/commands/mastermind/content.md +3 -1
  41. package/.claude/commands/mastermind/createorg.md +3 -1
  42. package/.claude/commands/mastermind/createtask.md +6 -4
  43. package/.claude/commands/mastermind/debug.md +3 -1
  44. package/.claude/commands/mastermind/design.md +3 -1
  45. package/.claude/commands/mastermind/do.md +5 -3
  46. package/.claude/commands/mastermind/execute.md +3 -1
  47. package/.claude/commands/mastermind/finance.md +3 -1
  48. package/.claude/commands/mastermind/graph-status.md +3 -1
  49. package/.claude/commands/mastermind/help.md +12 -9
  50. package/.claude/commands/mastermind/idea.md +3 -1
  51. package/.claude/commands/mastermind/ideate.md +4 -2
  52. package/.claude/commands/mastermind/improve.md +4 -2
  53. package/.claude/commands/mastermind/loops.md +3 -1
  54. package/.claude/commands/mastermind/marketing.md +3 -1
  55. package/.claude/commands/mastermind/master.md +3 -1
  56. package/.claude/commands/mastermind/memory.md +8 -36
  57. package/.claude/commands/mastermind/monoswarm.md +3 -2
  58. package/.claude/commands/mastermind/okf-export.md +3 -1
  59. package/.claude/commands/mastermind/okf-import.md +3 -1
  60. package/.claude/commands/mastermind/ops.md +3 -1
  61. package/.claude/commands/mastermind/orgs.md +3 -1
  62. package/.claude/commands/mastermind/orgstatus.md +3 -1
  63. package/.claude/commands/mastermind/plan.md +3 -1
  64. package/.claude/commands/mastermind/receive-review.md +3 -1
  65. package/.claude/commands/mastermind/release.md +3 -1
  66. package/.claude/commands/mastermind/repeat.md +3 -1
  67. package/.claude/commands/mastermind/research.md +3 -1
  68. package/.claude/commands/mastermind/review.md +3 -1
  69. package/.claude/commands/mastermind/runorg.md +3 -1
  70. package/.claude/commands/mastermind/sales.md +3 -1
  71. package/.claude/commands/mastermind/skill-builder.md +3 -1
  72. package/.claude/commands/mastermind/specialagents.md +3 -1
  73. package/.claude/commands/mastermind/stoporg.md +3 -1
  74. package/.claude/commands/mastermind/techport.md +3 -1
  75. package/.claude/commands/mastermind/topology.md +4 -3
  76. package/.claude/commands/mastermind/understand.md +3 -1
  77. package/.claude/commands/mastermind/worktree.md +3 -1
  78. package/.claude/commands/memory/memory-search.md +1 -0
  79. package/.claude/commands/monitoring/README.md +1 -1
  80. package/.claude/commands/monitoring/agent-metrics.md +1 -0
  81. package/.claude/commands/monitoring/agents.md +1 -0
  82. package/.claude/commands/monitoring/status.md +1 -0
  83. package/.claude/commands/monoswarm/README.md +3 -3
  84. package/.claude/commands/monoswarm/analysis.md +2 -2
  85. package/.claude/commands/monoswarm/consensus.md +1 -0
  86. package/.claude/commands/monoswarm/development.md +3 -3
  87. package/.claude/commands/monoswarm/examples.md +4 -4
  88. package/.claude/commands/monoswarm/init.md +2 -1
  89. package/.claude/commands/monoswarm/maintenance.md +2 -2
  90. package/.claude/commands/monoswarm/memory.md +1 -0
  91. package/.claude/commands/monoswarm/monoswarm.md +5 -5
  92. package/.claude/commands/monoswarm/optimization.md +2 -2
  93. package/.claude/commands/monoswarm/research.md +2 -2
  94. package/.claude/commands/monoswarm/spawn.md +1 -0
  95. package/.claude/commands/monoswarm/status.md +2 -1
  96. package/.claude/commands/monoswarm/stop.md +2 -1
  97. package/.claude/commands/monoswarm/testing.md +2 -2
  98. package/.claude/commands/pair/README.md +8 -9
  99. package/.claude/commands/pair/examples.md +3 -4
  100. package/.claude/commands/pair/session.md +1 -1
  101. package/.claude/commands/workflows/README.md +45 -40
  102. package/.claude/commands/workflows/development.md +42 -55
  103. package/.claude/commands/workflows/research.md +41 -57
  104. package/.claude/commands/workflows/workflow-create.md +43 -45
  105. package/.claude/commands/workflows/workflow-execute.md +58 -68
  106. package/.claude/commands/workflows/workflow-export.md +37 -63
  107. package/.claude/helpers/build-skill-registry.cjs +10 -6
  108. package/.claude/helpers/handlers/pick-core.cjs +35 -24
  109. package/.claude/helpers/handlers/route-handler.cjs +11 -3
  110. package/.claude/helpers/hook-handler.cjs +4 -2
  111. package/.claude/helpers/jev-catalog.cjs +7 -3
  112. package/.claude/helpers/jev-picker.cjs +49 -7
  113. package/.claude/helpers/pick-rank.cjs +95 -3
  114. package/.claude/helpers/pick-stats.cjs +86 -2
  115. package/.claude/skills/agentic-jujutsu/SKILL.md +2 -3
  116. package/.claude/skills/github-toolkit/SKILL.md +1 -1
  117. package/.claude/skills/hooks-automation/SKILL.md +243 -938
  118. package/.claude/skills/mastermind-agent-detail/SKILL.md +1 -1
  119. package/.claude/skills/mastermind-agent-select/SKILL.md +16 -1
  120. package/.claude/skills/mastermind-inbox/SKILL.md +1 -1
  121. package/.claude/skills/mastermind-plugins/SKILL.md +1 -1
  122. package/.claude/skills/mastermind-release/SKILL.md +9 -1
  123. package/.claude/skills/mastermind-research/SKILL.md +9 -1
  124. package/.claude/skills/mastermind-review/SKILL.md +9 -1
  125. package/.claude/skills/mastermind-routine-detail/SKILL.md +1 -1
  126. package/.claude/skills/monodesign/SKILL.md +257 -0
  127. package/.claude/skills/monodesign/adapt.md +53 -0
  128. package/.claude/skills/monodesign/agents/monodesign-asset-producer.md +100 -0
  129. package/.claude/skills/monodesign/agents/monodesign-manual-edit-applier.md +103 -0
  130. package/.claude/skills/monodesign/animate.md +65 -0
  131. package/.claude/skills/monodesign/audit.md +89 -0
  132. package/.claude/skills/monodesign/bolder.md +50 -0
  133. package/.claude/skills/monodesign/clarify.md +64 -0
  134. package/.claude/skills/monodesign/colorize.md +68 -0
  135. package/.claude/skills/monodesign/craft.md +51 -0
  136. package/.claude/skills/monodesign/critique.md +66 -0
  137. package/.claude/skills/monodesign/delight.md +47 -0
  138. package/.claude/skills/monodesign/distill.md +56 -0
  139. package/.claude/skills/monodesign/document.md +83 -0
  140. package/.claude/skills/monodesign/extract.md +74 -0
  141. package/.claude/skills/monodesign/harden.md +65 -0
  142. package/.claude/skills/monodesign/init.md +30 -0
  143. package/.claude/skills/monodesign/layout.md +36 -0
  144. package/.claude/skills/monodesign/live.md +34 -0
  145. package/.claude/skills/monodesign/onboard.md +50 -0
  146. package/.claude/skills/monodesign/optimize.md +64 -0
  147. package/.claude/skills/monodesign/overdrive.md +56 -0
  148. package/.claude/skills/monodesign/polish.md +68 -0
  149. package/.claude/skills/monodesign/quieter.md +57 -0
  150. package/.claude/skills/monodesign/reference/adapt.md +312 -0
  151. package/.claude/skills/monodesign/reference/adapt.native.md +58 -0
  152. package/.claude/skills/monodesign/reference/android.md +40 -0
  153. package/.claude/skills/monodesign/reference/animate.md +203 -0
  154. package/.claude/skills/monodesign/reference/antipatterns-catalog.md +410 -0
  155. package/.claude/skills/monodesign/reference/audit.md +135 -0
  156. package/.claude/skills/monodesign/reference/audit.native.md +139 -0
  157. package/.claude/skills/monodesign/reference/bolder.md +120 -0
  158. package/.claude/skills/monodesign/reference/brand-workflow.md +180 -0
  159. package/.claude/skills/monodesign/reference/brand.md +108 -0
  160. package/.claude/skills/monodesign/reference/clarify.md +288 -0
  161. package/.claude/skills/monodesign/reference/codex.md +105 -0
  162. package/.claude/skills/monodesign/reference/cognitive-load.md +106 -0
  163. package/.claude/skills/monodesign/reference/color-and-contrast.md +105 -0
  164. package/.claude/skills/monodesign/reference/colorize.md +257 -0
  165. package/.claude/skills/monodesign/reference/component-specs.md +260 -0
  166. package/.claude/skills/monodesign/reference/component-states.md +274 -0
  167. package/.claude/skills/monodesign/reference/component-system.md +358 -0
  168. package/.claude/skills/monodesign/reference/copy-formulas.md +160 -0
  169. package/.claude/skills/monodesign/reference/craft.md +123 -0
  170. package/.claude/skills/monodesign/reference/critique.md +780 -0
  171. package/.claude/skills/monodesign/reference/delight.md +302 -0
  172. package/.claude/skills/monodesign/reference/design-principles.md +246 -0
  173. package/.claude/skills/monodesign/reference/distill.md +111 -0
  174. package/.claude/skills/monodesign/reference/document.md +429 -0
  175. package/.claude/skills/monodesign/reference/extract.md +69 -0
  176. package/.claude/skills/monodesign/reference/harden.md +347 -0
  177. package/.claude/skills/monodesign/reference/heuristics-scoring.md +234 -0
  178. package/.claude/skills/monodesign/reference/hooks.md +92 -0
  179. package/.claude/skills/monodesign/reference/image-prompts.md +130 -0
  180. package/.claude/skills/monodesign/reference/init.md +221 -0
  181. package/.claude/skills/monodesign/reference/interaction-design.md +189 -0
  182. package/.claude/skills/monodesign/reference/ios.md +45 -0
  183. package/.claude/skills/monodesign/reference/layout.md +185 -0
  184. package/.claude/skills/monodesign/reference/live.md +710 -0
  185. package/.claude/skills/monodesign/reference/motion-design.md +109 -0
  186. package/.claude/skills/monodesign/reference/onboard.md +234 -0
  187. package/.claude/skills/monodesign/reference/optimize.md +258 -0
  188. package/.claude/skills/monodesign/reference/overdrive.md +130 -0
  189. package/.claude/skills/monodesign/reference/personas.md +179 -0
  190. package/.claude/skills/monodesign/reference/polish.md +241 -0
  191. package/.claude/skills/monodesign/reference/pre-delivery-checklist.md +108 -0
  192. package/.claude/skills/monodesign/reference/product.md +60 -0
  193. package/.claude/skills/monodesign/reference/quieter.md +99 -0
  194. package/.claude/skills/monodesign/reference/responsive-design.md +114 -0
  195. package/.claude/skills/monodesign/reference/shape.md +165 -0
  196. package/.claude/skills/monodesign/reference/spatial-design.md +100 -0
  197. package/.claude/skills/monodesign/reference/teach.md +10 -0
  198. package/.claude/skills/monodesign/reference/token-architecture.md +222 -0
  199. package/.claude/skills/monodesign/reference/typeset.md +301 -0
  200. package/.claude/skills/monodesign/reference/typography.md +159 -0
  201. package/.claude/skills/monodesign/reference/ux-research.md +143 -0
  202. package/.claude/skills/monodesign/reference/ux-rules.md +211 -0
  203. package/.claude/skills/monodesign/reference/ux-writing.md +107 -0
  204. package/.claude/skills/monodesign/scripts/command-metadata.json +94 -0
  205. package/.claude/skills/monodesign/scripts/context-signals.mjs +260 -0
  206. package/.claude/skills/monodesign/scripts/context.mjs +1065 -0
  207. package/.claude/skills/monodesign/scripts/critique-storage.mjs +416 -0
  208. package/.claude/skills/monodesign/scripts/detect-csp.mjs +193 -0
  209. package/.claude/skills/monodesign/scripts/detect.mjs +33 -0
  210. package/.claude/skills/monodesign/scripts/detector/browser/injected/index.mjs +1960 -0
  211. package/.claude/skills/monodesign/scripts/detector/cli/main.mjs +321 -0
  212. package/.claude/skills/monodesign/scripts/detector/design-system.mjs +814 -0
  213. package/.claude/skills/monodesign/scripts/detector/detect-antipatterns-browser.js +5628 -0
  214. package/.claude/skills/monodesign/scripts/detector/detect-antipatterns.mjs +50 -0
  215. package/.claude/skills/monodesign/scripts/detector/engines/browser/detect-url.mjs +259 -0
  216. package/.claude/skills/monodesign/scripts/detector/engines/browser/drivers.mjs +339 -0
  217. package/.claude/skills/monodesign/scripts/detector/engines/regex/detect-text.mjs +636 -0
  218. package/.claude/skills/monodesign/scripts/detector/engines/static-html/css-cascade.mjs +1016 -0
  219. package/.claude/skills/monodesign/scripts/detector/engines/static-html/detect-html.mjs +253 -0
  220. package/.claude/skills/monodesign/scripts/detector/engines/visual/screenshot-contrast.mjs +198 -0
  221. package/.claude/skills/monodesign/scripts/detector/findings.mjs +12 -0
  222. package/.claude/skills/monodesign/scripts/detector/fix/css-regions.mjs +181 -0
  223. package/.claude/skills/monodesign/scripts/detector/fix/fixers.mjs +373 -0
  224. package/.claude/skills/monodesign/scripts/detector/fix/index.mjs +426 -0
  225. package/.claude/skills/monodesign/scripts/detector/node/file-system.mjs +198 -0
  226. package/.claude/skills/monodesign/scripts/detector/profile/profiler.mjs +166 -0
  227. package/.claude/skills/monodesign/scripts/detector/registry/antipatterns.mjs +563 -0
  228. package/.claude/skills/monodesign/scripts/detector/rules/checks.mjs +3024 -0
  229. package/.claude/skills/monodesign/scripts/detector/shared/color.mjs +124 -0
  230. package/.claude/skills/monodesign/scripts/detector/shared/constants.mjs +101 -0
  231. package/.claude/skills/monodesign/scripts/detector/shared/fonts.mjs +30 -0
  232. package/.claude/skills/monodesign/scripts/detector/shared/inline-ignores.mjs +148 -0
  233. package/.claude/skills/monodesign/scripts/detector/shared/page.mjs +7 -0
  234. package/.claude/skills/monodesign/scripts/hook-admin.mjs +694 -0
  235. package/.claude/skills/monodesign/scripts/hook-before-edit.mjs +516 -0
  236. package/.claude/skills/monodesign/scripts/hook-lib.mjs +1785 -0
  237. package/.claude/skills/monodesign/scripts/hook.mjs +61 -0
  238. package/.claude/skills/monodesign/scripts/lib/design-parser.mjs +809 -0
  239. package/.claude/skills/monodesign/scripts/lib/is-generated.mjs +69 -0
  240. package/.claude/skills/monodesign/scripts/lib/monodesign-config.mjs +640 -0
  241. package/.claude/skills/monodesign/scripts/lib/monodesign-paths.mjs +129 -0
  242. package/.claude/skills/monodesign/scripts/lib/provider.mjs +4 -0
  243. package/.claude/skills/monodesign/scripts/lib/target-args.mjs +42 -0
  244. package/.claude/skills/monodesign/scripts/live/browser-script-parts.mjs +50 -0
  245. package/.claude/skills/monodesign/scripts/live/completion.mjs +19 -0
  246. package/.claude/skills/monodesign/scripts/live/event-validation.mjs +137 -0
  247. package/.claude/skills/monodesign/scripts/live/insert-ui.mjs +458 -0
  248. package/.claude/skills/monodesign/scripts/live/manual-apply.mjs +939 -0
  249. package/.claude/skills/monodesign/scripts/live/manual-edit-routes.mjs +357 -0
  250. package/.claude/skills/monodesign/scripts/live/manual-edits-buffer.mjs +152 -0
  251. package/.claude/skills/monodesign/scripts/live/session-store.mjs +293 -0
  252. package/.claude/skills/monodesign/scripts/live/svelte-component.mjs +826 -0
  253. package/.claude/skills/monodesign/scripts/live/sveltekit-adapter.mjs +279 -0
  254. package/.claude/skills/monodesign/scripts/live/ui-core.mjs +180 -0
  255. package/.claude/skills/monodesign/scripts/live/vocabulary.mjs +36 -0
  256. package/.claude/skills/monodesign/scripts/live-accept.mjs +812 -0
  257. package/.claude/skills/monodesign/scripts/live-browser-dom.js +147 -0
  258. package/.claude/skills/monodesign/scripts/live-browser-session.js +124 -0
  259. package/.claude/skills/monodesign/scripts/live-browser.js +11213 -0
  260. package/.claude/skills/monodesign/scripts/live-commit-manual-edits.mjs +1241 -0
  261. package/.claude/skills/monodesign/scripts/live-complete.mjs +75 -0
  262. package/.claude/skills/monodesign/scripts/live-copy-edit-agent.mjs +683 -0
  263. package/.claude/skills/monodesign/scripts/live-discard-manual-edits.mjs +51 -0
  264. package/.claude/skills/monodesign/scripts/live-inject.mjs +596 -0
  265. package/.claude/skills/monodesign/scripts/live-insert.mjs +272 -0
  266. package/.claude/skills/monodesign/scripts/live-manual-edit-evidence.mjs +363 -0
  267. package/.claude/skills/monodesign/scripts/live-poll.mjs +384 -0
  268. package/.claude/skills/monodesign/scripts/live-resume.mjs +94 -0
  269. package/.claude/skills/monodesign/scripts/live-server.mjs +1210 -0
  270. package/.claude/skills/monodesign/scripts/live-status.mjs +61 -0
  271. package/.claude/skills/monodesign/scripts/live-target.mjs +30 -0
  272. package/.claude/skills/monodesign/scripts/live-wrap.mjs +884 -0
  273. package/.claude/skills/monodesign/scripts/live.mjs +297 -0
  274. package/.claude/skills/monodesign/scripts/modern-screenshot.umd.js +14 -0
  275. package/.claude/skills/monodesign/scripts/palette.mjs +635 -0
  276. package/.claude/skills/monodesign/scripts/pin.mjs +221 -0
  277. package/.claude/skills/monodesign/shape.md +71 -0
  278. package/.claude/skills/monodesign/teach.md +18 -0
  279. package/.claude/skills/monodesign/typeset.md +59 -0
  280. package/.claude/skills/monolean-audit/SKILL.md +4 -6
  281. package/.claude/skills/monolean-help/SKILL.md +0 -1
  282. package/.claude/skills/monoswarm/SKILL.md +17 -17
  283. package/.claude/skills/pair-programming/SKILL.md +127 -1100
  284. package/README.md +1 -1
  285. package/dist/src/agents/registry-builder.d.ts +1 -1
  286. package/dist/src/commands/doctor-pick-checks.d.ts +20 -3
  287. package/dist/src/commands/doctor-pick-checks.d.ts.map +1 -1
  288. package/dist/src/commands/doctor-pick-checks.js +132 -7
  289. package/dist/src/commands/doctor-pick-checks.js.map +1 -1
  290. package/dist/src/commands/doctor-project-checks.d.ts +2 -2
  291. package/dist/src/commands/doctor-project-checks.d.ts.map +1 -1
  292. package/dist/src/commands/doctor-project-checks.js +14 -12
  293. package/dist/src/commands/doctor-project-checks.js.map +1 -1
  294. package/dist/src/commands/doctor.d.ts.map +1 -1
  295. package/dist/src/commands/doctor.js +6 -4
  296. package/dist/src/commands/doctor.js.map +1 -1
  297. package/dist/src/commands/init-upgrade.d.ts.map +1 -1
  298. package/dist/src/commands/init-upgrade.js +6 -0
  299. package/dist/src/commands/init-upgrade.js.map +1 -1
  300. package/dist/src/commands/init.d.ts.map +1 -1
  301. package/dist/src/commands/init.js +11 -0
  302. package/dist/src/commands/init.js.map +1 -1
  303. package/dist/src/commands/pick.d.ts.map +1 -1
  304. package/dist/src/commands/pick.js +4 -3
  305. package/dist/src/commands/pick.js.map +1 -1
  306. package/dist/src/decision/jev.d.ts +16 -0
  307. package/dist/src/decision/jev.d.ts.map +1 -1
  308. package/dist/src/decision/jev.js +12 -0
  309. package/dist/src/decision/jev.js.map +1 -1
  310. package/dist/src/decision/pick-eval.d.ts +23 -0
  311. package/dist/src/decision/pick-eval.d.ts.map +1 -1
  312. package/dist/src/decision/pick-eval.js +24 -1
  313. package/dist/src/decision/pick-eval.js.map +1 -1
  314. package/dist/src/decision/picks.d.ts +5 -0
  315. package/dist/src/decision/picks.d.ts.map +1 -1
  316. package/dist/src/decision/picks.js +33 -11
  317. package/dist/src/decision/picks.js.map +1 -1
  318. package/dist/src/init/claudemd-generator.d.ts.map +1 -1
  319. package/dist/src/init/claudemd-generator.js +1 -0
  320. package/dist/src/init/claudemd-generator.js.map +1 -1
  321. package/dist/src/init/copy-assets.d.ts.map +1 -1
  322. package/dist/src/init/copy-assets.js +17 -9
  323. package/dist/src/init/copy-assets.js.map +1 -1
  324. package/dist/src/init/executor.d.ts.map +1 -1
  325. package/dist/src/init/executor.js +26 -4
  326. package/dist/src/init/executor.js.map +1 -1
  327. package/dist/src/init/file-guard.d.ts +93 -0
  328. package/dist/src/init/file-guard.d.ts.map +1 -0
  329. package/dist/src/init/file-guard.js +239 -0
  330. package/dist/src/init/file-guard.js.map +1 -0
  331. package/dist/src/init/helpers-generator.d.ts +7 -0
  332. package/dist/src/init/helpers-generator.d.ts.map +1 -1
  333. package/dist/src/init/helpers-generator.js +9 -0
  334. package/dist/src/init/helpers-generator.js.map +1 -1
  335. package/dist/src/init/init-memory.d.ts +10 -0
  336. package/dist/src/init/init-memory.d.ts.map +1 -1
  337. package/dist/src/init/init-memory.js +44 -1
  338. package/dist/src/init/init-memory.js.map +1 -1
  339. package/dist/src/init/managed-block.d.ts +3 -1
  340. package/dist/src/init/managed-block.d.ts.map +1 -1
  341. package/dist/src/init/managed-block.js +9 -2
  342. package/dist/src/init/managed-block.js.map +1 -1
  343. package/dist/src/init/mcp-generator.d.ts +9 -0
  344. package/dist/src/init/mcp-generator.d.ts.map +1 -1
  345. package/dist/src/init/mcp-generator.js +28 -0
  346. package/dist/src/init/mcp-generator.js.map +1 -1
  347. package/dist/src/init/runtime-config-merge.d.ts +21 -0
  348. package/dist/src/init/runtime-config-merge.d.ts.map +1 -0
  349. package/dist/src/init/runtime-config-merge.js +88 -0
  350. package/dist/src/init/runtime-config-merge.js.map +1 -0
  351. package/dist/src/init/settings-generator.js +1 -1
  352. package/dist/src/init/settings-generator.js.map +1 -1
  353. package/dist/src/init/shared-instructions-generator.d.ts +3 -1
  354. package/dist/src/init/shared-instructions-generator.d.ts.map +1 -1
  355. package/dist/src/init/shared-instructions-generator.js +14 -39
  356. package/dist/src/init/shared-instructions-generator.js.map +1 -1
  357. package/dist/src/init/shared.d.ts +10 -0
  358. package/dist/src/init/shared.d.ts.map +1 -1
  359. package/dist/src/init/shared.js +32 -1
  360. package/dist/src/init/shared.js.map +1 -1
  361. package/dist/src/init/types.d.ts +9 -0
  362. package/dist/src/init/types.d.ts.map +1 -1
  363. package/dist/src/init/types.js.map +1 -1
  364. package/dist/src/init/upgrade.d.ts +4 -0
  365. package/dist/src/init/upgrade.d.ts.map +1 -1
  366. package/dist/src/init/upgrade.js +39 -42
  367. package/dist/src/init/upgrade.js.map +1 -1
  368. package/dist/src/init/write-antigravity.d.ts.map +1 -1
  369. package/dist/src/init/write-antigravity.js +9 -3
  370. package/dist/src/init/write-antigravity.js.map +1 -1
  371. package/dist/src/init/write-claude.d.ts.map +1 -1
  372. package/dist/src/init/write-claude.js +40 -19
  373. package/dist/src/init/write-claude.js.map +1 -1
  374. package/dist/src/init/write-kimicode.d.ts +27 -0
  375. package/dist/src/init/write-kimicode.d.ts.map +1 -1
  376. package/dist/src/init/write-kimicode.js +119 -92
  377. package/dist/src/init/write-kimicode.js.map +1 -1
  378. package/dist/src/init/write-opencode.d.ts.map +1 -1
  379. package/dist/src/init/write-opencode.js +45 -6
  380. package/dist/src/init/write-opencode.js.map +1 -1
  381. package/dist/src/init/write-runtime-config.d.ts.map +1 -1
  382. package/dist/src/init/write-runtime-config.js +108 -81
  383. package/dist/src/init/write-runtime-config.js.map +1 -1
  384. package/dist/src/knowledge/eval/golden-set.js +0 -15
  385. package/dist/src/knowledge/eval/golden-set.js.map +1 -1
  386. package/dist/src/mcp-tools/org-skill-tools.d.ts.map +1 -1
  387. package/dist/src/mcp-tools/org-skill-tools.js +6 -2
  388. package/dist/src/mcp-tools/org-skill-tools.js.map +1 -1
  389. package/dist/src/mcp-tools/pick-tools.d.ts.map +1 -1
  390. package/dist/src/mcp-tools/pick-tools.js +13 -4
  391. package/dist/src/mcp-tools/pick-tools.js.map +1 -1
  392. package/dist/src/platform-adapters/merge.d.ts +4 -3
  393. package/dist/src/platform-adapters/merge.d.ts.map +1 -1
  394. package/dist/src/platform-adapters/merge.js +18 -8
  395. package/dist/src/platform-adapters/merge.js.map +1 -1
  396. package/dist/src/platform-adapters/mutation.d.ts +6 -1
  397. package/dist/src/platform-adapters/mutation.d.ts.map +1 -1
  398. package/dist/src/platform-adapters/mutation.js +9 -3
  399. package/dist/src/platform-adapters/mutation.js.map +1 -1
  400. package/dist/src/platform-adapters/operations.d.ts.map +1 -1
  401. package/dist/src/platform-adapters/operations.js +14 -6
  402. package/dist/src/platform-adapters/operations.js.map +1 -1
  403. package/dist/src/platform-adapters/types.d.ts +5 -0
  404. package/dist/src/platform-adapters/types.d.ts.map +1 -1
  405. package/dist/src/routing/agent-pick.d.ts +9 -7
  406. package/dist/src/routing/agent-pick.d.ts.map +1 -1
  407. package/dist/src/routing/agent-pick.js +17 -17
  408. package/dist/src/routing/agent-pick.js.map +1 -1
  409. package/dist/tsconfig.tsbuildinfo +1 -1
  410. package/package.json +6 -6
  411. package/.claude/skills/github-issue-triage/SKILL.md +0 -354
  412. package/.claude/skills/github-repo-recap/SKILL.md +0 -207
@@ -0,0 +1,253 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+
4
+ import { GENERIC_FONTS, OVERUSED_FONTS } from '../../shared/constants.mjs';
5
+ import {
6
+ checkSourceDesignSystem,
7
+ collectStaticDesignSystemFindings,
8
+ mergeDesignSystemFindings,
9
+ } from '../../design-system.mjs';
10
+ import { isFullPage } from '../../shared/page.mjs';
11
+ import { applyInlineIgnores } from '../../shared/inline-ignores.mjs';
12
+ import { finding } from '../../findings.mjs';
13
+ import { profileFindings, profileStep, profileStepAsync } from '../../profile/profiler.mjs';
14
+ import {
15
+ checkElementBorders,
16
+ checkElementClippedOverflow,
17
+ checkElementColors,
18
+ checkElementGlow,
19
+ checkElementGptBorderShadow,
20
+ checkElementHeroEyebrow,
21
+ checkElementIconTile,
22
+ checkElementItalicSerif,
23
+ checkElementMotion,
24
+ checkElementOversizedH1,
25
+ checkElementQuality,
26
+ checkCreamPalette,
27
+ checkHtmlPatterns,
28
+ checkPageLayout,
29
+ checkPageQualityFromDoc,
30
+ checkRepeatedSectionKickersFromDoc,
31
+ checkElementImageDimensions,
32
+ checkElementSmallTouchTarget,
33
+ checkFocusVisible,
34
+ checkHoverOnlyAffordance,
35
+ checkDarkSchemeContrast,
36
+ resolveBackground,
37
+ resolveBorderRadiusPx,
38
+ } from '../../rules/checks.mjs';
39
+ import { filterByProviders } from '../../registry/antipatterns.mjs';
40
+ import { detectText, runTextContentAnalyzers } from '../regex/detect-text.mjs';
41
+ import {
42
+ StaticDocument,
43
+ buildStaticStyleMap,
44
+ buildStaticWindow,
45
+ collectStaticCssText,
46
+ } from './css-cascade.mjs';
47
+
48
+ function checkStaticPageTypography(document, window) {
49
+ const findings = [];
50
+ const fonts = new Set();
51
+ const overusedFound = new Set();
52
+ for (const el of document.querySelectorAll('p, h1, h2, h3, h4, h5, h6, li, td, th, dd, blockquote, figcaption, a, button, label, span, div')) {
53
+ const hasText = el.childNodes.some(n => n.nodeType === 3 && n.textContent.trim().length > 0);
54
+ if (!hasText) continue;
55
+ const ff = window.getComputedStyle(el).fontFamily || '';
56
+ const stack = ff.split(',').map(f => f.trim().replace(/^['"]|['"]$/g, '').toLowerCase());
57
+ const primary = stack.find(f => f && !GENERIC_FONTS.has(f));
58
+ if (!primary) continue;
59
+ fonts.add(primary);
60
+ if (OVERUSED_FONTS.has(primary)) overusedFound.add(primary);
61
+ }
62
+ for (const font of overusedFound) {
63
+ findings.push({ id: 'overused-font', snippet: `Primary font: ${font}` });
64
+ }
65
+ if (fonts.size === 1 && document.querySelectorAll('*').length >= 20) {
66
+ findings.push({ id: 'single-font', snippet: `only font used is ${[...fonts][0]}` });
67
+ }
68
+ const sizes = new Set();
69
+ for (const el of document.querySelectorAll('h1, h2, h3, h4, h5, h6, p, span, a, li, td, th, label, button, div')) {
70
+ const fontSize = parseFloat(window.getComputedStyle(el).fontSize);
71
+ if (fontSize >= 8 && fontSize < 200) sizes.add(Math.round(fontSize * 10) / 10);
72
+ }
73
+ if (sizes.size >= 3) {
74
+ const sorted = [...sizes].sort((a, b) => a - b);
75
+ const ratio = sorted[sorted.length - 1] / sorted[0];
76
+ if (ratio < 2.0) {
77
+ findings.push({ id: 'flat-type-hierarchy', snippet: `Sizes: ${sorted.map(s => `${s}px`).join(', ')} (ratio ${ratio.toFixed(1)}:1)` });
78
+ }
79
+ }
80
+ return findings;
81
+ }
82
+
83
+ function checkElementBrokenImage(el) {
84
+ const src = el.getAttribute?.('src') ?? el.attribs?.src;
85
+ // Missing src attribute entirely
86
+ if (src === undefined || src === null) {
87
+ return [{ id: 'broken-image', snippet: '<img> with no src attribute' }];
88
+ }
89
+ const trimmed = String(src).trim();
90
+ // Empty or placeholder-only src values
91
+ if (trimmed === '' || trimmed === '#') {
92
+ return [{ id: 'broken-image', snippet: `<img src="${src}">` }];
93
+ }
94
+ return [];
95
+ }
96
+
97
+ const STATIC_ELEMENT_RULES = [
98
+ { id: 'border-rules', selector: '*', run: (el, tag, style, window, _customPropMap) => checkElementBorders(tag, style, null, resolveBorderRadiusPx(el, style, parseFloat(style.width) || 0, window)) },
99
+ { id: 'color-rules', selector: '*', run: (el, tag, style, window, customPropMap) => checkElementColors(el, style, tag, window, customPropMap, false) },
100
+ { id: 'dark-glow', selector: '*', run: (el, tag, style, window, customPropMap) => checkElementGlow(tag, style, resolveBackground(el.parentElement || el, window, customPropMap)) },
101
+ { id: 'motion-rules', selector: '*', run: (_el, tag, style) => checkElementMotion(tag, style) },
102
+ { id: 'icon-tile-stack', selector: 'h1,h2,h3,h4,h5,h6', run: (el, tag, _style, window) => checkElementIconTile(el, tag, window) },
103
+ { id: 'italic-serif-display', selector: 'h1,h2', run: (el, tag, style) => checkElementItalicSerif(el, style, tag) },
104
+ { id: 'hero-eyebrow-chip', selector: 'h1', run: (el, tag, style, window, customPropMap) => checkElementHeroEyebrow(el, style, tag, window, customPropMap) },
105
+ { id: 'broken-image', selector: 'img', run: (el) => checkElementBrokenImage(el) },
106
+ { id: 'quality-rules', selector: '*', run: (el, tag, style, window) => checkElementQuality(el, style, tag, window) },
107
+ { id: 'oversized-h1', selector: 'h1', run: (el, tag, style, window) => checkElementOversizedH1(el, style, tag, window) },
108
+ { id: 'clipped-overflow-container', selector: '*', run: (el, tag, style, window) => checkElementClippedOverflow(el, style, tag, window) },
109
+ { id: 'gpt-thin-border-wide-shadow', selector: '*', run: (el, _tag, style) => checkElementGptBorderShadow(el, style) },
110
+ { id: 'image-missing-dimensions', selector: 'img', run: (el, _tag, style) => checkElementImageDimensions(el, style) },
111
+ { id: 'small-touch-target', selector: 'a,button,input,select,summary,[role=button],[role=link],[role=menuitem],[role=tab],[role=switch]', run: (el, tag, style) => checkElementSmallTouchTarget(el, style, tag) },
112
+ ];
113
+
114
+ async function detectHtml(filePath, options = {}) {
115
+ const profile = options?.profile;
116
+ const html = profileStep(profile, {
117
+ engine: 'static-html',
118
+ phase: 'setup',
119
+ ruleId: 'read-html',
120
+ target: filePath,
121
+ }, () => fs.readFileSync(filePath, 'utf-8'));
122
+
123
+ let modules;
124
+ try {
125
+ modules = await profileStepAsync(profile, {
126
+ engine: 'static-html',
127
+ phase: 'setup',
128
+ ruleId: 'import-static-parser',
129
+ target: filePath,
130
+ }, async () => {
131
+ const [htmlparser2, cssSelect, csstree, domutils] = await Promise.all([
132
+ import('htmlparser2'),
133
+ import('css-select'),
134
+ import('css-tree'),
135
+ import('domutils'),
136
+ ]);
137
+ return {
138
+ parseDocument: htmlparser2.parseDocument,
139
+ selectAll: cssSelect.selectAll,
140
+ selectOne: cssSelect.selectOne,
141
+ is: cssSelect.is,
142
+ csstree,
143
+ domutils,
144
+ };
145
+ });
146
+ } catch {
147
+ return detectText(html, filePath, options);
148
+ }
149
+
150
+ const resolvedPath = path.resolve(filePath);
151
+ const fileDir = path.dirname(resolvedPath);
152
+ const root = profileStep(profile, {
153
+ engine: 'static-html',
154
+ phase: 'parse-html',
155
+ ruleId: 'parse-document',
156
+ target: filePath,
157
+ }, () => modules.parseDocument(html, { lowerCaseAttributeNames: false, lowerCaseTags: true }));
158
+
159
+ const cssText = collectStaticCssText(root, fileDir, profile, filePath, modules);
160
+ const document = new StaticDocument(root, modules);
161
+ buildStaticStyleMap(root, document, cssText, modules, profile, filePath);
162
+ const window = buildStaticWindow(document);
163
+
164
+ const customPropMap = null;
165
+
166
+ const findings = [];
167
+ const runElementCheck = (ruleId, callback) => profile
168
+ ? profileFindings(profile, { engine: 'static-html', phase: 'element', ruleId, target: filePath }, callback)
169
+ : callback();
170
+
171
+ const visitedByRule = new Map();
172
+ for (const rule of STATIC_ELEMENT_RULES) {
173
+ const elements = document.querySelectorAll(rule.selector);
174
+ visitedByRule.set(rule.id, elements.length);
175
+ for (const el of elements) {
176
+ const tag = el.tagName.toLowerCase();
177
+ const style = window.getComputedStyle(el);
178
+ for (const f of runElementCheck(rule.id, () => rule.run(el, tag, style, window, customPropMap))) {
179
+ findings.push(finding(f.id, filePath, f.snippet));
180
+ }
181
+ }
182
+ }
183
+
184
+ if (options?.designSystem) {
185
+ const sourceDesignFindings = profileFindings(profile, {
186
+ engine: 'static-html',
187
+ phase: 'source',
188
+ ruleId: 'design-system',
189
+ target: filePath,
190
+ }, () => checkSourceDesignSystem(html, filePath, { designSystem: options.designSystem }));
191
+ const staticDesignFindings = profileFindings(profile, {
192
+ engine: 'static-html',
193
+ phase: 'page',
194
+ ruleId: 'design-system',
195
+ target: filePath,
196
+ }, () => collectStaticDesignSystemFindings(document, window, filePath, options.designSystem));
197
+ findings.push(...mergeDesignSystemFindings(staticDesignFindings, sourceDesignFindings));
198
+ }
199
+
200
+ if (isFullPage(html)) {
201
+ const runPageCheck = (ruleId, callback) => profile
202
+ ? profileFindings(profile, { engine: 'static-html', phase: 'page', ruleId, target: filePath }, callback)
203
+ : callback();
204
+ for (const f of runPageCheck('typography-rules', () => checkStaticPageTypography(document, window))) {
205
+ findings.push(finding(f.id, filePath, f.snippet));
206
+ }
207
+ for (const f of runPageCheck('repeated-section-kickers', () => checkRepeatedSectionKickersFromDoc(document, window))) {
208
+ findings.push(finding(f.id, filePath, f.snippet));
209
+ }
210
+ for (const f of runPageCheck('layout-rules', () => checkPageLayout(document, window))) {
211
+ findings.push(finding(f.id, filePath, f.snippet));
212
+ }
213
+ for (const f of runPageCheck('cream-palette', () => checkCreamPalette(document, window))) {
214
+ findings.push(finding(f.id, filePath, f.snippet));
215
+ }
216
+ for (const f of runPageCheck('skipped-heading', () => checkPageQualityFromDoc(document))) {
217
+ findings.push(finding(f.id, filePath, f.snippet));
218
+ }
219
+ // Stylesheet-level accessibility rules operate on the concatenated CSS
220
+ // text (<style> blocks + linked sheets) — :hover / :focus-visible /
221
+ // prefers-color-scheme conditions can't be read off a resting element.
222
+ for (const f of runPageCheck('missing-focus-visible', () => checkFocusVisible(cssText))) {
223
+ findings.push(finding(f.id, filePath, f.snippet));
224
+ }
225
+ for (const f of runPageCheck('hover-only-affordance', () => checkHoverOnlyAffordance(cssText))) {
226
+ findings.push(finding(f.id, filePath, f.snippet));
227
+ }
228
+ for (const f of runPageCheck('dark-scheme-contrast-blindspot', () => checkDarkSchemeContrast(cssText))) {
229
+ findings.push(finding(f.id, filePath, f.snippet));
230
+ }
231
+ for (const f of runPageCheck('html-patterns', () => checkHtmlPatterns(html).filter(item =>
232
+ item.id !== 'bounce-easing' && item.id !== 'layout-transition'
233
+ ))) {
234
+ findings.push(finding(f.id, filePath, f.snippet));
235
+ }
236
+ // Text-content analyzers (em-dash overuse, marketing buzzwords,
237
+ // numbered section markers, aphoristic cadence) live in the regex
238
+ // engine. Call them from here so .html files get the same coverage
239
+ // as .css/.tsx files. These are scoped to text content only and
240
+ // don't overlap with static-html's element/page rules.
241
+ for (const f of runPageCheck('text-content', () => runTextContentAnalyzers(html, filePath, options))) {
242
+ findings.push(finding(f.antipattern, filePath, f.snippet));
243
+ }
244
+ }
245
+
246
+ const byProvider = filterByProviders(findings, options.providers);
247
+ // Static-HTML findings carry no line number, so only whole-file
248
+ // `monodesign-disable` directives apply here — exactly the standalone-document
249
+ // waiver this primitive targets. Bypassed by `--no-config` / `--no-inline-ignores`.
250
+ return options?.inlineIgnores === false ? byProvider : applyInlineIgnores(byProvider, html);
251
+ }
252
+
253
+ export { checkStaticPageTypography, STATIC_ELEMENT_RULES, detectHtml };
@@ -0,0 +1,198 @@
1
+ //
2
+ // Visual-contrast pixel fallback. `page` is the driver page abstraction from
3
+ // ../browser/drivers.mjs (a raw puppeteer Page also satisfies it): it only
4
+ // needs `evaluate(fn, arg)` roundtrips and `screenshot({ encoding: 'base64',
5
+ // clip, captureBeyondViewport })` returning a base64 PNG string. The logic is
6
+ // driver-agnostic: hide the glyphs via CSS, screenshot the clip twice, and
7
+ // diff the pixels in-page on a canvas. Both the monobrowse (CDP
8
+ // Page.captureScreenshot + Runtime.evaluate) and puppeteer drivers support
9
+ // this fully.
10
+ function sanitizeScreenshotClip(clip, viewport) {
11
+ if (!clip) return null;
12
+ const x = Math.max(0, Math.floor(clip.x || 0));
13
+ const y = Math.max(0, Math.floor(clip.y || 0));
14
+ const width = Math.min(
15
+ Math.max(1, Math.ceil(clip.width || 0)),
16
+ Math.max(1, viewport?.width || 1600),
17
+ );
18
+ const height = Math.min(
19
+ Math.max(1, Math.ceil(clip.height || 0)),
20
+ 320,
21
+ );
22
+ if (width < 1 || height < 1) return null;
23
+ return { x, y, width, height };
24
+ }
25
+
26
+ async function compareScreenshotContrast(page, beforeBase64, afterBase64, candidate) {
27
+ return page.evaluate(async ({ beforeBase64, afterBase64, candidate }) => {
28
+ const loadImage = (base64) => new Promise((resolve, reject) => {
29
+ const img = new Image();
30
+ img.onload = () => resolve(img);
31
+ img.onerror = () => reject(new Error('Could not decode contrast screenshot'));
32
+ img.src = `data:image/png;base64,${base64}`;
33
+ });
34
+ const [before, after] = await Promise.all([loadImage(beforeBase64), loadImage(afterBase64)]);
35
+ const width = Math.min(before.width, after.width);
36
+ const height = Math.min(before.height, after.height);
37
+ if (width < 1 || height < 1) return null;
38
+
39
+ const canvas = document.createElement('canvas');
40
+ canvas.width = width;
41
+ canvas.height = height;
42
+ const ctx = canvas.getContext('2d', { willReadFrequently: true });
43
+ if (!ctx) return null;
44
+
45
+ ctx.drawImage(before, 0, 0, width, height);
46
+ const beforePixels = ctx.getImageData(0, 0, width, height).data;
47
+ ctx.clearRect(0, 0, width, height);
48
+ ctx.drawImage(after, 0, 0, width, height);
49
+ const afterPixels = ctx.getImageData(0, 0, width, height).data;
50
+
51
+ const luminance = ({ r, g, b }) => {
52
+ const convert = c => {
53
+ const v = c / 255;
54
+ return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
55
+ };
56
+ return 0.2126 * convert(r) + 0.7152 * convert(g) + 0.0722 * convert(b);
57
+ };
58
+ const ratio = (a, b) => {
59
+ const l1 = luminance(a);
60
+ const l2 = luminance(b);
61
+ return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
62
+ };
63
+
64
+ const cssTextColor = candidate.textColor && !candidate.preferRenderedForeground
65
+ ? {
66
+ r: candidate.textColor.r,
67
+ g: candidate.textColor.g,
68
+ b: candidate.textColor.b,
69
+ }
70
+ : null;
71
+ const ratios = [];
72
+ let glyphPixels = 0;
73
+ let strongestDelta = 0;
74
+ for (let i = 0; i < beforePixels.length; i += 4) {
75
+ const delta = Math.abs(beforePixels[i] - afterPixels[i])
76
+ + Math.abs(beforePixels[i + 1] - afterPixels[i + 1])
77
+ + Math.abs(beforePixels[i + 2] - afterPixels[i + 2])
78
+ + Math.abs(beforePixels[i + 3] - afterPixels[i + 3]);
79
+ strongestDelta = Math.max(strongestDelta, delta);
80
+ if (delta < 10) continue;
81
+ glyphPixels++;
82
+ const fg = cssTextColor || {
83
+ r: beforePixels[i],
84
+ g: beforePixels[i + 1],
85
+ b: beforePixels[i + 2],
86
+ };
87
+ const bg = {
88
+ r: afterPixels[i],
89
+ g: afterPixels[i + 1],
90
+ b: afterPixels[i + 2],
91
+ };
92
+ ratios.push(ratio(fg, bg));
93
+ }
94
+
95
+ if (ratios.length < 8) {
96
+ return {
97
+ glyphPixels,
98
+ strongestDelta,
99
+ worstRatio: null,
100
+ p10Ratio: null,
101
+ medianRatio: null,
102
+ };
103
+ }
104
+
105
+ ratios.sort((a, b) => a - b);
106
+ const pick = pct => ratios[Math.min(ratios.length - 1, Math.max(0, Math.floor((pct / 100) * ratios.length)))];
107
+ return {
108
+ glyphPixels,
109
+ strongestDelta,
110
+ worstRatio: ratios[0],
111
+ p10Ratio: pick(10),
112
+ medianRatio: pick(50),
113
+ };
114
+ }, { beforeBase64, afterBase64, candidate });
115
+ }
116
+
117
+ async function captureVisualContrastCandidate(page, candidate, viewport) {
118
+ const clip = sanitizeScreenshotClip(candidate.clip, viewport);
119
+ if (!clip) return null;
120
+
121
+ const beforeBase64 = await page.screenshot({
122
+ encoding: 'base64',
123
+ clip,
124
+ captureBeyondViewport: true,
125
+ });
126
+ const token = `monodesign-contrast-${Date.now()}-${Math.random().toString(36).slice(2)}`;
127
+ const applied = await page.evaluate(({ selector, token, backgroundClipText }) => {
128
+ let el;
129
+ try {
130
+ el = document.querySelector(selector);
131
+ } catch {
132
+ return false;
133
+ }
134
+ if (!el) return false;
135
+ let style = document.getElementById('monodesign-visual-contrast-hide-style');
136
+ if (!style) {
137
+ style = document.createElement('style');
138
+ style.id = 'monodesign-visual-contrast-hide-style';
139
+ style.textContent = [
140
+ '[data-monodesign-visual-contrast-target] {',
141
+ ' color: transparent !important;',
142
+ ' -webkit-text-fill-color: transparent !important;',
143
+ ' text-shadow: none !important;',
144
+ '}',
145
+ '[data-monodesign-visual-contrast-target][data-monodesign-bgclip-text="true"] {',
146
+ ' background-image: none !important;',
147
+ '}',
148
+ ].join('\n');
149
+ document.head.appendChild(style);
150
+ }
151
+ el.setAttribute('data-monodesign-visual-contrast-target', token);
152
+ if (backgroundClipText) el.setAttribute('data-monodesign-bgclip-text', 'true');
153
+ return true;
154
+ }, {
155
+ selector: candidate.selector,
156
+ token,
157
+ backgroundClipText: candidate.backgroundClipText,
158
+ });
159
+ if (!applied) return null;
160
+
161
+ let afterBase64;
162
+ try {
163
+ afterBase64 = await page.screenshot({
164
+ encoding: 'base64',
165
+ clip,
166
+ captureBeyondViewport: true,
167
+ });
168
+ } finally {
169
+ await page.evaluate(({ selector }) => {
170
+ try {
171
+ const el = document.querySelector(selector);
172
+ if (el) {
173
+ el.removeAttribute('data-monodesign-visual-contrast-target');
174
+ el.removeAttribute('data-monodesign-bgclip-text');
175
+ }
176
+ } catch {
177
+ // Ignore invalid or stale selectors during cleanup.
178
+ }
179
+ }, { selector: candidate.selector }).catch(() => {});
180
+ }
181
+
182
+ const metrics = await compareScreenshotContrast(page, beforeBase64, afterBase64, candidate);
183
+ if (!metrics || !Number.isFinite(metrics.p10Ratio) || metrics.glyphPixels < 8) return null;
184
+ const measuredRatio = metrics.p10Ratio;
185
+ if (measuredRatio >= candidate.threshold) return null;
186
+ const textLabel = candidate.text ? ` "${candidate.text}"` : '';
187
+ const reasonLabel = (candidate.reasons || []).slice(0, 3).join(', ') || 'visual background';
188
+ return {
189
+ id: 'low-contrast',
190
+ snippet: `pixel contrast ${measuredRatio.toFixed(1)}:1 median ${metrics.medianRatio.toFixed(1)}:1 (need ${candidate.threshold}:1) on ${reasonLabel}${textLabel}`,
191
+ };
192
+ }
193
+
194
+ export {
195
+ sanitizeScreenshotClip,
196
+ compareScreenshotContrast,
197
+ captureVisualContrastCandidate,
198
+ };
@@ -0,0 +1,12 @@
1
+ import { getAntipattern } from './registry/antipatterns.mjs';
2
+
3
+ function getAP(id) {
4
+ return getAntipattern(id);
5
+ }
6
+
7
+ function finding(id, filePath, snippet, line = 0) {
8
+ const ap = getAP(id);
9
+ return { antipattern: id, name: ap.name, description: ap.description, severity: ap.severity || 'warning', file: filePath, line, snippet };
10
+ }
11
+
12
+ export { getAP, finding };
@@ -0,0 +1,181 @@
1
+ /**
2
+ * CSS region extraction and declaration scanning for the auto-fix engine.
3
+ *
4
+ * Fixers never parse a full DOM — they operate on the raw source text of the
5
+ * "CSS-shaped" regions of a file:
6
+ * - whole file for .css/.scss/.sass/.less
7
+ * - <style> blocks and style="" attributes for HTML-family files
8
+ * - styled-components / emotion template literals for JS/TS files
9
+ *
10
+ * All offsets returned here are absolute within the original file content, so
11
+ * edits computed against a region can be applied directly to the file.
12
+ */
13
+
14
+ const CSS_EXTENSIONS = new Set(['.css', '.scss', '.sass', '.less']);
15
+ const HTML_FAMILY_EXTENSIONS = new Set(['.html', '.htm', '.vue', '.svelte', '.astro']);
16
+ const JS_EXTENSIONS = new Set(['.js', '.ts', '.jsx', '.tsx', '.mjs', '.cjs']);
17
+
18
+ /**
19
+ * A region of file content that can be scanned as CSS declarations.
20
+ * kind:
21
+ * 'css' — full stylesheet syntax (selectors + blocks)
22
+ * 'style-attr' — a bare declaration list from a style="" attribute;
23
+ * selectorHint carries the owning tag name
24
+ */
25
+ function extractCssRegions(content, ext) {
26
+ ext = (ext || '').toLowerCase();
27
+ if (CSS_EXTENSIONS.has(ext)) {
28
+ return [{ start: 0, end: content.length, text: content, kind: 'css', selectorHint: null }];
29
+ }
30
+
31
+ const regions = [];
32
+ if (HTML_FAMILY_EXTENSIONS.has(ext)) {
33
+ const styleBlockRe = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
34
+ let m;
35
+ while ((m = styleBlockRe.exec(content)) !== null) {
36
+ const start = m.index + m[0].indexOf(m[1]);
37
+ regions.push({ start, end: start + m[1].length, text: m[1], kind: 'css', selectorHint: null });
38
+ }
39
+ const styleAttrRe = /<([a-zA-Z][\w-]*)\b[^>]*?\sstyle\s*=\s*("([^"]*)"|'([^']*)')/gi;
40
+ while ((m = styleAttrRe.exec(content)) !== null) {
41
+ const value = m[3] !== undefined ? m[3] : m[4];
42
+ if (!value) continue;
43
+ const start = m.index + m[0].length - value.length - 1; // inside the closing quote
44
+ regions.push({
45
+ start,
46
+ end: start + value.length,
47
+ text: value,
48
+ kind: 'style-attr',
49
+ selectorHint: m[1].toLowerCase(),
50
+ });
51
+ }
52
+ return regions;
53
+ }
54
+
55
+ if (JS_EXTENSIONS.has(ext)) {
56
+ const cssInJsRe = /(?:styled(?:\.\w+|\([^)]+\))|css)\s*`([\s\S]*?)`/g;
57
+ let m;
58
+ while ((m = cssInJsRe.exec(content)) !== null) {
59
+ const start = m.index + m[0].indexOf('`') + 1;
60
+ regions.push({ start, end: start + m[1].length, text: m[1], kind: 'css', selectorHint: null });
61
+ }
62
+ return regions;
63
+ }
64
+
65
+ return regions;
66
+ }
67
+
68
+ /**
69
+ * Find every `prop: value` declaration in a CSS-shaped text. Returns local
70
+ * offsets (relative to the given text):
71
+ * { declStart, valueStart, valueEnd, value, terminator }
72
+ * `value` is the raw trimmed value text (may include !important).
73
+ * `terminator` is the index just past the trailing `;` when present,
74
+ * otherwise valueEnd.
75
+ */
76
+ function findDeclarations(text, prop) {
77
+ const re = new RegExp(`(^|[{;])(\\s*)(${prop})\\s*:\\s*([^;{}]*)`, 'gi');
78
+ const results = [];
79
+ let m;
80
+ while ((m = re.exec(text)) !== null) {
81
+ const declStart = m.index + m[1].length + m[2].length;
82
+ const rawValue = m[4];
83
+ const trimmed = rawValue.replace(/\s+$/, '');
84
+ const valueStart = m.index + m[0].length - rawValue.length;
85
+ const valueEnd = valueStart + trimmed.length;
86
+ const terminator = text[m.index + m[0].length] === ';'
87
+ ? m.index + m[0].length + 1
88
+ : valueEnd;
89
+ results.push({ declStart, valueStart, valueEnd, value: trimmed.trim(), terminator });
90
+ }
91
+ return results;
92
+ }
93
+
94
+ /**
95
+ * The enclosing `{ ... }` block for a declaration at `index`, with its
96
+ * selector text. For bare declaration lists (style attributes) there is no
97
+ * block — the whole text is the body and selector is null.
98
+ */
99
+ function declBlockInfo(text, index) {
100
+ let i = index - 1;
101
+ let depth = 0;
102
+ while (i >= 0) {
103
+ const ch = text[i];
104
+ if (ch === '}') depth++;
105
+ else if (ch === '{') {
106
+ if (depth === 0) break;
107
+ depth--;
108
+ }
109
+ i--;
110
+ }
111
+ if (i < 0) {
112
+ return { bodyStart: 0, bodyEnd: text.length, body: text, selector: null };
113
+ }
114
+ const braceIdx = i;
115
+ let s = braceIdx - 1;
116
+ while (s >= 0 && !'};{'.includes(text[s])) s--;
117
+ const selector = text.slice(s + 1, braceIdx).trim();
118
+ let j = braceIdx + 1;
119
+ let d = 0;
120
+ while (j < text.length) {
121
+ const ch = text[j];
122
+ if (ch === '{') d++;
123
+ else if (ch === '}') {
124
+ if (d === 0) break;
125
+ d--;
126
+ }
127
+ j++;
128
+ }
129
+ return { bodyStart: braceIdx + 1, bodyEnd: j, body: text.slice(braceIdx + 1, j), selector };
130
+ }
131
+
132
+ /** Parse a single CSS length/number value, tolerating !important. */
133
+ function parseCssValue(raw) {
134
+ const important = /!\s*important/i.test(raw);
135
+ const cleaned = raw.replace(/!\s*important/i, '').trim();
136
+ const m = cleaned.match(/^(-?(?:\d+\.?\d*|\.\d+))([a-z%]*)$/i);
137
+ if (!m) return null;
138
+ return { num: parseFloat(m[1]), unit: (m[2] || '').toLowerCase(), important };
139
+ }
140
+
141
+ /** Resolve a block's font-size to px when statically computable, else null. */
142
+ function blockFontSizePx(body) {
143
+ const decls = findDeclarations(body, 'font-size');
144
+ if (decls.length === 0) return null;
145
+ const parsed = parseCssValue(decls[decls.length - 1].value);
146
+ if (!parsed) return null;
147
+ if (parsed.unit === 'px') return parsed.num;
148
+ if (parsed.unit === 'rem') return parsed.num * 16;
149
+ return null;
150
+ }
151
+
152
+ /** Split a CSS value list on top-level commas (paren-aware, for cubic-bezier). */
153
+ function splitTopLevel(value) {
154
+ const parts = [];
155
+ let depth = 0;
156
+ let current = '';
157
+ for (const ch of value) {
158
+ if (ch === '(') depth++;
159
+ else if (ch === ')') depth--;
160
+ if (ch === ',' && depth === 0) {
161
+ parts.push(current.trim());
162
+ current = '';
163
+ } else {
164
+ current += ch;
165
+ }
166
+ }
167
+ if (current.trim()) parts.push(current.trim());
168
+ return parts;
169
+ }
170
+
171
+ export {
172
+ CSS_EXTENSIONS,
173
+ HTML_FAMILY_EXTENSIONS,
174
+ JS_EXTENSIONS,
175
+ extractCssRegions,
176
+ findDeclarations,
177
+ declBlockInfo,
178
+ parseCssValue,
179
+ blockFontSizePx,
180
+ splitTopLevel,
181
+ };