self-evolve-framework 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -23
- package/bin/cli.js +24 -67
- package/package.json +1 -1
- package/template/rules/knowledge/README.md +56 -0
- package/template/rules/knowledge/ant-design-vue.mdc +54 -0
- package/template/rules/knowledge/general.mdc +56 -0
- package/template/rules/knowledge/rust.mdc +55 -0
- package/template/rules/knowledge/shadcn-svelte.mdc +64 -0
- package/template/rules/knowledge/svelte.mdc +135 -0
- package/template/rules/knowledge/tailwind.mdc +66 -0
- package/template/rules/knowledge/tauri.mdc +65 -0
- package/template/rules/knowledge/typescript.mdc +41 -0
- package/template/rules/knowledge/vue.mdc +48 -0
- package/template/rules/ponytail.mdc +23 -98
- package/template/rules/self-evolve.mdc +24 -0
- package/template/skills/impeccable/SKILL.md +47 -174
- package/template/skills/skillopt-sleep/SKILL.md +32 -88
- package/template/skills/impeccable/agents/impeccable_asset_producer.toml +0 -92
- package/template/skills/impeccable/agents/impeccable_manual_edit_applier.toml +0 -95
- package/template/skills/impeccable/agents/openai.yaml +0 -4
- package/template/skills/impeccable/reference/adapt.md +0 -311
- package/template/skills/impeccable/reference/animate.md +0 -201
- package/template/skills/impeccable/reference/audit.md +0 -133
- package/template/skills/impeccable/reference/bolder.md +0 -113
- package/template/skills/impeccable/reference/brand.md +0 -108
- package/template/skills/impeccable/reference/clarify.md +0 -288
- package/template/skills/impeccable/reference/codex.md +0 -105
- package/template/skills/impeccable/reference/colorize.md +0 -257
- package/template/skills/impeccable/reference/craft.md +0 -123
- package/template/skills/impeccable/reference/critique.md +0 -790
- package/template/skills/impeccable/reference/delight.md +0 -302
- package/template/skills/impeccable/reference/distill.md +0 -111
- package/template/skills/impeccable/reference/document.md +0 -429
- package/template/skills/impeccable/reference/extract.md +0 -69
- package/template/skills/impeccable/reference/harden.md +0 -347
- package/template/skills/impeccable/reference/hooks.md +0 -90
- package/template/skills/impeccable/reference/init.md +0 -172
- package/template/skills/impeccable/reference/interaction-design.md +0 -189
- package/template/skills/impeccable/reference/layout.md +0 -161
- package/template/skills/impeccable/reference/live.md +0 -720
- package/template/skills/impeccable/reference/onboard.md +0 -234
- package/template/skills/impeccable/reference/optimize.md +0 -258
- package/template/skills/impeccable/reference/overdrive.md +0 -130
- package/template/skills/impeccable/reference/polish.md +0 -241
- package/template/skills/impeccable/reference/product.md +0 -60
- package/template/skills/impeccable/reference/quieter.md +0 -99
- package/template/skills/impeccable/reference/shape.md +0 -165
- package/template/skills/impeccable/reference/typeset.md +0 -279
- package/template/skills/impeccable/scripts/command-metadata.json +0 -94
- package/template/skills/impeccable/scripts/context-signals.mjs +0 -225
- package/template/skills/impeccable/scripts/context.mjs +0 -961
- package/template/skills/impeccable/scripts/critique-storage.mjs +0 -242
- package/template/skills/impeccable/scripts/detect-csp.mjs +0 -198
- package/template/skills/impeccable/scripts/detect.mjs +0 -21
- package/template/skills/impeccable/scripts/detector/browser/injected/index.mjs +0 -1937
- package/template/skills/impeccable/scripts/detector/cli/main.mjs +0 -290
- package/template/skills/impeccable/scripts/detector/design-system.mjs +0 -750
- package/template/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +0 -5138
- package/template/skills/impeccable/scripts/detector/detect-antipatterns.mjs +0 -50
- package/template/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +0 -277
- package/template/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +0 -568
- package/template/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +0 -1015
- package/template/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +0 -234
- package/template/skills/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -189
- package/template/skills/impeccable/scripts/detector/findings.mjs +0 -12
- package/template/skills/impeccable/scripts/detector/node/file-system.mjs +0 -198
- package/template/skills/impeccable/scripts/detector/profile/profiler.mjs +0 -166
- package/template/skills/impeccable/scripts/detector/registry/antipatterns.mjs +0 -448
- package/template/skills/impeccable/scripts/detector/rules/checks.mjs +0 -2671
- package/template/skills/impeccable/scripts/detector/shared/color.mjs +0 -124
- package/template/skills/impeccable/scripts/detector/shared/constants.mjs +0 -101
- package/template/skills/impeccable/scripts/detector/shared/inline-ignores.mjs +0 -148
- package/template/skills/impeccable/scripts/detector/shared/page.mjs +0 -7
- package/template/skills/impeccable/scripts/hook-admin.mjs +0 -661
- package/template/skills/impeccable/scripts/hook-before-edit.mjs +0 -476
- package/template/skills/impeccable/scripts/hook-lib.mjs +0 -1632
- package/template/skills/impeccable/scripts/hook.mjs +0 -61
- package/template/skills/impeccable/scripts/lib/design-parser.mjs +0 -842
- package/template/skills/impeccable/scripts/lib/impeccable-config.mjs +0 -638
- package/template/skills/impeccable/scripts/lib/impeccable-paths.mjs +0 -128
- package/template/skills/impeccable/scripts/lib/is-generated.mjs +0 -69
- package/template/skills/impeccable/scripts/lib/target-args.mjs +0 -42
- package/template/skills/impeccable/scripts/live/browser-script-parts.mjs +0 -49
- package/template/skills/impeccable/scripts/live/completion.mjs +0 -19
- package/template/skills/impeccable/scripts/live/event-validation.mjs +0 -137
- package/template/skills/impeccable/scripts/live/insert-ui.mjs +0 -458
- package/template/skills/impeccable/scripts/live/manual-apply.mjs +0 -939
- package/template/skills/impeccable/scripts/live/manual-edit-routes.mjs +0 -357
- package/template/skills/impeccable/scripts/live/manual-edits-buffer.mjs +0 -152
- package/template/skills/impeccable/scripts/live/session-store.mjs +0 -289
- package/template/skills/impeccable/scripts/live/svelte-component.mjs +0 -826
- package/template/skills/impeccable/scripts/live/sveltekit-adapter.mjs +0 -274
- package/template/skills/impeccable/scripts/live/ui-core.mjs +0 -180
- package/template/skills/impeccable/scripts/live/vocabulary.mjs +0 -36
- package/template/skills/impeccable/scripts/live-accept.mjs +0 -812
- package/template/skills/impeccable/scripts/live-browser-dom.js +0 -146
- package/template/skills/impeccable/scripts/live-browser-session.js +0 -123
- package/template/skills/impeccable/scripts/live-browser.js +0 -11173
- package/template/skills/impeccable/scripts/live-commit-manual-edits.mjs +0 -1241
- package/template/skills/impeccable/scripts/live-complete.mjs +0 -75
- package/template/skills/impeccable/scripts/live-copy-edit-agent.mjs +0 -683
- package/template/skills/impeccable/scripts/live-discard-manual-edits.mjs +0 -51
- package/template/skills/impeccable/scripts/live-inject.mjs +0 -583
- package/template/skills/impeccable/scripts/live-insert.mjs +0 -272
- package/template/skills/impeccable/scripts/live-manual-edit-evidence.mjs +0 -363
- package/template/skills/impeccable/scripts/live-poll.mjs +0 -384
- package/template/skills/impeccable/scripts/live-resume.mjs +0 -94
- package/template/skills/impeccable/scripts/live-server.mjs +0 -1135
- package/template/skills/impeccable/scripts/live-status.mjs +0 -61
- package/template/skills/impeccable/scripts/live-target.mjs +0 -30
- package/template/skills/impeccable/scripts/live-wrap.mjs +0 -894
- package/template/skills/impeccable/scripts/live.mjs +0 -297
- package/template/skills/impeccable/scripts/modern-screenshot.umd.js +0 -14
- package/template/skills/impeccable/scripts/palette.mjs +0 -633
- package/template/skills/impeccable/scripts/pin.mjs +0 -214
- package/template/skills/skillopt-sleep/configs/_base_/default.yaml +0 -103
- package/template/skills/skillopt-sleep/configs/alfworld/default.yaml +0 -29
- package/template/skills/skillopt-sleep/configs/docvqa/default.yaml +0 -28
- package/template/skills/skillopt-sleep/configs/features/soft_gate.yaml +0 -47
- package/template/skills/skillopt-sleep/configs/livemathematicianbench/default.yaml +0 -22
- package/template/skills/skillopt-sleep/configs/officeqa/default.yaml +0 -34
- package/template/skills/skillopt-sleep/configs/searchqa/default.yaml +0 -32
- package/template/skills/skillopt-sleep/configs/spreadsheetbench/default.yaml +0 -34
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/__init__.py +0 -28
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/config.py +0 -282
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/datasets/__init__.py +0 -7
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/datasets/base.py +0 -512
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/engine/__init__.py +0 -9
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/engine/trainer.py +0 -2379
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/__init__.py +0 -1
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/_template/README.md +0 -43
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/_template/config_template.yaml +0 -55
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/_template/env_template.py +0 -151
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/_template/loader_template.py +0 -87
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/__init__.py +0 -5
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/adapter.py +0 -428
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/dataloader.py +0 -123
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/analyst_error.md +0 -55
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/analyst_success.md +0 -33
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/rollout_no_history.md +0 -8
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/rollout_with_history.md +0 -9
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/rollout_with_memory.md +0 -16
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/reflect.py +0 -4
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/rollout.py +0 -366
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/skills/initial.md +0 -45
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/__init__.py +0 -9
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/alfworld_envs.py +0 -221
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/alfworld_projection.py +0 -60
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/alfworld_prompts.py +0 -8
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/config_tw.yaml +0 -145
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/env_base.py +0 -84
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/env_manager.py +0 -139
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/memory.py +0 -87
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/base.py +0 -329
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/__init__.py +0 -1
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/adapter.py +0 -90
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/dataloader.py +0 -61
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/evaluator.py +0 -113
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/prompts/analyst_error.md +0 -35
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/prompts/analyst_success.md +0 -24
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/prompts/rollout_system.md +0 -12
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/rollout.py +0 -391
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/skills/initial.md +0 -11
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/__init__.py +0 -1
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/adapter.py +0 -129
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/dataloader.py +0 -308
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/evaluator.py +0 -62
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/prompts/analyst_error.md +0 -37
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/prompts/analyst_success.md +0 -25
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/prompts/rollout_system.md +0 -12
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/reflect.py +0 -4
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/rollout.py +0 -434
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/skills/initial.md +0 -16
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/__init__.py +0 -1
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/adapter.py +0 -112
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/dataloader.py +0 -71
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/evaluator.py +0 -46
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/prompts/analyst_error.md +0 -37
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/prompts/analyst_success.md +0 -25
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/prompts/rollout_system.md +0 -15
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/rollout.py +0 -799
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/skills/initial.md +0 -15
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/tool_runtime.py +0 -552
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/__init__.py +0 -1
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/adapter.py +0 -96
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/dataloader.py +0 -42
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/evaluator.py +0 -100
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/prompts/analyst_error.md +0 -46
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/prompts/analyst_success.md +0 -32
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/prompts/rollout_system.md +0 -13
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/reflect.py +0 -4
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/rollout.py +0 -494
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/skills/initial.md +0 -3
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/__init__.py +0 -5
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/adapter.py +0 -159
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/codegen_agent.py +0 -731
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/dataloader.py +0 -37
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/evaluator.py +0 -158
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/executor.py +0 -67
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/analyst_error.md +0 -46
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/analyst_success.md +0 -32
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/codegen_system.md +0 -1
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/critical_rules.md +0 -9
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/react_system.md +0 -21
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/react_agent.py +0 -395
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/reflect.py +0 -4
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/rollout.py +0 -979
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/skills/initial.md +0 -56
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/evaluation/__init__.py +0 -13
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/evaluation/gate.py +0 -148
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/gradient/__init__.py +0 -15
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/gradient/aggregate.py +0 -253
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/gradient/reflect.py +0 -635
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/__init__.py +0 -514
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/azure_openai.py +0 -915
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/backend_config.py +0 -185
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/claude_backend.py +0 -371
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/codex_backend.py +0 -666
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/codex_harness.py +0 -1057
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/common.py +0 -229
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/minimax_backend.py +0 -277
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/qwen_backend.py +0 -456
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/router.py +0 -236
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/__init__.py +0 -15
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/appendix.py +0 -156
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/clip.py +0 -109
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/lr_autonomous.py +0 -108
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/meta_skill.py +0 -79
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/rewrite.py +0 -59
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/scheduler.py +0 -127
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/select.py +0 -4
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/skill.py +0 -201
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/skill_aware.py +0 -206
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/slow_update.py +0 -396
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/update_modes.py +0 -135
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/__init__.py +0 -63
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_error.md +0 -41
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_error_full_rewrite.md +0 -32
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_error_rewrite.md +0 -44
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_success.md +0 -36
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_success_full_rewrite.md +0 -30
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_success_rewrite.md +0 -33
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/lr_autonomous.md +0 -20
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_failure.md +0 -30
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_failure_full_rewrite.md +0 -28
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_failure_rewrite.md +0 -26
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_final.md +0 -33
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_final_full_rewrite.md +0 -28
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_final_rewrite.md +0 -25
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_success.md +0 -28
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_success_full_rewrite.md +0 -28
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_success_rewrite.md +0 -25
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/meta_skill.md +0 -40
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/ranking.md +0 -20
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/ranking_rewrite.md +0 -15
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/rewrite_skill.md +0 -25
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/slow_update.md +0 -60
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/scheduler/__init__.py +0 -8
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/types.py +0 -306
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/utils/__init__.py +0 -4
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/utils/json_utils.py +0 -172
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/utils/scoring.py +0 -28
- package/template/skills/skillopt-sleep/scripts/python/__init__.py +0 -20
- package/template/skills/skillopt-sleep/scripts/python/__main__.py +0 -343
- package/template/skills/skillopt-sleep/scripts/python/backend.py +0 -1371
- package/template/skills/skillopt-sleep/scripts/python/budget.py +0 -75
- package/template/skills/skillopt-sleep/scripts/python/config.py +0 -162
- package/template/skills/skillopt-sleep/scripts/python/consolidate.py +0 -238
- package/template/skills/skillopt-sleep/scripts/python/cycle.py +0 -291
- package/template/skills/skillopt-sleep/scripts/python/dream.py +0 -138
- package/template/skills/skillopt-sleep/scripts/python/experiments/__init__.py +0 -1
- package/template/skills/skillopt-sleep/scripts/python/experiments/gbrain_bench.py +0 -119
- package/template/skills/skillopt-sleep/scripts/python/experiments/personas.py +0 -86
- package/template/skills/skillopt-sleep/scripts/python/experiments/report.py +0 -132
- package/template/skills/skillopt-sleep/scripts/python/experiments/run_experiment.py +0 -178
- package/template/skills/skillopt-sleep/scripts/python/experiments/run_gbrain.py +0 -209
- package/template/skills/skillopt-sleep/scripts/python/experiments/run_transfer.py +0 -155
- package/template/skills/skillopt-sleep/scripts/python/experiments/sweep.py +0 -164
- package/template/skills/skillopt-sleep/scripts/python/gate.py +0 -50
- package/template/skills/skillopt-sleep/scripts/python/harvest.py +0 -304
- package/template/skills/skillopt-sleep/scripts/python/harvest_codex.py +0 -253
- package/template/skills/skillopt-sleep/scripts/python/harvest_sources.py +0 -41
- package/template/skills/skillopt-sleep/scripts/python/judges.py +0 -84
- package/template/skills/skillopt-sleep/scripts/python/llm_miner.py +0 -134
- package/template/skills/skillopt-sleep/scripts/python/memory.py +0 -129
- package/template/skills/skillopt-sleep/scripts/python/mine.py +0 -312
- package/template/skills/skillopt-sleep/scripts/python/replay.py +0 -146
- package/template/skills/skillopt-sleep/scripts/python/rollout.py +0 -153
- package/template/skills/skillopt-sleep/scripts/python/scheduler.py +0 -138
- package/template/skills/skillopt-sleep/scripts/python/slow_update.py +0 -142
- package/template/skills/skillopt-sleep/scripts/python/staging.py +0 -103
- package/template/skills/skillopt-sleep/scripts/python/state.py +0 -96
- package/template/skills/skillopt-sleep/scripts/python/tasks_file.py +0 -81
- package/template/skills/skillopt-sleep/scripts/python/types.py +0 -146
- package/template/skills/skillopt-sleep/scripts/shell/__init__.py +0 -0
- package/template/skills/skillopt-sleep/scripts/shell/eval_only.py +0 -466
- package/template/skills/skillopt-sleep/scripts/shell/materialize_searchqa.py +0 -148
- package/template/skills/skillopt-sleep/scripts/shell/run_alfworld.sh +0 -60
- package/template/skills/skillopt-sleep/scripts/shell/run_searchqa.sh +0 -40
- package/template/skills/skillopt-sleep/scripts/shell/run_spreadsheetbench.sh +0 -39
- package/template/skills/skillopt-sleep/scripts/shell/train.py +0 -556
|
@@ -1,568 +0,0 @@
|
|
|
1
|
-
import { GENERIC_FONTS } from '../../shared/constants.mjs';
|
|
2
|
-
import { isNeutralColor } from '../../shared/color.mjs';
|
|
3
|
-
import { checkSourceDesignSystem } from '../../design-system.mjs';
|
|
4
|
-
import { isFullPage } from '../../shared/page.mjs';
|
|
5
|
-
import { applyInlineIgnores } from '../../shared/inline-ignores.mjs';
|
|
6
|
-
import { finding } from '../../findings.mjs';
|
|
7
|
-
import { filterByProviders } from '../../registry/antipatterns.mjs';
|
|
8
|
-
import { profileFindings, profileStep } from '../../profile/profiler.mjs';
|
|
9
|
-
|
|
10
|
-
// ---------------------------------------------------------------------------
|
|
11
|
-
// Regex fallback (non-HTML files: CSS, JSX, TSX, etc.)
|
|
12
|
-
// ---------------------------------------------------------------------------
|
|
13
|
-
|
|
14
|
-
const hasRounded = (line) => /\brounded(?:-\w+)?\b/.test(line);
|
|
15
|
-
const hasBorderRadius = (line) => /border-radius/i.test(line);
|
|
16
|
-
const isSafeElement = (line) => /<(?:blockquote|nav[\s>]|pre[\s>]|code[\s>]|a\s|input[\s>]|span[\s>])/i.test(line);
|
|
17
|
-
|
|
18
|
-
/** Strip HTML to plain text — drops script/style/comments/tags so
|
|
19
|
-
* content-text analyzers don't false-positive on code or CSS. */
|
|
20
|
-
function stripHtmlToText(html) {
|
|
21
|
-
return html
|
|
22
|
-
.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, ' ')
|
|
23
|
-
.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, ' ')
|
|
24
|
-
.replace(/<!--[\s\S]*?-->/g, ' ')
|
|
25
|
-
.replace(/<[^>]+>/g, ' ')
|
|
26
|
-
.replace(/\s+/g, ' ');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const PAGE_ANALYZER_EXTS = new Set(['.html', '.htm', '.astro', '.vue', '.svelte']);
|
|
30
|
-
|
|
31
|
-
function extFromFilePath(filePath) {
|
|
32
|
-
return filePath ? (filePath.match(/\.\w+$/)?.[0] || '').toLowerCase() : '';
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function shouldRunPageAnalyzers(content, filePath) {
|
|
36
|
-
if (!isFullPage(content)) return false;
|
|
37
|
-
const ext = extFromFilePath(filePath);
|
|
38
|
-
return !ext || PAGE_ANALYZER_EXTS.has(ext);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function isNeutralBorderColor(str) {
|
|
42
|
-
const m = str.match(/solid\s+((?:rgba?|hsla?|oklch|oklab|lab|lch|hwb|color)\([^)]*\)|#[0-9a-f]{3,8}\b|[a-z]+)/i);
|
|
43
|
-
if (!m) return false;
|
|
44
|
-
const c = m[1].toLowerCase();
|
|
45
|
-
if (['gray', 'grey', 'silver', 'white', 'black', 'transparent', 'currentcolor'].includes(c)) return true;
|
|
46
|
-
if (/^(?:rgba?|hsla?|oklch|oklab|lab|lch|hwb)\(/i.test(c)) return isNeutralColor(c);
|
|
47
|
-
const hex = c.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/);
|
|
48
|
-
if (hex) {
|
|
49
|
-
const [r, g, b] = [parseInt(hex[1], 16), parseInt(hex[2], 16), parseInt(hex[3], 16)];
|
|
50
|
-
return (Math.max(r, g, b) - Math.min(r, g, b)) < 30;
|
|
51
|
-
}
|
|
52
|
-
const shex = c.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/);
|
|
53
|
-
if (shex) {
|
|
54
|
-
const [r, g, b] = [parseInt(shex[1] + shex[1], 16), parseInt(shex[2] + shex[2], 16), parseInt(shex[3] + shex[3], 16)];
|
|
55
|
-
return (Math.max(r, g, b) - Math.min(r, g, b)) < 30;
|
|
56
|
-
}
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const REGEX_MATCHERS = [
|
|
61
|
-
// --- Side-tab ---
|
|
62
|
-
{ id: 'side-tab', regex: /\bborder-[lrse]-(\d+)\b/g,
|
|
63
|
-
test: (m, line) => { const n = +m[1]; return hasRounded(line) ? n >= 2 : n >= 4; },
|
|
64
|
-
fmt: (m) => m[0] },
|
|
65
|
-
{ id: 'side-tab', regex: /border-(?:left|right)\s*:\s*(\d+)px\s+solid[^;]*/gi,
|
|
66
|
-
test: (m, line) => { if (isSafeElement(line)) return false; if (isNeutralBorderColor(m[0])) return false; const n = +m[1]; return hasBorderRadius(line) ? n >= 2 : n >= 3; },
|
|
67
|
-
fmt: (m) => m[0].replace(/\s*;?\s*$/, '') },
|
|
68
|
-
{ id: 'side-tab', regex: /border-(?:left|right)-width\s*:\s*(\d+)px/gi,
|
|
69
|
-
test: (m, line) => !isSafeElement(line) && +m[1] >= 3,
|
|
70
|
-
fmt: (m) => m[0] },
|
|
71
|
-
{ id: 'side-tab', regex: /border-inline-(?:start|end)\s*:\s*(\d+)px\s+solid/gi,
|
|
72
|
-
test: (m, line) => !isSafeElement(line) && +m[1] >= 3,
|
|
73
|
-
fmt: (m) => m[0] },
|
|
74
|
-
{ id: 'side-tab', regex: /border-inline-(?:start|end)-width\s*:\s*(\d+)px/gi,
|
|
75
|
-
test: (m, line) => !isSafeElement(line) && +m[1] >= 3,
|
|
76
|
-
fmt: (m) => m[0] },
|
|
77
|
-
{ id: 'side-tab', regex: /border(?:Left|Right)\s*[:=]\s*["'`](\d+)px\s+solid/g,
|
|
78
|
-
test: (m) => +m[1] >= 3,
|
|
79
|
-
fmt: (m) => m[0] },
|
|
80
|
-
// --- Border accent on rounded ---
|
|
81
|
-
{ id: 'border-accent-on-rounded', regex: /\bborder-[tb]-(\d+)\b/g,
|
|
82
|
-
test: (m, line) => hasRounded(line) && +m[1] >= 1,
|
|
83
|
-
fmt: (m) => m[0] },
|
|
84
|
-
{ id: 'border-accent-on-rounded', regex: /border-(?:top|bottom)\s*:\s*(\d+)px\s+solid/gi,
|
|
85
|
-
test: (m, line) => +m[1] >= 3 && hasBorderRadius(line),
|
|
86
|
-
fmt: (m) => m[0] },
|
|
87
|
-
// --- Overused font ---
|
|
88
|
-
{ id: 'overused-font', regex: /font-family\s*:\s*['"]?(Inter|Roboto|Open Sans|Lato|Montserrat|Arial|Helvetica|Fraunces|Geist Sans|Geist Mono|Geist|Mona Sans|Plus Jakarta Sans|Space Grotesk|Recoleta|Instrument Sans|Instrument Serif)\b/gi,
|
|
89
|
-
test: () => true,
|
|
90
|
-
fmt: (m) => m[0] },
|
|
91
|
-
{ id: 'overused-font', regex: /fonts\.googleapis\.com\/css2?\?family=(Inter|Roboto|Open\+Sans|Lato|Montserrat|Fraunces|Plus\+Jakarta\+Sans|Space\+Grotesk|Instrument\+Sans|Instrument\+Serif|Mona\+Sans|Geist)\b/gi,
|
|
92
|
-
test: () => true,
|
|
93
|
-
fmt: (m) => `Google Fonts: ${m[1].replace(/\+/g, ' ')}` },
|
|
94
|
-
// --- Gradient text ---
|
|
95
|
-
{ id: 'gradient-text', regex: /background-clip\s*:\s*text|-webkit-background-clip\s*:\s*text/gi,
|
|
96
|
-
test: (m, line) => /gradient/i.test(line),
|
|
97
|
-
fmt: () => 'background-clip: text + gradient' },
|
|
98
|
-
// --- Gradient text (Tailwind) ---
|
|
99
|
-
{ id: 'gradient-text', regex: /\bbg-clip-text\b/g,
|
|
100
|
-
test: (m, line) => /\bbg-gradient-to-/i.test(line),
|
|
101
|
-
fmt: () => 'bg-clip-text + bg-gradient' },
|
|
102
|
-
// --- Tailwind gray on colored bg ---
|
|
103
|
-
{ id: 'gray-on-color', regex: /\btext-(?:gray|slate|zinc|neutral|stone)-(\d+)\b/g,
|
|
104
|
-
test: (m, line) => /\bbg-(?:red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-\d+\b/.test(line),
|
|
105
|
-
fmt: (m, line) => { const bg = line.match(/\bbg-(?:red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-\d+\b/); return `${m[0]} on ${bg?.[0] || '?'}`; } },
|
|
106
|
-
// --- Tailwind AI palette ---
|
|
107
|
-
{ id: 'ai-color-palette', regex: /\btext-(?:purple|violet|indigo)-(\d+)\b/g,
|
|
108
|
-
test: (m, line) => /\btext-(?:[2-9]xl|[3-9]xl)\b|<h[1-3]/i.test(line),
|
|
109
|
-
fmt: (m) => `${m[0]} on heading` },
|
|
110
|
-
{ id: 'ai-color-palette', regex: /\bfrom-(?:purple|violet|indigo)-(\d+)\b/g,
|
|
111
|
-
test: (m, line) => /\bto-(?:purple|violet|indigo|blue|cyan|pink|fuchsia)-\d+\b/.test(line),
|
|
112
|
-
fmt: (m) => `${m[0]} gradient` },
|
|
113
|
-
// --- Bounce/elastic easing ---
|
|
114
|
-
{ id: 'bounce-easing', regex: /\banimate-bounce\b/g,
|
|
115
|
-
test: () => true,
|
|
116
|
-
fmt: () => 'animate-bounce (Tailwind)' },
|
|
117
|
-
{ id: 'bounce-easing', regex: /animation(?:-name)?\s*:\s*([^;{}]*(?:bounce|elastic|wobble|jiggle|spring)[^;{}]*)/gi,
|
|
118
|
-
test: () => true,
|
|
119
|
-
fmt: (m) => {
|
|
120
|
-
const token = m[1]
|
|
121
|
-
.split(/[,\s]+/)
|
|
122
|
-
.find((part) => /bounce|elastic|wobble|jiggle|spring/i.test(part));
|
|
123
|
-
return `animation: ${token || m[1].trim()}`;
|
|
124
|
-
} },
|
|
125
|
-
{ id: 'bounce-easing', regex: /cubic-bezier\(\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*\)/g,
|
|
126
|
-
test: (m) => {
|
|
127
|
-
const y1 = parseFloat(m[2]), y2 = parseFloat(m[4]);
|
|
128
|
-
return y1 < -0.1 || y1 > 1.1 || y2 < -0.1 || y2 > 1.1;
|
|
129
|
-
},
|
|
130
|
-
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
|
|
131
|
-
// --- Layout property transition ---
|
|
132
|
-
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi,
|
|
133
|
-
test: (m) => {
|
|
134
|
-
const val = m[1].toLowerCase();
|
|
135
|
-
if (/\ball\b/.test(val)) return false;
|
|
136
|
-
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
|
|
137
|
-
},
|
|
138
|
-
fmt: (m) => {
|
|
139
|
-
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
|
|
140
|
-
return `transition: ${found ? found.join(', ') : m[1].trim()}`;
|
|
141
|
-
} },
|
|
142
|
-
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi,
|
|
143
|
-
test: (m) => {
|
|
144
|
-
const val = m[1].toLowerCase();
|
|
145
|
-
if (/\ball\b/.test(val)) return false;
|
|
146
|
-
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
|
|
147
|
-
},
|
|
148
|
-
fmt: (m) => {
|
|
149
|
-
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
|
|
150
|
-
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`;
|
|
151
|
-
} },
|
|
152
|
-
// --- Broken image: src="" or src="#" or src=" " ---
|
|
153
|
-
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
|
|
154
|
-
test: () => true,
|
|
155
|
-
fmt: (m) => m[0].slice(0, 100) },
|
|
156
|
-
// --- Broken image: <img> with no src attribute at all ---
|
|
157
|
-
{ id: 'broken-image', regex: /<img\b(?:(?!\bsrc\s*=)[^>])*>/gi,
|
|
158
|
-
test: (m) => !/\bsrc\s*=/i.test(m[0]),
|
|
159
|
-
fmt: (m) => m[0].slice(0, 100) },
|
|
160
|
-
];
|
|
161
|
-
|
|
162
|
-
const REGEX_ANALYZERS = [
|
|
163
|
-
// Single font
|
|
164
|
-
(content, filePath) => {
|
|
165
|
-
const fontFamilyRe = /font-family\s*:\s*([^;}]+)/gi;
|
|
166
|
-
const fonts = new Set();
|
|
167
|
-
let m;
|
|
168
|
-
while ((m = fontFamilyRe.exec(content)) !== null) {
|
|
169
|
-
for (const f of m[1].split(',').map(f => f.trim().replace(/^['"]|['"]$/g, '').toLowerCase())) {
|
|
170
|
-
if (f && !GENERIC_FONTS.has(f)) fonts.add(f);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
const gfRe = /fonts\.googleapis\.com\/css2?\?family=([^&"'\s]+)/gi;
|
|
174
|
-
while ((m = gfRe.exec(content)) !== null) {
|
|
175
|
-
for (const f of m[1].split('|').map(f => f.split(':')[0].replace(/\+/g, ' ').toLowerCase())) fonts.add(f);
|
|
176
|
-
}
|
|
177
|
-
if (fonts.size !== 1 || content.split('\n').length < 20) return [];
|
|
178
|
-
const name = [...fonts][0];
|
|
179
|
-
const lines = content.split('\n');
|
|
180
|
-
let line = 1;
|
|
181
|
-
for (let i = 0; i < lines.length; i++) { if (lines[i].toLowerCase().includes(name)) { line = i + 1; break; } }
|
|
182
|
-
return [finding('single-font', filePath, `only font used is ${name}`, line)];
|
|
183
|
-
},
|
|
184
|
-
// Flat type hierarchy
|
|
185
|
-
(content, filePath) => {
|
|
186
|
-
const sizes = new Set();
|
|
187
|
-
const REM = 16;
|
|
188
|
-
let m;
|
|
189
|
-
const sizeRe = /font-size\s*:\s*([\d.]+)(px|rem|em)\b/gi;
|
|
190
|
-
while ((m = sizeRe.exec(content)) !== null) {
|
|
191
|
-
const px = m[2] === 'px' ? +m[1] : +m[1] * REM;
|
|
192
|
-
if (px > 0 && px < 200) sizes.add(Math.round(px * 10) / 10);
|
|
193
|
-
}
|
|
194
|
-
const clampRe = /font-size\s*:\s*clamp\(\s*([\d.]+)(px|rem|em)\s*,\s*[^,]+,\s*([\d.]+)(px|rem|em)\s*\)/gi;
|
|
195
|
-
while ((m = clampRe.exec(content)) !== null) {
|
|
196
|
-
sizes.add(Math.round((m[2] === 'px' ? +m[1] : +m[1] * REM) * 10) / 10);
|
|
197
|
-
sizes.add(Math.round((m[4] === 'px' ? +m[3] : +m[3] * REM) * 10) / 10);
|
|
198
|
-
}
|
|
199
|
-
const TW = { 'text-xs': 12, 'text-sm': 14, 'text-base': 16, 'text-lg': 18, 'text-xl': 20, 'text-2xl': 24, 'text-3xl': 30, 'text-4xl': 36, 'text-5xl': 48, 'text-6xl': 60, 'text-7xl': 72, 'text-8xl': 96, 'text-9xl': 128 };
|
|
200
|
-
for (const [cls, px] of Object.entries(TW)) { if (new RegExp(`\\b${cls}\\b`).test(content)) sizes.add(px); }
|
|
201
|
-
if (sizes.size < 3) return [];
|
|
202
|
-
const sorted = [...sizes].sort((a, b) => a - b);
|
|
203
|
-
const ratio = sorted[sorted.length - 1] / sorted[0];
|
|
204
|
-
if (ratio >= 2.0) return [];
|
|
205
|
-
const lines = content.split('\n');
|
|
206
|
-
let line = 1;
|
|
207
|
-
for (let i = 0; i < lines.length; i++) { if (/font-size/i.test(lines[i]) || /\btext-(?:xs|sm|base|lg|xl|\d)/i.test(lines[i])) { line = i + 1; break; } }
|
|
208
|
-
return [finding('flat-type-hierarchy', filePath, `Sizes: ${sorted.map(s => s + 'px').join(', ')} (ratio ${ratio.toFixed(1)}:1)`, line)];
|
|
209
|
-
},
|
|
210
|
-
// Monotonous spacing (regex)
|
|
211
|
-
(content, filePath) => {
|
|
212
|
-
const vals = [];
|
|
213
|
-
let m;
|
|
214
|
-
const pxRe = /(?:padding|margin)(?:-(?:top|right|bottom|left))?\s*:\s*(\d+)px/gi;
|
|
215
|
-
while ((m = pxRe.exec(content)) !== null) { const v = +m[1]; if (v > 0 && v < 200) vals.push(v); }
|
|
216
|
-
const remRe = /(?:padding|margin)(?:-(?:top|right|bottom|left))?\s*:\s*([\d.]+)rem/gi;
|
|
217
|
-
while ((m = remRe.exec(content)) !== null) { const v = Math.round(parseFloat(m[1]) * 16); if (v > 0 && v < 200) vals.push(v); }
|
|
218
|
-
const gapRe = /gap\s*:\s*(\d+)px/gi;
|
|
219
|
-
while ((m = gapRe.exec(content)) !== null) vals.push(+m[1]);
|
|
220
|
-
const twRe = /\b(?:p|px|py|pt|pb|pl|pr|m|mx|my|mt|mb|ml|mr|gap)-(\d+)\b/g;
|
|
221
|
-
while ((m = twRe.exec(content)) !== null) vals.push(+m[1] * 4);
|
|
222
|
-
const rounded = vals.map(v => Math.round(v / 4) * 4);
|
|
223
|
-
if (rounded.length < 10) return [];
|
|
224
|
-
const counts = {};
|
|
225
|
-
for (const v of rounded) counts[v] = (counts[v] || 0) + 1;
|
|
226
|
-
const maxCount = Math.max(...Object.values(counts));
|
|
227
|
-
const pct = maxCount / rounded.length;
|
|
228
|
-
const unique = [...new Set(rounded)].filter(v => v > 0);
|
|
229
|
-
if (pct <= 0.6 || unique.length > 3) return [];
|
|
230
|
-
const dominant = Object.entries(counts).sort((a, b) => b[1] - a[1])[0][0];
|
|
231
|
-
return [finding('monotonous-spacing', filePath, `~${dominant}px used ${maxCount}/${rounded.length} times (${Math.round(pct * 100)}%)`)];
|
|
232
|
-
},
|
|
233
|
-
// Em-dash overuse: 5+ em-dashes or "--" in body text content
|
|
234
|
-
// (occasional em-dash use in prose is fine; the pattern fires only
|
|
235
|
-
// when count crosses into AI-cadence territory).
|
|
236
|
-
(content, filePath) => {
|
|
237
|
-
const text = stripHtmlToText(content);
|
|
238
|
-
let count = 0;
|
|
239
|
-
const re = /[—]|--(?=\S)/g;
|
|
240
|
-
while (re.exec(text) !== null) count++;
|
|
241
|
-
if (count < 5) return [];
|
|
242
|
-
return [finding('em-dash-overuse', filePath, `${count} em-dashes in body text`)];
|
|
243
|
-
},
|
|
244
|
-
// Marketing buzzwords: SaaS phrase list
|
|
245
|
-
(content, filePath) => {
|
|
246
|
-
const text = stripHtmlToText(content);
|
|
247
|
-
const lower = text.toLowerCase();
|
|
248
|
-
const BUZZWORDS = [
|
|
249
|
-
'streamline your', 'empower your', 'supercharge your',
|
|
250
|
-
'unleash your', 'unleash the power', 'leverage the power',
|
|
251
|
-
'built for the modern', 'trusted by leading', 'trusted by the world',
|
|
252
|
-
'best-in-class', 'industry-leading', 'world-class', 'enterprise-grade',
|
|
253
|
-
'next-generation', 'cutting-edge', 'transform your business',
|
|
254
|
-
'revolutionize', 'game-changer', 'game changing',
|
|
255
|
-
'mission-critical', 'best of breed', 'future-proof', 'future proof',
|
|
256
|
-
'seamless experience', 'seamlessly integrate',
|
|
257
|
-
'drive engagement', 'drive growth', 'drive results',
|
|
258
|
-
'harness the power',
|
|
259
|
-
];
|
|
260
|
-
let count = 0;
|
|
261
|
-
let firstSample = '';
|
|
262
|
-
for (const phrase of BUZZWORDS) {
|
|
263
|
-
let from = 0;
|
|
264
|
-
while (true) {
|
|
265
|
-
const idx = lower.indexOf(phrase, from);
|
|
266
|
-
if (idx === -1) break;
|
|
267
|
-
count++;
|
|
268
|
-
if (!firstSample) {
|
|
269
|
-
firstSample = text.slice(Math.max(0, idx - 12), Math.min(text.length, idx + phrase.length + 12)).trim();
|
|
270
|
-
}
|
|
271
|
-
from = idx + phrase.length;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
if (count === 0) return [];
|
|
275
|
-
return [finding('marketing-buzzword', filePath, `${count} buzzword phrase${count === 1 ? '' : 's'}: "${firstSample}"`)];
|
|
276
|
-
},
|
|
277
|
-
// Numbered section markers (01 / 02 / 03 ...)
|
|
278
|
-
(content, filePath) => {
|
|
279
|
-
const text = stripHtmlToText(content);
|
|
280
|
-
const re = /\b(0[1-9]|1[0-2])\b/g;
|
|
281
|
-
const seen = new Set();
|
|
282
|
-
let m;
|
|
283
|
-
while ((m = re.exec(text)) !== null) seen.add(m[1]);
|
|
284
|
-
if (seen.size < 3) return [];
|
|
285
|
-
const sorted = [...seen].sort();
|
|
286
|
-
let sequential = 0;
|
|
287
|
-
for (let i = 1; i < sorted.length; i++) {
|
|
288
|
-
if (parseInt(sorted[i], 10) === parseInt(sorted[i - 1], 10) + 1) sequential++;
|
|
289
|
-
}
|
|
290
|
-
if (sequential < 2) return [];
|
|
291
|
-
return [finding('numbered-section-markers', filePath, `Sequence: ${sorted.slice(0, 6).join(', ')}`)];
|
|
292
|
-
},
|
|
293
|
-
// Aphoristic cadence: manufactured-contrast + short-rebuttal
|
|
294
|
-
(content, filePath) => {
|
|
295
|
-
const text = stripHtmlToText(content);
|
|
296
|
-
const NOT_A_RE = /\bNot an? [a-z][^.!?]{1,40}[.!]\s+[A-Z][^.!?]{1,60}[.!]/g;
|
|
297
|
-
const SHORT_REBUTTAL_RE = /\b[A-Z][^.!?]{4,80}[.!]\s+(No|Just)\s+[a-z][^.!?]{2,60}[.!]/g;
|
|
298
|
-
let count = 0;
|
|
299
|
-
let firstSample = '';
|
|
300
|
-
let m;
|
|
301
|
-
NOT_A_RE.lastIndex = 0;
|
|
302
|
-
while ((m = NOT_A_RE.exec(text)) !== null) {
|
|
303
|
-
count++;
|
|
304
|
-
if (!firstSample) firstSample = m[0].trim().slice(0, 80);
|
|
305
|
-
}
|
|
306
|
-
SHORT_REBUTTAL_RE.lastIndex = 0;
|
|
307
|
-
while ((m = SHORT_REBUTTAL_RE.exec(text)) !== null) {
|
|
308
|
-
count++;
|
|
309
|
-
if (!firstSample) firstSample = m[0].trim().slice(0, 80);
|
|
310
|
-
}
|
|
311
|
-
if (count < 3) return [];
|
|
312
|
-
return [finding('aphoristic-cadence', filePath, `${count} aphoristic constructions: "${firstSample}"`)];
|
|
313
|
-
},
|
|
314
|
-
// Dark glow (page-level: dark bg + colored box-shadow with blur)
|
|
315
|
-
(content, filePath) => {
|
|
316
|
-
// Check if page has a dark background
|
|
317
|
-
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;
|
|
318
|
-
const twDarkBg = /\bbg-(?:gray|slate|zinc|neutral|stone)-(?:9\d{2}|800)\b/;
|
|
319
|
-
const hasDarkBg = darkBgRe.test(content) || twDarkBg.test(content);
|
|
320
|
-
if (!hasDarkBg) return [];
|
|
321
|
-
|
|
322
|
-
// Check for colored box-shadow with blur > 4px
|
|
323
|
-
const shadowRe = /box-shadow\s*:\s*([^;{}]+)/gi;
|
|
324
|
-
let m;
|
|
325
|
-
while ((m = shadowRe.exec(content)) !== null) {
|
|
326
|
-
const val = m[1];
|
|
327
|
-
const colorMatch = val.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
328
|
-
if (!colorMatch) continue;
|
|
329
|
-
const [r, g, b] = [+colorMatch[1], +colorMatch[2], +colorMatch[3]];
|
|
330
|
-
if ((Math.max(r, g, b) - Math.min(r, g, b)) < 30) continue; // skip gray
|
|
331
|
-
// Check blur: look for pattern like "0 0 20px" (third number > 4)
|
|
332
|
-
const pxVals = [...val.matchAll(/(\d+)px|(?<![.\d])\b(0)\b(?![.\d])/g)].map(p => +(p[1] || p[2]));
|
|
333
|
-
if (pxVals.length >= 3 && pxVals[2] > 4) {
|
|
334
|
-
const lines = content.substring(0, m.index).split('\n');
|
|
335
|
-
return [finding('dark-glow', filePath, `Colored glow (rgb(${r},${g},${b})) on dark page`, lines.length)];
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
return [];
|
|
339
|
-
},
|
|
340
|
-
];
|
|
341
|
-
|
|
342
|
-
// ---------------------------------------------------------------------------
|
|
343
|
-
// Style block extraction (Vue/Svelte <style> blocks)
|
|
344
|
-
// ---------------------------------------------------------------------------
|
|
345
|
-
|
|
346
|
-
function extractStyleBlocks(content, ext) {
|
|
347
|
-
ext = ext.toLowerCase();
|
|
348
|
-
if (ext !== '.vue' && ext !== '.svelte') return [];
|
|
349
|
-
const blocks = [];
|
|
350
|
-
const re = /<style[^>]*>([\s\S]*?)<\/style>/gi;
|
|
351
|
-
let m;
|
|
352
|
-
while ((m = re.exec(content)) !== null) {
|
|
353
|
-
const before = content.substring(0, m.index);
|
|
354
|
-
const startLine = before.split('\n').length + 1;
|
|
355
|
-
blocks.push({ content: m[1], startLine });
|
|
356
|
-
}
|
|
357
|
-
return blocks;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
// ---------------------------------------------------------------------------
|
|
361
|
-
// CSS-in-JS extraction (styled-components, emotion)
|
|
362
|
-
// ---------------------------------------------------------------------------
|
|
363
|
-
|
|
364
|
-
const CSS_IN_JS_EXTENSIONS = new Set(['.js', '.ts', '.jsx', '.tsx']);
|
|
365
|
-
|
|
366
|
-
function extractCSSinJS(content, ext) {
|
|
367
|
-
ext = ext.toLowerCase();
|
|
368
|
-
if (!CSS_IN_JS_EXTENSIONS.has(ext)) return [];
|
|
369
|
-
const blocks = [];
|
|
370
|
-
const re = /(?:styled(?:\.\w+|\([^)]+\))|css)\s*`([\s\S]*?)`/g;
|
|
371
|
-
let m;
|
|
372
|
-
while ((m = re.exec(content)) !== null) {
|
|
373
|
-
const before = content.substring(0, m.index);
|
|
374
|
-
const startLine = before.split('\n').length;
|
|
375
|
-
blocks.push({ content: m[1], startLine });
|
|
376
|
-
}
|
|
377
|
-
return blocks;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
function runRegexMatchers(lines, filePath, lineOffset = 0, blockContext = null, options = {}) {
|
|
381
|
-
const { profile, phase = 'regex-matchers' } = options || {};
|
|
382
|
-
const findings = [];
|
|
383
|
-
if (!profile) {
|
|
384
|
-
for (const matcher of REGEX_MATCHERS) {
|
|
385
|
-
for (let i = 0; i < lines.length; i++) {
|
|
386
|
-
const line = lines[i];
|
|
387
|
-
matcher.regex.lastIndex = 0;
|
|
388
|
-
let m;
|
|
389
|
-
while ((m = matcher.regex.exec(line)) !== null) {
|
|
390
|
-
// For extracted blocks, use nearby lines as context for multi-line CSS patterns
|
|
391
|
-
const context = blockContext
|
|
392
|
-
? lines.slice(Math.max(0, i - 3), Math.min(lines.length, i + 4)).join(' ')
|
|
393
|
-
: line;
|
|
394
|
-
if (matcher.test(m, context)) {
|
|
395
|
-
findings.push(finding(matcher.id, filePath, matcher.fmt(m, context), i + 1 + lineOffset));
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
return findings;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
for (const matcher of REGEX_MATCHERS) {
|
|
404
|
-
const matcherFindings = profileFindings(profile, {
|
|
405
|
-
engine: 'regex',
|
|
406
|
-
phase,
|
|
407
|
-
ruleId: matcher.id,
|
|
408
|
-
target: filePath,
|
|
409
|
-
}, () => {
|
|
410
|
-
const matches = [];
|
|
411
|
-
for (let i = 0; i < lines.length; i++) {
|
|
412
|
-
const line = lines[i];
|
|
413
|
-
matcher.regex.lastIndex = 0;
|
|
414
|
-
let m;
|
|
415
|
-
while ((m = matcher.regex.exec(line)) !== null) {
|
|
416
|
-
// For extracted blocks, use nearby lines as context for multi-line CSS patterns
|
|
417
|
-
const context = blockContext
|
|
418
|
-
? lines.slice(Math.max(0, i - 3), Math.min(lines.length, i + 4)).join(' ')
|
|
419
|
-
: line;
|
|
420
|
-
if (matcher.test(m, context)) {
|
|
421
|
-
matches.push(finding(matcher.id, filePath, matcher.fmt(m, context), i + 1 + lineOffset));
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
return matches;
|
|
426
|
-
});
|
|
427
|
-
findings.push(...matcherFindings);
|
|
428
|
-
}
|
|
429
|
-
return findings;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
/** Page-level analyzers that scan rendered text content (em-dash use,
|
|
433
|
-
* buzzword phrases, numbered section markers, aphoristic cadence).
|
|
434
|
-
* These are detector-agnostic — they work on any HTML/text source
|
|
435
|
-
* and don't need a parsed DOM. Exported so detectHtml can call them
|
|
436
|
-
* for `.html` files (which otherwise skip the regex engine). */
|
|
437
|
-
const TEXT_CONTENT_ANALYZER_IDS = [
|
|
438
|
-
'em-dash-overuse',
|
|
439
|
-
'marketing-buzzword',
|
|
440
|
-
'numbered-section-markers',
|
|
441
|
-
'aphoristic-cadence',
|
|
442
|
-
];
|
|
443
|
-
|
|
444
|
-
function runTextContentAnalyzers(content, filePath, options = {}) {
|
|
445
|
-
const profile = options?.profile;
|
|
446
|
-
if (!shouldRunPageAnalyzers(content, filePath)) return [];
|
|
447
|
-
// The 4 text-content analyzers are at indices 3-6 in REGEX_ANALYZERS.
|
|
448
|
-
const findings = [];
|
|
449
|
-
for (let i = 0; i < TEXT_CONTENT_ANALYZER_IDS.length; i++) {
|
|
450
|
-
const analyzer = REGEX_ANALYZERS[3 + i];
|
|
451
|
-
const ruleId = TEXT_CONTENT_ANALYZER_IDS[i];
|
|
452
|
-
findings.push(...profileFindings(profile, {
|
|
453
|
-
engine: 'regex',
|
|
454
|
-
phase: 'text-content',
|
|
455
|
-
ruleId,
|
|
456
|
-
target: filePath,
|
|
457
|
-
}, () => analyzer(content, filePath)));
|
|
458
|
-
}
|
|
459
|
-
return findings;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
function detectText(content, filePath, options = {}) {
|
|
463
|
-
const profile = options?.profile;
|
|
464
|
-
const findings = [];
|
|
465
|
-
const lines = content.split('\n');
|
|
466
|
-
const ext = extFromFilePath(filePath);
|
|
467
|
-
|
|
468
|
-
// Run regex matchers on the full file content (catches Tailwind classes, inline styles)
|
|
469
|
-
// Enable block context for CSS files where related properties span multiple lines
|
|
470
|
-
const cssLike = new Set(['.css', '.scss', '.sass', '.less']);
|
|
471
|
-
findings.push(...runRegexMatchers(lines, filePath, 0, cssLike.has(ext) || null, {
|
|
472
|
-
profile,
|
|
473
|
-
phase: 'source',
|
|
474
|
-
}));
|
|
475
|
-
|
|
476
|
-
// Extract and scan <style> blocks from Vue/Svelte SFCs
|
|
477
|
-
const styleBlocks = profile
|
|
478
|
-
? profileStep(profile, {
|
|
479
|
-
engine: 'regex',
|
|
480
|
-
phase: 'extract',
|
|
481
|
-
ruleId: 'style-blocks',
|
|
482
|
-
target: filePath,
|
|
483
|
-
}, () => extractStyleBlocks(content, ext))
|
|
484
|
-
: extractStyleBlocks(content, ext);
|
|
485
|
-
for (const block of styleBlocks) {
|
|
486
|
-
const blockLines = block.content.split('\n');
|
|
487
|
-
findings.push(...runRegexMatchers(blockLines, filePath, block.startLine - 1, true, {
|
|
488
|
-
profile,
|
|
489
|
-
phase: 'style-block',
|
|
490
|
-
}));
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
// Extract and scan CSS-in-JS template literals
|
|
494
|
-
const cssJsBlocks = profile
|
|
495
|
-
? profileStep(profile, {
|
|
496
|
-
engine: 'regex',
|
|
497
|
-
phase: 'extract',
|
|
498
|
-
ruleId: 'css-in-js',
|
|
499
|
-
target: filePath,
|
|
500
|
-
}, () => extractCSSinJS(content, ext))
|
|
501
|
-
: extractCSSinJS(content, ext);
|
|
502
|
-
for (const block of cssJsBlocks) {
|
|
503
|
-
const blockLines = block.content.split('\n');
|
|
504
|
-
findings.push(...runRegexMatchers(blockLines, filePath, block.startLine - 1, true, {
|
|
505
|
-
profile,
|
|
506
|
-
phase: 'css-in-js',
|
|
507
|
-
}));
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
if (options?.designSystem) {
|
|
511
|
-
findings.push(...profileFindings(profile, {
|
|
512
|
-
engine: 'regex',
|
|
513
|
-
phase: 'source',
|
|
514
|
-
ruleId: 'design-system',
|
|
515
|
-
target: filePath,
|
|
516
|
-
}, () => checkSourceDesignSystem(content, filePath, { designSystem: options.designSystem })));
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
// Deduplicate findings (same antipattern + similar snippet, within 2 lines)
|
|
520
|
-
const deduped = [];
|
|
521
|
-
for (const f of findings) {
|
|
522
|
-
const isDupe = deduped.some(d =>
|
|
523
|
-
d.antipattern === f.antipattern &&
|
|
524
|
-
d.snippet === f.snippet &&
|
|
525
|
-
Math.abs(d.line - f.line) <= 2
|
|
526
|
-
);
|
|
527
|
-
if (!isDupe) deduped.push(f);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
// Page-level analyzers only run on full pages
|
|
531
|
-
if (shouldRunPageAnalyzers(content, filePath)) {
|
|
532
|
-
const analyzerIds = [
|
|
533
|
-
'single-font',
|
|
534
|
-
'flat-type-hierarchy',
|
|
535
|
-
'monotonous-spacing',
|
|
536
|
-
'em-dash-overuse',
|
|
537
|
-
'marketing-buzzword',
|
|
538
|
-
'numbered-section-markers',
|
|
539
|
-
'aphoristic-cadence',
|
|
540
|
-
'dark-glow',
|
|
541
|
-
];
|
|
542
|
-
for (let i = 0; i < REGEX_ANALYZERS.length; i++) {
|
|
543
|
-
const analyzer = REGEX_ANALYZERS[i];
|
|
544
|
-
deduped.push(...profileFindings(profile, {
|
|
545
|
-
engine: 'regex',
|
|
546
|
-
phase: 'page-analyzer',
|
|
547
|
-
ruleId: analyzerIds[i] || `analyzer-${i + 1}`,
|
|
548
|
-
target: filePath,
|
|
549
|
-
}, () => analyzer(content, filePath)));
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
const byProvider = filterByProviders(deduped, options?.providers);
|
|
554
|
-
// Inline `impeccable-disable*` waivers travel with the file; honor them unless
|
|
555
|
-
// explicitly bypassed (`--no-config` / `--no-inline-ignores`).
|
|
556
|
-
return options?.inlineIgnores === false ? byProvider : applyInlineIgnores(byProvider, content);
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
export {
|
|
560
|
-
REGEX_MATCHERS,
|
|
561
|
-
REGEX_ANALYZERS,
|
|
562
|
-
TEXT_CONTENT_ANALYZER_IDS,
|
|
563
|
-
extractStyleBlocks,
|
|
564
|
-
extractCSSinJS,
|
|
565
|
-
runRegexMatchers,
|
|
566
|
-
runTextContentAnalyzers,
|
|
567
|
-
detectText,
|
|
568
|
-
};
|