self-evolving-workflow 0.0.0-stage → 0.1.4
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/LICENSE +27 -0
- package/README.md +195 -2
- package/dist/agent-memory-prompts.d.ts +13 -0
- package/dist/agent-memory-prompts.js +55 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +6 -0
- package/dist/closeout.d.ts +105 -0
- package/dist/closeout.js +473 -0
- package/dist/code.d.ts +39 -0
- package/dist/code.js +124 -0
- package/dist/codex-memory.d.ts +24 -0
- package/dist/codex-memory.js +217 -0
- package/dist/common.d.ts +16 -0
- package/dist/common.js +52 -0
- package/dist/context-envelope.d.ts +59 -0
- package/dist/context-envelope.js +23 -0
- package/dist/host-adapters.d.ts +34 -0
- package/dist/host-adapters.js +151 -0
- package/dist/http.d.ts +3 -0
- package/dist/http.js +90 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +13 -0
- package/dist/knowledge-cli.d.ts +198 -0
- package/dist/knowledge-cli.js +761 -0
- package/dist/knowledge-reads.d.ts +72 -0
- package/dist/knowledge-reads.js +201 -0
- package/dist/memory-config.d.ts +44 -0
- package/dist/memory-config.js +204 -0
- package/dist/memory-evidence.d.ts +13 -0
- package/dist/memory-evidence.js +40 -0
- package/dist/memory-history.d.ts +46 -0
- package/dist/memory-history.js +432 -0
- package/dist/memory.d.ts +96 -0
- package/dist/memory.js +362 -0
- package/dist/retrospective.d.ts +57 -0
- package/dist/retrospective.js +240 -0
- package/dist/search.d.ts +36 -0
- package/dist/search.js +112 -0
- package/dist/skill-addition.d.ts +25 -0
- package/dist/skill-addition.js +89 -0
- package/dist/skill-design.d.ts +96 -0
- package/dist/skill-design.js +226 -0
- package/dist/skill-replay.d.ts +55 -0
- package/dist/skill-replay.js +448 -0
- package/dist/skill-route.d.ts +30 -0
- package/dist/skill-route.js +75 -0
- package/dist/transcript-evidence.d.ts +3 -0
- package/dist/transcript-evidence.js +58 -0
- package/dist/upstream/chunker.d.ts +24 -0
- package/dist/upstream/chunker.js +96 -0
- package/dist/upstream/file-protocol.d.ts +45 -0
- package/dist/upstream/file-protocol.js +117 -0
- package/dist/upstream/frontmatter.d.ts +47 -0
- package/dist/upstream/frontmatter.js +86 -0
- package/dist/upstream/graph-search.d.ts +33 -0
- package/dist/upstream/graph-search.js +67 -0
- package/dist/upstream/l1-extraction.d.ts +26 -0
- package/dist/upstream/l1-extraction.js +405 -0
- package/dist/upstream/llm.d.ts +8 -0
- package/dist/upstream/llm.js +1 -0
- package/dist/upstream/merge.d.ts +50 -0
- package/dist/upstream/merge.js +153 -0
- package/dist/upstream/prompts.d.ts +53 -0
- package/dist/upstream/prompts.js +181 -0
- package/dist/upstream/search-utils.d.ts +34 -0
- package/dist/upstream/search-utils.js +55 -0
- package/dist/upstream/slug.d.ts +26 -0
- package/dist/upstream/slug.js +103 -0
- package/dist/upstream/template.d.ts +29 -0
- package/dist/upstream/template.js +80 -0
- package/dist/upstream/tokenize.d.ts +4 -0
- package/dist/upstream/tokenize.js +29 -0
- package/dist/wiki-change.d.ts +76 -0
- package/dist/wiki-change.js +299 -0
- package/dist/wiki-entry.d.ts +26 -0
- package/dist/wiki-entry.js +93 -0
- package/dist/wiki-ingest.d.ts +12 -0
- package/dist/wiki-ingest.js +126 -0
- package/dist/wiki-migration.d.ts +16 -0
- package/dist/wiki-migration.js +268 -0
- package/dist/wiki-tokens.d.ts +1 -0
- package/dist/wiki-tokens.js +46 -0
- package/dist/wiki.d.ts +103 -0
- package/dist/wiki.js +330 -0
- package/dist/workflow-cli.d.ts +2 -0
- package/dist/workflow-cli.js +319 -0
- package/dist/workflow-install.d.ts +37 -0
- package/dist/workflow-install.js +148 -0
- package/dist/workflow-knowledge.d.ts +18 -0
- package/dist/workflow-knowledge.js +32 -0
- package/dist/workflow-mcp.d.ts +2 -0
- package/dist/workflow-mcp.js +137 -0
- package/dist/workflow-names.d.ts +4 -0
- package/dist/workflow-names.js +31 -0
- package/dist/workflow-runtime.d.ts +735 -0
- package/dist/workflow-runtime.js +747 -0
- package/dist/workflow-skills.d.ts +48 -0
- package/dist/workflow-skills.js +141 -0
- package/docs/images/impeccable-skill.png +0 -0
- package/docs/images/workflow-overview.png +0 -0
- package/docs/images/workflow-skills.png +0 -0
- package/package.json +77 -4
- package/skills/ew-impeccable/LICENSE +191 -0
- package/skills/ew-impeccable/NOTICE.md +19 -0
- package/skills/ew-impeccable/SKILL.md +91 -0
- package/skills/ew-impeccable/UPSTREAM.md +23 -0
- package/skills/ew-impeccable/reference/adapt.md +314 -0
- package/skills/ew-impeccable/reference/adapt.native.md +60 -0
- package/skills/ew-impeccable/reference/android.md +46 -0
- package/skills/ew-impeccable/reference/animate.md +91 -0
- package/skills/ew-impeccable/reference/audit.md +138 -0
- package/skills/ew-impeccable/reference/audit.native.md +141 -0
- package/skills/ew-impeccable/reference/bolder.md +35 -0
- package/skills/ew-impeccable/reference/clarify.md +96 -0
- package/skills/ew-impeccable/reference/colorize.md +88 -0
- package/skills/ew-impeccable/reference/craft-floor.md +44 -0
- package/skills/ew-impeccable/reference/craft.md +5 -0
- package/skills/ew-impeccable/reference/critique.md +808 -0
- package/skills/ew-impeccable/reference/degraded/asset-producer.md +36 -0
- package/skills/ew-impeccable/reference/degraded/documenter.md +23 -0
- package/skills/ew-impeccable/reference/degraded/finish-reviewer.md +72 -0
- package/skills/ew-impeccable/reference/degraded/manual-edit-applier.md +91 -0
- package/skills/ew-impeccable/reference/delight.md +72 -0
- package/skills/ew-impeccable/reference/distill.md +113 -0
- package/skills/ew-impeccable/reference/doctor.md +56 -0
- package/skills/ew-impeccable/reference/document.md +418 -0
- package/skills/ew-impeccable/reference/extract.md +68 -0
- package/skills/ew-impeccable/reference/harden.md +338 -0
- package/skills/ew-impeccable/reference/hooks.md +113 -0
- package/skills/ew-impeccable/reference/init.md +133 -0
- package/skills/ew-impeccable/reference/ios.md +51 -0
- package/skills/ew-impeccable/reference/layout.md +86 -0
- package/skills/ew-impeccable/reference/live-setup.md +102 -0
- package/skills/ew-impeccable/reference/live.md +326 -0
- package/skills/ew-impeccable/reference/new-work.md +209 -0
- package/skills/ew-impeccable/reference/onboard.md +236 -0
- package/skills/ew-impeccable/reference/operate.md +61 -0
- package/skills/ew-impeccable/reference/optimize.md +260 -0
- package/skills/ew-impeccable/reference/overdrive.md +127 -0
- package/skills/ew-impeccable/reference/polish.md +105 -0
- package/skills/ew-impeccable/reference/quieter.md +101 -0
- package/skills/ew-impeccable/reference/routing.md +20 -0
- package/skills/ew-impeccable/reference/shape.md +59 -0
- package/skills/ew-impeccable/reference/typeset.md +82 -0
- package/skills/ew-impeccable/reference/visualize.md +46 -0
- package/skills/ew-impeccable/scripts/build-phase.mjs +1022 -0
- package/skills/ew-impeccable/scripts/command-metadata.json +94 -0
- package/skills/ew-impeccable/scripts/comp-diff.mjs +391 -0
- package/skills/ew-impeccable/scripts/comp-spec.mjs +513 -0
- package/skills/ew-impeccable/scripts/concept-seed.mjs +814 -0
- package/skills/ew-impeccable/scripts/context-signals.mjs +325 -0
- package/skills/ew-impeccable/scripts/context.mjs +1521 -0
- package/skills/ew-impeccable/scripts/critique-storage.mjs +473 -0
- package/skills/ew-impeccable/scripts/data/font-index-failures.json +121 -0
- package/skills/ew-impeccable/scripts/data/font-index.json +1 -0
- package/skills/ew-impeccable/scripts/detect-csp.mjs +246 -0
- package/skills/ew-impeccable/scripts/detect.mjs +30 -0
- package/skills/ew-impeccable/scripts/detector/browser/injected/index.mjs +2580 -0
- package/skills/ew-impeccable/scripts/detector/cli/main.mjs +498 -0
- package/skills/ew-impeccable/scripts/detector/design-system.mjs +1311 -0
- package/skills/ew-impeccable/scripts/detector/detect-antipatterns-browser.js +9486 -0
- package/skills/ew-impeccable/scripts/detector/detect-antipatterns.mjs +51 -0
- package/skills/ew-impeccable/scripts/detector/engines/browser/detect-url.mjs +434 -0
- package/skills/ew-impeccable/scripts/detector/engines/regex/detect-text.mjs +1439 -0
- package/skills/ew-impeccable/scripts/detector/engines/static-html/css-cascade.mjs +1242 -0
- package/skills/ew-impeccable/scripts/detector/engines/static-html/detect-html.mjs +263 -0
- package/skills/ew-impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +189 -0
- package/skills/ew-impeccable/scripts/detector/findings.mjs +23 -0
- package/skills/ew-impeccable/scripts/detector/node/file-system.mjs +225 -0
- package/skills/ew-impeccable/scripts/detector/profile/profiler.mjs +166 -0
- package/skills/ew-impeccable/scripts/detector/registry/antipatterns.mjs +636 -0
- package/skills/ew-impeccable/scripts/detector/rules/checks.mjs +5750 -0
- package/skills/ew-impeccable/scripts/detector/shared/color.mjs +596 -0
- package/skills/ew-impeccable/scripts/detector/shared/constants.mjs +127 -0
- package/skills/ew-impeccable/scripts/detector/shared/fonts.mjs +30 -0
- package/skills/ew-impeccable/scripts/detector/shared/inline-ignores.mjs +148 -0
- package/skills/ew-impeccable/scripts/detector/shared/page.mjs +7 -0
- package/skills/ew-impeccable/scripts/detector/vendor/MDN-DATA-LICENSE +116 -0
- package/skills/ew-impeccable/scripts/detector/vendor/THIRD_PARTY_LICENSES.md +227 -0
- package/skills/ew-impeccable/scripts/detector/vendor/static-html-parser.build-entry.txt +11 -0
- package/skills/ew-impeccable/scripts/detector/vendor/static-html-parser.bundle.mjs +9121 -0
- package/skills/ew-impeccable/scripts/doctor.mjs +330 -0
- package/skills/ew-impeccable/scripts/embed-prompt.mjs +166 -0
- package/skills/ew-impeccable/scripts/font-match.mjs +457 -0
- package/skills/ew-impeccable/scripts/generate-image.mjs +447 -0
- package/skills/ew-impeccable/scripts/hook-admin.mjs +829 -0
- package/skills/ew-impeccable/scripts/hook-before-edit.mjs +538 -0
- package/skills/ew-impeccable/scripts/hook-lib.mjs +2493 -0
- package/skills/ew-impeccable/scripts/hook.mjs +79 -0
- package/skills/ew-impeccable/scripts/lib/artifact-schema.mjs +93 -0
- package/skills/ew-impeccable/scripts/lib/composition-catalog.mjs +200 -0
- package/skills/ew-impeccable/scripts/lib/concept-catalog.mjs +395 -0
- package/skills/ew-impeccable/scripts/lib/design-parser.mjs +880 -0
- package/skills/ew-impeccable/scripts/lib/font-fingerprint.mjs +564 -0
- package/skills/ew-impeccable/scripts/lib/font-index.mjs +130 -0
- package/skills/ew-impeccable/scripts/lib/hero-checks.mjs +246 -0
- package/skills/ew-impeccable/scripts/lib/image-metrics.mjs +306 -0
- package/skills/ew-impeccable/scripts/lib/impeccable-config.mjs +640 -0
- package/skills/ew-impeccable/scripts/lib/impeccable-paths.mjs +137 -0
- package/skills/ew-impeccable/scripts/lib/is-generated.mjs +72 -0
- package/skills/ew-impeccable/scripts/lib/live-path-globs.mjs +37 -0
- package/skills/ew-impeccable/scripts/lib/open-system-browser.mjs +26 -0
- package/skills/ew-impeccable/scripts/lib/png.mjs +281 -0
- package/skills/ew-impeccable/scripts/lib/provider.mjs +5 -0
- package/skills/ew-impeccable/scripts/lib/raster.mjs +194 -0
- package/skills/ew-impeccable/scripts/lib/roll-selection.mjs +369 -0
- package/skills/ew-impeccable/scripts/lib/staleness-deep.mjs +491 -0
- package/skills/ew-impeccable/scripts/lib/staleness-notice.mjs +169 -0
- package/skills/ew-impeccable/scripts/lib/staleness.mjs +532 -0
- package/skills/ew-impeccable/scripts/lib/surface-briefs.mjs +149 -0
- package/skills/ew-impeccable/scripts/lib/target-args.mjs +42 -0
- package/skills/ew-impeccable/scripts/lib/target-slug.mjs +33 -0
- package/skills/ew-impeccable/scripts/lib/template-extensions.mjs +146 -0
- package/skills/ew-impeccable/scripts/live/accept-css.mjs +617 -0
- package/skills/ew-impeccable/scripts/live/accept-verify.mjs +60 -0
- package/skills/ew-impeccable/scripts/live/browser-script-parts.mjs +84 -0
- package/skills/ew-impeccable/scripts/live/completion.mjs +28 -0
- package/skills/ew-impeccable/scripts/live/event-validation.mjs +199 -0
- package/skills/ew-impeccable/scripts/live/frameworks/astro.mjs +47 -0
- package/skills/ew-impeccable/scripts/live/frameworks/detect-utils.mjs +73 -0
- package/skills/ew-impeccable/scripts/live/frameworks/index.mjs +143 -0
- package/skills/ew-impeccable/scripts/live/frameworks/journal.mjs +197 -0
- package/skills/ew-impeccable/scripts/live/frameworks/nextjs.mjs +49 -0
- package/skills/ew-impeccable/scripts/live/frameworks/nuxt.mjs +161 -0
- package/skills/ew-impeccable/scripts/live/frameworks/script-src.mjs +17 -0
- package/skills/ew-impeccable/scripts/live/frameworks/static-html.mjs +26 -0
- package/skills/ew-impeccable/scripts/live/frameworks/sveltekit.mjs +71 -0
- package/skills/ew-impeccable/scripts/live/frameworks/tag-strategy.mjs +247 -0
- package/skills/ew-impeccable/scripts/live/frameworks/tanstack-start.mjs +70 -0
- package/skills/ew-impeccable/scripts/live/frameworks/vite-generic.mjs +42 -0
- package/skills/ew-impeccable/scripts/live/generation-preflight.mjs +149 -0
- package/skills/ew-impeccable/scripts/live/insert-ui.mjs +458 -0
- package/skills/ew-impeccable/scripts/live/instructions.mjs +142 -0
- package/skills/ew-impeccable/scripts/live/manual-apply.mjs +939 -0
- package/skills/ew-impeccable/scripts/live/manual-edit-routes.mjs +357 -0
- package/skills/ew-impeccable/scripts/live/manual-edits-buffer.mjs +152 -0
- package/skills/ew-impeccable/scripts/live/poll-lanes.mjs +14 -0
- package/skills/ew-impeccable/scripts/live/project-ignores.mjs +139 -0
- package/skills/ew-impeccable/scripts/live/roots.mjs +508 -0
- package/skills/ew-impeccable/scripts/live/session-store.mjs +563 -0
- package/skills/ew-impeccable/scripts/live/source-lock.mjs +105 -0
- package/skills/ew-impeccable/scripts/live/source-search.mjs +105 -0
- package/skills/ew-impeccable/scripts/live/svelte-ast.mjs +969 -0
- package/skills/ew-impeccable/scripts/live/svelte-component.mjs +1366 -0
- package/skills/ew-impeccable/scripts/live/sveltekit-adapter.mjs +304 -0
- package/skills/ew-impeccable/scripts/live/tanstack-adapter.mjs +259 -0
- package/skills/ew-impeccable/scripts/live/ui-surfaces.mjs +75 -0
- package/skills/ew-impeccable/scripts/live/vocabulary.mjs +171 -0
- package/skills/ew-impeccable/scripts/live-accept.mjs +938 -0
- package/skills/ew-impeccable/scripts/live-browser-dom.js +167 -0
- package/skills/ew-impeccable/scripts/live-browser-ignores.js +242 -0
- package/skills/ew-impeccable/scripts/live-browser-session.js +144 -0
- package/skills/ew-impeccable/scripts/live-browser.js +12851 -0
- package/skills/ew-impeccable/scripts/live-commit-manual-edits.mjs +1200 -0
- package/skills/ew-impeccable/scripts/live-complete.mjs +107 -0
- package/skills/ew-impeccable/scripts/live-copy-edit-agent.mjs +800 -0
- package/skills/ew-impeccable/scripts/live-discard-manual-edits.mjs +51 -0
- package/skills/ew-impeccable/scripts/live-inject.mjs +463 -0
- package/skills/ew-impeccable/scripts/live-insert.mjs +292 -0
- package/skills/ew-impeccable/scripts/live-manual-edit-evidence.mjs +368 -0
- package/skills/ew-impeccable/scripts/live-poll.mjs +430 -0
- package/skills/ew-impeccable/scripts/live-resume.mjs +123 -0
- package/skills/ew-impeccable/scripts/live-server.mjs +1698 -0
- package/skills/ew-impeccable/scripts/live-status.mjs +71 -0
- package/skills/ew-impeccable/scripts/live-target.mjs +30 -0
- package/skills/ew-impeccable/scripts/live-wrap.mjs +927 -0
- package/skills/ew-impeccable/scripts/live.mjs +334 -0
- package/skills/ew-impeccable/scripts/modern-screenshot.umd.js +14 -0
- package/skills/ew-impeccable/scripts/palette.mjs +628 -0
- package/skills/ew-impeccable/scripts/pin.mjs +352 -0
- package/skills/ew-impeccable/scripts/serve-question.mjs +1783 -0
- package/skills/ew-impeccable/scripts/surface-brief.mjs +74 -0
- package/skills/ew-knowledge/SKILL.md +35 -0
- package/skills/ew-knowledge/references/closeout-protocol.md +68 -0
- package/skills/ew-knowledge/references/knowledge-route.md +73 -0
- package/skills/ew-knowledge/references/wiki-maintenance.md +27 -0
- package/skills/ew-odyssey/SKILL.md +106 -0
- package/skills/ew-odyssey/references/audit-artifacts.md +7 -0
- package/skills/ew-odyssey/references/odyssey-base.md +104 -0
- package/skills/ew-odyssey/references/odyssey-debug.md +264 -0
- package/skills/ew-odyssey/references/odyssey-defensive.md +351 -0
- package/skills/ew-odyssey/references/odyssey-improve.md +230 -0
- package/skills/ew-odyssey/references/odyssey-planex.md +294 -0
- package/skills/ew-odyssey/references/odyssey-review.md +233 -0
- package/skills/ew-odyssey/references/odyssey-security.md +231 -0
- package/skills/ew-odyssey/references/odyssey-ui.md +232 -0
- package/skills/ew-odyssey/references/prepare/odyssey-debug.md +102 -0
- package/skills/ew-odyssey/references/prepare/odyssey-defensive.md +117 -0
- package/skills/ew-odyssey/references/prepare/odyssey-improve.md +95 -0
- package/skills/ew-odyssey/references/prepare/odyssey-planex.md +105 -0
- package/skills/ew-odyssey/references/prepare/odyssey-review.md +105 -0
- package/skills/ew-odyssey/references/prepare/odyssey-security.md +91 -0
- package/skills/ew-odyssey/references/prepare/odyssey-ui.md +88 -0
- package/skills/ew-odyssey/references/runtime-adapters.md +31 -0
- package/skills/ew-orchestrate/SKILL.md +89 -0
- package/skills/ew-orchestrate/references/auto-policy.md +66 -0
- package/skills/ew-orchestrate/references/boundary-grill.md +51 -0
- package/skills/ew-orchestrate/references/companion-route.md +40 -0
- package/skills/ew-orchestrate/references/ew-orchestrate.md +44 -0
- package/skills/ew-orchestrate/references/goal.md +51 -0
- package/skills/ew-orchestrate/references/orchestrator-run-loop.md +33 -0
- package/skills/ew-orchestrate/references/planning.md +54 -0
- package/skills/ew-orchestrate/steps/ew-analyze/SKILL.md +70 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/issue-gaps-analyze.md +24 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/prepare.md +8 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/workflow.md +138 -0
- package/skills/ew-orchestrate/steps/ew-auto-test/SKILL.md +80 -0
- package/skills/ew-orchestrate/steps/ew-auto-test/references/prepare.md +23 -0
- package/skills/ew-orchestrate/steps/ew-auto-test/references/workflow.md +31 -0
- package/skills/ew-orchestrate/steps/ew-blueprint/SKILL.md +122 -0
- package/skills/ew-orchestrate/steps/ew-blueprint/references/prepare.md +21 -0
- package/skills/ew-orchestrate/steps/ew-blueprint/references/workflow.md +28 -0
- package/skills/ew-orchestrate/steps/ew-brainstorm/SKILL.md +49 -0
- package/skills/ew-orchestrate/steps/ew-companion/SKILL.md +50 -0
- package/skills/ew-orchestrate/steps/ew-debug/SKILL.md +85 -0
- package/skills/ew-orchestrate/steps/ew-debug/references/prepare.md +27 -0
- package/skills/ew-orchestrate/steps/ew-debug/references/workflow.md +31 -0
- package/skills/ew-orchestrate/steps/ew-execute/SKILL.md +74 -0
- package/skills/ew-orchestrate/steps/ew-execute/references/prepare.md +27 -0
- package/skills/ew-orchestrate/steps/ew-execute/references/workflow.md +87 -0
- package/skills/ew-orchestrate/steps/ew-grill/SKILL.md +62 -0
- package/skills/ew-orchestrate/steps/ew-grill/references/prepare.md +26 -0
- package/skills/ew-orchestrate/steps/ew-grill/references/workflow.md +31 -0
- package/skills/ew-orchestrate/steps/ew-init/SKILL.md +56 -0
- package/skills/ew-orchestrate/steps/ew-init/references/prepare.md +25 -0
- package/skills/ew-orchestrate/steps/ew-init/references/workflow.md +28 -0
- package/skills/ew-orchestrate/steps/ew-plan/SKILL.md +131 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/prepare.md +8 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/tdd.md +53 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/workflow.md +100 -0
- package/skills/ew-orchestrate/steps/ew-retrospective/SKILL.md +68 -0
- package/skills/ew-orchestrate/steps/ew-retrospective/references/prepare.md +18 -0
- package/skills/ew-orchestrate/steps/ew-retrospective/references/workflow.md +34 -0
- package/skills/ew-orchestrate/steps/ew-review/SKILL.md +45 -0
- package/skills/ew-orchestrate/steps/ew-review/references/prepare.md +17 -0
- package/skills/ew-orchestrate/steps/ew-review/references/workflow.md +116 -0
- package/skills/ew-orchestrate/steps/ew-roadmap/SKILL.md +62 -0
- package/skills/ew-orchestrate/steps/ew-roadmap/references/prepare.md +27 -0
- package/skills/ew-orchestrate/steps/ew-roadmap/references/workflow.md +28 -0
- package/skills/ew-orchestrate/steps/ew-test/SKILL.md +99 -0
- package/skills/ew-orchestrate/steps/ew-test/references/prepare.md +23 -0
- package/skills/ew-orchestrate/steps/ew-test/references/workflow.md +23 -0
- package/skills/ew-orchestrate/steps/ew-verify/SKILL.md +73 -0
- package/skills/ew-orchestrate/steps/ew-verify/references/prepare.md +21 -0
- package/skills/ew-orchestrate/steps/ew-verify/references/workflow.md +29 -0
- package/skills/ew-skill-design/SKILL.md +30 -0
- package/skills/ew-skill-design/references/package-contract.md +40 -0
- package/skills/ew-skill-design/references/validation.md +21 -0
- package/skills/team-swarm/SKILL.md +68 -0
- package/skills/team-swarm/references/mcp-coordination.md +14 -0
- package/skills/team-swarm/roles/analyst/role.md +181 -0
- package/skills/team-swarm/roles/ant/role.md +149 -0
- package/skills/team-swarm/roles/coordinator/commands/converge.md +112 -0
- package/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
- package/skills/team-swarm/roles/coordinator/commands/iterate.md +171 -0
- package/skills/team-swarm/roles/coordinator/role.md +170 -0
- package/skills/team-swarm/roles/scorer/role.md +150 -0
- package/skills/team-swarm/scripts/aco.py +646 -0
- package/skills/team-swarm/scripts/pheromone.py +144 -0
- package/skills/team-swarm/scripts/scoring.py +111 -0
- package/skills/team-swarm/scripts/test_aco.py +606 -0
- package/skills/team-swarm/specs/ant-output-schema.md +127 -0
- package/skills/team-swarm/specs/convergence-criteria.md +108 -0
- package/skills/team-swarm/specs/pheromone-schema.md +125 -0
- package/skills/team-swarm/specs/swarm-config-template.json +71 -0
- package/skills/team-swarm/specs/swarm-protocol.md +119 -0
- package/skills/workflow-evolve/SKILL.md +64 -0
- package/skills/workflow-evolve/references/agy-gate.md +27 -0
- package/skills/workflow-evolve/references/auto-loop.md +23 -0
- package/skills/workflow-evolve/references/history-review.md +15 -0
- package/skills/workflow-evolve/scripts/codex-memory-replay.mjs +86 -0
- package/skills/workflow-evolve/scripts/codex-replay.mjs +1 -0
- package/skills/workflow-evolve/scripts/evolve-loop.mjs +260 -0
- package/skills/workflow-evolve/scripts/memory-codex-mcp.mjs +124 -0
- package/workflows/index.json +33 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { OVERUSED_FONTS, primaryFontFace } 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 { deriveAdvisoryFlag, finding } from '../../findings.mjs';
|
|
13
|
+
import { profileFindings, profileStep, profileStepAsync } from '../../profile/profiler.mjs';
|
|
14
|
+
import {
|
|
15
|
+
checkElementBorders,
|
|
16
|
+
checkElementClippedOverflow,
|
|
17
|
+
checkElementColors,
|
|
18
|
+
checkElementGlow,
|
|
19
|
+
checkElementGptBorderShadow,
|
|
20
|
+
checkElementHeroEyebrow,
|
|
21
|
+
checkElementHoverContrast,
|
|
22
|
+
checkElementIconTile,
|
|
23
|
+
checkElementItalicSerif,
|
|
24
|
+
checkElementMotion,
|
|
25
|
+
checkElementOversizedH1,
|
|
26
|
+
checkElementQuality,
|
|
27
|
+
checkElementRadialSpotlight,
|
|
28
|
+
checkFlatTypeHierarchyFromDoc,
|
|
29
|
+
checkCreamPalette,
|
|
30
|
+
checkHtmlPatterns,
|
|
31
|
+
checkKickerAboveHeadingFromDoc,
|
|
32
|
+
scopedIgnoreActive,
|
|
33
|
+
checkNumberedSectionLabelsFromDoc,
|
|
34
|
+
checkPageLayout,
|
|
35
|
+
checkPageQualityFromDoc,
|
|
36
|
+
checkRepeatedContainerTextFromDoc,
|
|
37
|
+
resolveBackground,
|
|
38
|
+
resolveBorderRadiusPx,
|
|
39
|
+
} from '../../rules/checks.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 primary = primaryFontFace(window.getComputedStyle(el).fontFamily);
|
|
56
|
+
if (!primary) continue;
|
|
57
|
+
fonts.add(primary);
|
|
58
|
+
if (OVERUSED_FONTS.has(primary)) overusedFound.add(primary);
|
|
59
|
+
}
|
|
60
|
+
for (const font of overusedFound) {
|
|
61
|
+
findings.push({ id: 'overused-font', snippet: `Primary font: ${font}` });
|
|
62
|
+
}
|
|
63
|
+
findings.push(...checkFlatTypeHierarchyFromDoc(document, el => window.getComputedStyle(el)));
|
|
64
|
+
return findings;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function checkElementBrokenImage(el) {
|
|
68
|
+
const src = (el.getAttribute && el.getAttribute('src')) ?? el.attribs?.src;
|
|
69
|
+
// Missing src attribute entirely
|
|
70
|
+
if (src === undefined || src === null) {
|
|
71
|
+
return [{ id: 'broken-image', snippet: '<img> with no src attribute' }];
|
|
72
|
+
}
|
|
73
|
+
const trimmed = String(src).trim();
|
|
74
|
+
// Empty or placeholder-only src values
|
|
75
|
+
if (trimmed === '' || trimmed === '#') {
|
|
76
|
+
return [{ id: 'broken-image', snippet: `<img src="${src}">` }];
|
|
77
|
+
}
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const STATIC_ELEMENT_RULES = [
|
|
82
|
+
{ id: 'border-rules', selector: '*', run: (el, tag, style, window, customPropMap) => checkElementBorders(tag, style, null, resolveBorderRadiusPx(el, style, parseFloat(style.width) || 0, window), el) },
|
|
83
|
+
{ id: 'color-rules', selector: '*', run: (el, tag, style, window, customPropMap) => checkElementColors(el, style, tag, window, customPropMap, false) },
|
|
84
|
+
{ id: 'hover-color-rules', selector: '*', run: (el, tag, style, window) => checkElementHoverContrast(el, style, tag, window) },
|
|
85
|
+
{ id: 'dark-glow', selector: '*', run: (el, tag, style, window, customPropMap) => checkElementGlow(tag, style, resolveBackground(el.parentElement || el, window, customPropMap)) },
|
|
86
|
+
{ id: 'motion-rules', selector: '*', run: (el, tag, style) => checkElementMotion(tag, style) },
|
|
87
|
+
{ id: 'icon-tile-stack', selector: 'h1,h2,h3,h4,h5,h6', run: (el, tag, _style, window) => checkElementIconTile(el, tag, window) },
|
|
88
|
+
{ id: 'italic-serif-display', selector: 'h1,h2', run: (el, tag, style) => checkElementItalicSerif(el, style, tag) },
|
|
89
|
+
{ id: 'hero-eyebrow-chip', selector: 'h1', run: (el, tag, style, window, customPropMap) => checkElementHeroEyebrow(el, style, tag, window, customPropMap) },
|
|
90
|
+
{ id: 'broken-image', selector: 'img', run: (el) => checkElementBrokenImage(el) },
|
|
91
|
+
{ id: 'quality-rules', selector: '*', run: (el, tag, style, window) => checkElementQuality(el, style, tag, window) },
|
|
92
|
+
{ id: 'oversized-h1', selector: 'h1', run: (el, tag, style, window) => checkElementOversizedH1(el, style, tag, window) },
|
|
93
|
+
{ id: 'clipped-overflow-container', selector: '*', run: (el, tag, style, window) => checkElementClippedOverflow(el, style, tag, window) },
|
|
94
|
+
{ id: 'gpt-thin-border-wide-shadow', selector: '*', run: (el, tag, style) => checkElementGptBorderShadow(el, style) },
|
|
95
|
+
{ id: 'radial-spotlight-glow', selector: '*', run: (el, tag, style, window) => checkElementRadialSpotlight(el, style, tag, window) },
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
async function detectHtml(filePath, options = {}) {
|
|
99
|
+
const profile = options?.profile;
|
|
100
|
+
const html = profileStep(profile, {
|
|
101
|
+
engine: 'static-html',
|
|
102
|
+
phase: 'setup',
|
|
103
|
+
ruleId: 'read-html',
|
|
104
|
+
target: filePath,
|
|
105
|
+
}, () => fs.readFileSync(filePath, 'utf-8'));
|
|
106
|
+
|
|
107
|
+
let modules;
|
|
108
|
+
try {
|
|
109
|
+
modules = await profileStepAsync(profile, {
|
|
110
|
+
engine: 'static-html',
|
|
111
|
+
phase: 'setup',
|
|
112
|
+
ruleId: 'import-static-parser',
|
|
113
|
+
target: filePath,
|
|
114
|
+
}, async () => import('../../vendor/static-html-parser.bundle.mjs'));
|
|
115
|
+
} catch (err) {
|
|
116
|
+
if (!globalThis.__impeccableStaticHtmlWarned) {
|
|
117
|
+
globalThis.__impeccableStaticHtmlWarned = true;
|
|
118
|
+
|
|
119
|
+
process.stderr.write(
|
|
120
|
+
'impeccable detect: DEGRADED - HTML parser modules unavailable ' +
|
|
121
|
+
'(htmlparser2, css-select, css-tree, domutils).\n' +
|
|
122
|
+
'Falling back to regex matching. Custom properties, selector matching and computed ' +
|
|
123
|
+
'contrast are NOT evaluated; findings are an undercount, not a clean bill of health.\n'
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return detectText(html, filePath, options);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const resolvedPath = path.resolve(filePath);
|
|
131
|
+
const fileDir = path.dirname(resolvedPath);
|
|
132
|
+
const root = profileStep(profile, {
|
|
133
|
+
engine: 'static-html',
|
|
134
|
+
phase: 'parse-html',
|
|
135
|
+
ruleId: 'parse-document',
|
|
136
|
+
target: filePath,
|
|
137
|
+
}, () => modules.parseDocument(html, { lowerCaseAttributeNames: false, lowerCaseTags: true }));
|
|
138
|
+
|
|
139
|
+
const cssText = collectStaticCssText(root, fileDir, profile, filePath, modules);
|
|
140
|
+
const document = new StaticDocument(root, modules);
|
|
141
|
+
buildStaticStyleMap(root, document, cssText, modules, profile, filePath);
|
|
142
|
+
const window = buildStaticWindow(document);
|
|
143
|
+
|
|
144
|
+
const customPropMap = null;
|
|
145
|
+
|
|
146
|
+
const findings = [];
|
|
147
|
+
const runElementCheck = (ruleId, callback) => profile
|
|
148
|
+
? profileFindings(profile, { engine: 'static-html', phase: 'element', ruleId, target: filePath }, callback)
|
|
149
|
+
: callback();
|
|
150
|
+
|
|
151
|
+
const visitedByRule = new Map();
|
|
152
|
+
for (const rule of STATIC_ELEMENT_RULES) {
|
|
153
|
+
const elements = document.querySelectorAll(rule.selector);
|
|
154
|
+
visitedByRule.set(rule.id, elements.length);
|
|
155
|
+
for (const el of elements) {
|
|
156
|
+
const tag = el.tagName.toLowerCase();
|
|
157
|
+
const style = window.getComputedStyle(el);
|
|
158
|
+
for (const f of runElementCheck(rule.id, () => rule.run(el, tag, style, window, customPropMap))) {
|
|
159
|
+
// Element-scoped waivers: a data-impeccable-ignore ancestor suppresses
|
|
160
|
+
// matching findings for its subtree, same as the browser walk.
|
|
161
|
+
if (scopedIgnoreActive(el, f.id)) continue;
|
|
162
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (options?.designSystem) {
|
|
168
|
+
const sourceDesignFindings = profileFindings(profile, {
|
|
169
|
+
engine: 'static-html',
|
|
170
|
+
phase: 'source',
|
|
171
|
+
ruleId: 'design-system',
|
|
172
|
+
target: filePath,
|
|
173
|
+
}, () => checkSourceDesignSystem(html, filePath, { designSystem: options.designSystem }));
|
|
174
|
+
const staticDesignFindings = profileFindings(profile, {
|
|
175
|
+
engine: 'static-html',
|
|
176
|
+
phase: 'page',
|
|
177
|
+
ruleId: 'design-system',
|
|
178
|
+
target: filePath,
|
|
179
|
+
}, () => collectStaticDesignSystemFindings(document, window, filePath, options.designSystem));
|
|
180
|
+
findings.push(...mergeDesignSystemFindings(staticDesignFindings, sourceDesignFindings));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (isFullPage(html)) {
|
|
184
|
+
const runPageCheck = (ruleId, callback) => profile
|
|
185
|
+
? profileFindings(profile, { engine: 'static-html', phase: 'page', ruleId, target: filePath }, callback)
|
|
186
|
+
: callback();
|
|
187
|
+
for (const f of runPageCheck('typography-rules', () => checkStaticPageTypography(document, window))) {
|
|
188
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
189
|
+
}
|
|
190
|
+
for (const f of runPageCheck('kicker-above-heading', () => checkKickerAboveHeadingFromDoc(document, window))) {
|
|
191
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
192
|
+
}
|
|
193
|
+
for (const f of runPageCheck('numbered-section-labels', () => checkNumberedSectionLabelsFromDoc(document, window))) {
|
|
194
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
195
|
+
}
|
|
196
|
+
for (const f of runPageCheck('repeated-container-text', () => checkRepeatedContainerTextFromDoc(document, window))) {
|
|
197
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
198
|
+
}
|
|
199
|
+
for (const f of runPageCheck('layout-rules', () => checkPageLayout(document, window))) {
|
|
200
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
201
|
+
}
|
|
202
|
+
for (const f of runPageCheck('cream-palette', () => checkCreamPalette(document, window))) {
|
|
203
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
204
|
+
}
|
|
205
|
+
for (const f of runPageCheck('skipped-heading', () => checkPageQualityFromDoc(document))) {
|
|
206
|
+
findings.push(finding(f.id, filePath, f.snippet));
|
|
207
|
+
}
|
|
208
|
+
// Scoped corpora for the pattern checks (see buildHtmlPatternCorpora in
|
|
209
|
+
// rules/checks.mjs): CSS-property regexes must not fire on prose ABOUT
|
|
210
|
+
// css — `<code>background-clip: text</code>` in a changelog is
|
|
211
|
+
// documentation, not styling. cssText already carries the <style>
|
|
212
|
+
// blocks and any linked local stylesheets; style/class attributes come
|
|
213
|
+
// from the parsed document, so escaped code samples never contribute.
|
|
214
|
+
const styleAttrParts = [];
|
|
215
|
+
const classAttrParts = [];
|
|
216
|
+
for (const el of document.querySelectorAll('*')) {
|
|
217
|
+
const styleAttr = el.getAttribute('style');
|
|
218
|
+
if (styleAttr) styleAttrParts.push(`style="${styleAttr}"`);
|
|
219
|
+
const classAttr = el.getAttribute('class');
|
|
220
|
+
if (classAttr) classAttrParts.push(classAttr);
|
|
221
|
+
}
|
|
222
|
+
const patternCorpora = {
|
|
223
|
+
styleText: [cssText, ...styleAttrParts].join('\n'),
|
|
224
|
+
classText: classAttrParts.join('\n'),
|
|
225
|
+
};
|
|
226
|
+
for (const f of runPageCheck('html-patterns', () => checkHtmlPatterns(html, patternCorpora).filter(item =>
|
|
227
|
+
item.id !== 'bounce-easing' && item.id !== 'layout-transition'
|
|
228
|
+
))) {
|
|
229
|
+
// Selector-backed page findings honor scoped waivers here too, matching
|
|
230
|
+
// the browser pass: resolve the selector and drop the finding when an
|
|
231
|
+
// ignoring ancestor covers a match. Unlike the browser, an unmatched
|
|
232
|
+
// selector keeps the finding — static scans see partial documents.
|
|
233
|
+
if (f.selector) {
|
|
234
|
+
let matches = null;
|
|
235
|
+
try {
|
|
236
|
+
matches = document.querySelectorAll(String(f.selector).replace(/::?[a-zA-Z-]+(\([^)]*\))?/g, '').trim());
|
|
237
|
+
} catch { matches = null; }
|
|
238
|
+
if (matches && matches.length > 0 && [...matches].every(el => scopedIgnoreActive(el, f.id))) continue;
|
|
239
|
+
}
|
|
240
|
+
const item = finding(f.id, filePath, f.snippet);
|
|
241
|
+
// Position-aware severity promotion: checks may attach a per-finding
|
|
242
|
+
// severity (e.g. a pulsing dot inside a header/nav landmark) that
|
|
243
|
+
// overrides the registry default.
|
|
244
|
+
if (f.severity) item.severity = f.severity;
|
|
245
|
+
findings.push(deriveAdvisoryFlag(item));
|
|
246
|
+
}
|
|
247
|
+
// Text-content analyzers (em-dash overuse, marketing buzzwords,
|
|
248
|
+
// numbered section markers, aphoristic cadence) live in the regex
|
|
249
|
+
// engine. Call them from here so .html files get the same coverage
|
|
250
|
+
// as .css/.tsx files. These are scoped to text content only and
|
|
251
|
+
// don't overlap with static-html's element/page rules.
|
|
252
|
+
for (const f of runPageCheck('text-content', () => runTextContentAnalyzers(html, filePath, options))) {
|
|
253
|
+
findings.push(finding(f.antipattern, filePath, f.snippet));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Static-HTML findings carry no line number, so only whole-file
|
|
258
|
+
// `impeccable-disable` directives apply here — exactly the standalone-document
|
|
259
|
+
// waiver this primitive targets. Bypassed by `--no-config` / `--no-inline-ignores`.
|
|
260
|
+
return options?.inlineIgnores === false ? findings : applyInlineIgnores(findings, html);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export { checkStaticPageTypography, STATIC_ELEMENT_RULES, detectHtml };
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
function sanitizeScreenshotClip(clip, viewport) {
|
|
2
|
+
if (!clip) return null;
|
|
3
|
+
const x = Math.max(0, Math.floor(clip.x || 0));
|
|
4
|
+
const y = Math.max(0, Math.floor(clip.y || 0));
|
|
5
|
+
const width = Math.min(
|
|
6
|
+
Math.max(1, Math.ceil(clip.width || 0)),
|
|
7
|
+
Math.max(1, viewport?.width || 1600),
|
|
8
|
+
);
|
|
9
|
+
const height = Math.min(
|
|
10
|
+
Math.max(1, Math.ceil(clip.height || 0)),
|
|
11
|
+
320,
|
|
12
|
+
);
|
|
13
|
+
if (width < 1 || height < 1) return null;
|
|
14
|
+
return { x, y, width, height };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function compareScreenshotContrast(page, beforeBase64, afterBase64, candidate) {
|
|
18
|
+
return page.evaluate(async ({ beforeBase64, afterBase64, candidate }) => {
|
|
19
|
+
const loadImage = (base64) => new Promise((resolve, reject) => {
|
|
20
|
+
const img = new Image();
|
|
21
|
+
img.onload = () => resolve(img);
|
|
22
|
+
img.onerror = () => reject(new Error('Could not decode contrast screenshot'));
|
|
23
|
+
img.src = `data:image/png;base64,${base64}`;
|
|
24
|
+
});
|
|
25
|
+
const [before, after] = await Promise.all([loadImage(beforeBase64), loadImage(afterBase64)]);
|
|
26
|
+
const width = Math.min(before.width, after.width);
|
|
27
|
+
const height = Math.min(before.height, after.height);
|
|
28
|
+
if (width < 1 || height < 1) return null;
|
|
29
|
+
|
|
30
|
+
const canvas = document.createElement('canvas');
|
|
31
|
+
canvas.width = width;
|
|
32
|
+
canvas.height = height;
|
|
33
|
+
const ctx = canvas.getContext('2d', { willReadFrequently: true });
|
|
34
|
+
if (!ctx) return null;
|
|
35
|
+
|
|
36
|
+
ctx.drawImage(before, 0, 0, width, height);
|
|
37
|
+
const beforePixels = ctx.getImageData(0, 0, width, height).data;
|
|
38
|
+
ctx.clearRect(0, 0, width, height);
|
|
39
|
+
ctx.drawImage(after, 0, 0, width, height);
|
|
40
|
+
const afterPixels = ctx.getImageData(0, 0, width, height).data;
|
|
41
|
+
|
|
42
|
+
const luminance = ({ r, g, b }) => {
|
|
43
|
+
const convert = c => {
|
|
44
|
+
const v = c / 255;
|
|
45
|
+
return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
|
|
46
|
+
};
|
|
47
|
+
return 0.2126 * convert(r) + 0.7152 * convert(g) + 0.0722 * convert(b);
|
|
48
|
+
};
|
|
49
|
+
const ratio = (a, b) => {
|
|
50
|
+
const l1 = luminance(a);
|
|
51
|
+
const l2 = luminance(b);
|
|
52
|
+
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const cssTextColor = candidate.textColor && !candidate.preferRenderedForeground
|
|
56
|
+
? {
|
|
57
|
+
r: candidate.textColor.r,
|
|
58
|
+
g: candidate.textColor.g,
|
|
59
|
+
b: candidate.textColor.b,
|
|
60
|
+
}
|
|
61
|
+
: null;
|
|
62
|
+
const ratios = [];
|
|
63
|
+
let glyphPixels = 0;
|
|
64
|
+
let strongestDelta = 0;
|
|
65
|
+
for (let i = 0; i < beforePixels.length; i += 4) {
|
|
66
|
+
const delta = Math.abs(beforePixels[i] - afterPixels[i])
|
|
67
|
+
+ Math.abs(beforePixels[i + 1] - afterPixels[i + 1])
|
|
68
|
+
+ Math.abs(beforePixels[i + 2] - afterPixels[i + 2])
|
|
69
|
+
+ Math.abs(beforePixels[i + 3] - afterPixels[i + 3]);
|
|
70
|
+
strongestDelta = Math.max(strongestDelta, delta);
|
|
71
|
+
if (delta < 10) continue;
|
|
72
|
+
glyphPixels++;
|
|
73
|
+
const fg = cssTextColor || {
|
|
74
|
+
r: beforePixels[i],
|
|
75
|
+
g: beforePixels[i + 1],
|
|
76
|
+
b: beforePixels[i + 2],
|
|
77
|
+
};
|
|
78
|
+
const bg = {
|
|
79
|
+
r: afterPixels[i],
|
|
80
|
+
g: afterPixels[i + 1],
|
|
81
|
+
b: afterPixels[i + 2],
|
|
82
|
+
};
|
|
83
|
+
ratios.push(ratio(fg, bg));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (ratios.length < 8) {
|
|
87
|
+
return {
|
|
88
|
+
glyphPixels,
|
|
89
|
+
strongestDelta,
|
|
90
|
+
worstRatio: null,
|
|
91
|
+
p10Ratio: null,
|
|
92
|
+
medianRatio: null,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
ratios.sort((a, b) => a - b);
|
|
97
|
+
const pick = pct => ratios[Math.min(ratios.length - 1, Math.max(0, Math.floor((pct / 100) * ratios.length)))];
|
|
98
|
+
return {
|
|
99
|
+
glyphPixels,
|
|
100
|
+
strongestDelta,
|
|
101
|
+
worstRatio: ratios[0],
|
|
102
|
+
p10Ratio: pick(10),
|
|
103
|
+
medianRatio: pick(50),
|
|
104
|
+
};
|
|
105
|
+
}, { beforeBase64, afterBase64, candidate });
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async function captureVisualContrastCandidate(page, candidate, viewport) {
|
|
109
|
+
const clip = sanitizeScreenshotClip(candidate.clip, viewport);
|
|
110
|
+
if (!clip) return null;
|
|
111
|
+
|
|
112
|
+
const beforeBase64 = await page.screenshot({
|
|
113
|
+
encoding: 'base64',
|
|
114
|
+
clip,
|
|
115
|
+
captureBeyondViewport: true,
|
|
116
|
+
});
|
|
117
|
+
const token = `impeccable-contrast-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
118
|
+
const applied = await page.evaluate(({ selector, token, backgroundClipText }) => {
|
|
119
|
+
let el;
|
|
120
|
+
try {
|
|
121
|
+
el = document.querySelector(selector);
|
|
122
|
+
} catch {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
if (!el) return false;
|
|
126
|
+
let style = document.getElementById('impeccable-visual-contrast-hide-style');
|
|
127
|
+
if (!style) {
|
|
128
|
+
style = document.createElement('style');
|
|
129
|
+
style.id = 'impeccable-visual-contrast-hide-style';
|
|
130
|
+
style.textContent = [
|
|
131
|
+
'[data-impeccable-visual-contrast-target] {',
|
|
132
|
+
' color: transparent !important;',
|
|
133
|
+
' -webkit-text-fill-color: transparent !important;',
|
|
134
|
+
' text-shadow: none !important;',
|
|
135
|
+
'}',
|
|
136
|
+
'[data-impeccable-visual-contrast-target][data-impeccable-bgclip-text="true"] {',
|
|
137
|
+
' background-image: none !important;',
|
|
138
|
+
'}',
|
|
139
|
+
].join('\n');
|
|
140
|
+
document.head.appendChild(style);
|
|
141
|
+
}
|
|
142
|
+
el.setAttribute('data-impeccable-visual-contrast-target', token);
|
|
143
|
+
if (backgroundClipText) el.setAttribute('data-impeccable-bgclip-text', 'true');
|
|
144
|
+
return true;
|
|
145
|
+
}, {
|
|
146
|
+
selector: candidate.selector,
|
|
147
|
+
token,
|
|
148
|
+
backgroundClipText: candidate.backgroundClipText,
|
|
149
|
+
});
|
|
150
|
+
if (!applied) return null;
|
|
151
|
+
|
|
152
|
+
let afterBase64;
|
|
153
|
+
try {
|
|
154
|
+
afterBase64 = await page.screenshot({
|
|
155
|
+
encoding: 'base64',
|
|
156
|
+
clip,
|
|
157
|
+
captureBeyondViewport: true,
|
|
158
|
+
});
|
|
159
|
+
} finally {
|
|
160
|
+
await page.evaluate(({ selector }) => {
|
|
161
|
+
try {
|
|
162
|
+
const el = document.querySelector(selector);
|
|
163
|
+
if (el) {
|
|
164
|
+
el.removeAttribute('data-impeccable-visual-contrast-target');
|
|
165
|
+
el.removeAttribute('data-impeccable-bgclip-text');
|
|
166
|
+
}
|
|
167
|
+
} catch {
|
|
168
|
+
// Ignore invalid or stale selectors during cleanup.
|
|
169
|
+
}
|
|
170
|
+
}, { selector: candidate.selector }).catch(() => {});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const metrics = await compareScreenshotContrast(page, beforeBase64, afterBase64, candidate);
|
|
174
|
+
if (!metrics || !Number.isFinite(metrics.p10Ratio) || metrics.glyphPixels < 8) return null;
|
|
175
|
+
const measuredRatio = metrics.p10Ratio;
|
|
176
|
+
if (measuredRatio >= candidate.threshold) return null;
|
|
177
|
+
const textLabel = candidate.text ? ` "${candidate.text}"` : '';
|
|
178
|
+
const reasonLabel = (candidate.reasons || []).slice(0, 3).join(', ') || 'visual background';
|
|
179
|
+
return {
|
|
180
|
+
id: 'low-contrast',
|
|
181
|
+
snippet: `pixel contrast ${measuredRatio.toFixed(1)}:1 median ${metrics.medianRatio.toFixed(1)}:1 (need ${candidate.threshold}:1) on ${reasonLabel}${textLabel}`,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export {
|
|
186
|
+
sanitizeScreenshotClip,
|
|
187
|
+
compareScreenshotContrast,
|
|
188
|
+
captureVisualContrastCandidate,
|
|
189
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getAntipattern } from './registry/antipatterns.mjs';
|
|
2
|
+
|
|
3
|
+
function getAP(id) {
|
|
4
|
+
return getAntipattern(id);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function deriveAdvisoryFlag(item) {
|
|
8
|
+
if (item.severity === 'advisory') item.advisory = true;
|
|
9
|
+
else delete item.advisory;
|
|
10
|
+
return item;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function finding(id, filePath, snippet, line = 0) {
|
|
14
|
+
const ap = getAP(id);
|
|
15
|
+
const base = { antipattern: id, name: ap.name, description: ap.description, severity: ap.severity || 'warning', category: ap.category || null, file: filePath, line, snippet };
|
|
16
|
+
// Advisory findings are detected but reported separately and never counted as
|
|
17
|
+
// failures. Carry the flag on the finding so every consumer (CLI, JSON, hook)
|
|
18
|
+
// can partition without a registry lookup. Only stamped when true to keep the
|
|
19
|
+
// finding shape stable for the vast majority of rules.
|
|
20
|
+
return deriveAdvisoryFlag(base);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { getAP, finding, deriveAdvisoryFlag };
|