quiver-cli 1.3.1 → 2.0.0
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 +197 -239
- package/dist/cli.js +3163 -2040
- package/package.json +10 -11
- package/template/.agents/AGENTS.md +0 -26
- package/template/.agents/commands/cp.md +0 -108
- package/template/.agents/commands/next-setup.md +0 -1064
- package/template/.agents/commands/review.md +0 -68
- package/template/.agents/commands/terraform-readme.md +0 -38
- package/template/.agents/config.json +0 -80
- package/template/.agents/plugins/opencode/rtk.ts +0 -34
- package/template/.agents/skills/agent-browser/SKILL.md +0 -52
- package/template/.agents/skills/apps/skybridge/SKILL.md +0 -52
- package/template/.agents/skills/code/cleanup/SKILL.md +0 -26
- package/template/.agents/skills/code/improve/SKILL.md +0 -122
- package/template/.agents/skills/code/improve/references/audit-playbook.md +0 -130
- package/template/.agents/skills/code/improve/references/closing-the-loop.md +0 -96
- package/template/.agents/skills/code/improve/references/plan-template.md +0 -197
- package/template/.agents/skills/code/vercel-react-best-practices/AGENTS.md +0 -3810
- package/template/.agents/skills/code/vercel-react-best-practices/README.md +0 -123
- package/template/.agents/skills/code/vercel-react-best-practices/SKILL.md +0 -149
- package/template/.agents/skills/code/vercel-react-best-practices/metadata.json +0 -15
- package/template/.agents/skills/code/vercel-react-best-practices/rules/_sections.md +0 -46
- package/template/.agents/skills/code/vercel-react-best-practices/rules/_template.md +0 -28
- package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-effect-event-deps.md +0 -56
- package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-event-handler-refs.md +0 -55
- package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-init-once.md +0 -42
- package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-use-latest.md +0 -39
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-api-routes.md +0 -38
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-cheap-condition-before-await.md +0 -37
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-defer-await.md +0 -82
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-dependencies.md +0 -51
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-parallel.md +0 -28
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-suspense-boundaries.md +0 -99
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-analyzable-paths.md +0 -63
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-barrel-imports.md +0 -60
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-conditional.md +0 -31
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-defer-third-party.md +0 -49
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-dynamic-imports.md +0 -35
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-preload.md +0 -50
- package/template/.agents/skills/code/vercel-react-best-practices/rules/client-event-listeners.md +0 -74
- package/template/.agents/skills/code/vercel-react-best-practices/rules/client-localstorage-schema.md +0 -71
- package/template/.agents/skills/code/vercel-react-best-practices/rules/client-passive-event-listeners.md +0 -48
- package/template/.agents/skills/code/vercel-react-best-practices/rules/client-swr-dedup.md +0 -56
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-batch-dom-css.md +0 -107
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-function-results.md +0 -80
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-property-access.md +0 -28
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-storage.md +0 -70
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-combine-iterations.md +0 -32
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-early-exit.md +0 -50
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-flatmap-filter.md +0 -60
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-hoist-regexp.md +0 -45
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-index-maps.md +0 -37
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-length-check-first.md +0 -49
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-min-max-loop.md +0 -82
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-request-idle-callback.md +0 -105
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-set-map-lookups.md +0 -24
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-tosorted-immutable.md +0 -57
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-activity.md +0 -26
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-conditional-render.md +0 -40
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-content-visibility.md +0 -38
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hoist-jsx.md +0 -46
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +0 -30
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-resource-hints.md +0 -85
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-script-defer-async.md +0 -68
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-svg-precision.md +0 -28
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-usetransition-loading.md +0 -75
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-defer-reads.md +0 -39
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-dependencies.md +0 -45
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +0 -40
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-derived-state.md +0 -29
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-functional-setstate.md +0 -74
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-lazy-state-init.md +0 -58
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +0 -38
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-memo.md +0 -44
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +0 -45
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-no-inline-components.md +0 -82
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +0 -35
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-split-combined-hooks.md +0 -64
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-transitions.md +0 -40
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-use-deferred-value.md +0 -59
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +0 -73
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-after-nonblocking.md +0 -73
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-auth-actions.md +0 -96
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-cache-lru.md +0 -41
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-cache-react.md +0 -76
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-dedup-props.md +0 -65
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-hoist-static-io.md +0 -149
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-no-shared-module-state.md +0 -50
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-parallel-fetching.md +0 -83
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-parallel-nested-fetching.md +0 -34
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-serialization.md +0 -38
- package/template/.agents/skills/data/prisma-cli/SKILL.md +0 -265
- package/template/.agents/skills/data/prisma-cli/references/agent-safety.md +0 -27
- package/template/.agents/skills/data/prisma-cli/references/complete.md +0 -22
- package/template/.agents/skills/data/prisma-cli/references/db-execute.md +0 -78
- package/template/.agents/skills/data/prisma-cli/references/db-pull.md +0 -185
- package/template/.agents/skills/data/prisma-cli/references/db-push.md +0 -150
- package/template/.agents/skills/data/prisma-cli/references/db-seed.md +0 -188
- package/template/.agents/skills/data/prisma-cli/references/debug.md +0 -46
- package/template/.agents/skills/data/prisma-cli/references/dev.md +0 -157
- package/template/.agents/skills/data/prisma-cli/references/format.md +0 -48
- package/template/.agents/skills/data/prisma-cli/references/generate.md +0 -173
- package/template/.agents/skills/data/prisma-cli/references/init.md +0 -139
- package/template/.agents/skills/data/prisma-cli/references/mcp.md +0 -39
- package/template/.agents/skills/data/prisma-cli/references/migrate-deploy.md +0 -127
- package/template/.agents/skills/data/prisma-cli/references/migrate-dev.md +0 -145
- package/template/.agents/skills/data/prisma-cli/references/migrate-diff.md +0 -89
- package/template/.agents/skills/data/prisma-cli/references/migrate-reset.md +0 -80
- package/template/.agents/skills/data/prisma-cli/references/migrate-resolve.md +0 -57
- package/template/.agents/skills/data/prisma-cli/references/migrate-status.md +0 -65
- package/template/.agents/skills/data/prisma-cli/references/studio.md +0 -137
- package/template/.agents/skills/data/prisma-cli/references/validate.md +0 -53
- package/template/.agents/skills/data/prisma-client-api/SKILL.md +0 -216
- package/template/.agents/skills/data/prisma-client-api/references/client-methods.md +0 -223
- package/template/.agents/skills/data/prisma-client-api/references/constructor.md +0 -221
- package/template/.agents/skills/data/prisma-client-api/references/filters.md +0 -256
- package/template/.agents/skills/data/prisma-client-api/references/model-queries.md +0 -281
- package/template/.agents/skills/data/prisma-client-api/references/query-options.md +0 -276
- package/template/.agents/skills/data/prisma-client-api/references/raw-queries.md +0 -198
- package/template/.agents/skills/data/prisma-client-api/references/relations.md +0 -308
- package/template/.agents/skills/data/prisma-client-api/references/transactions.md +0 -184
- package/template/.agents/skills/design/impeccable/SKILL.md +0 -84
- package/template/.agents/skills/design/impeccable/reference/adapt.md +0 -312
- package/template/.agents/skills/design/impeccable/reference/adapt.native.md +0 -58
- package/template/.agents/skills/design/impeccable/reference/android.md +0 -46
- package/template/.agents/skills/design/impeccable/reference/animate.md +0 -89
- package/template/.agents/skills/design/impeccable/reference/audit.md +0 -136
- package/template/.agents/skills/design/impeccable/reference/audit.native.md +0 -139
- package/template/.agents/skills/design/impeccable/reference/bolder.md +0 -33
- package/template/.agents/skills/design/impeccable/reference/clarify.md +0 -94
- package/template/.agents/skills/design/impeccable/reference/colorize.md +0 -86
- package/template/.agents/skills/design/impeccable/reference/craft-floor.md +0 -44
- package/template/.agents/skills/design/impeccable/reference/craft.md +0 -5
- package/template/.agents/skills/design/impeccable/reference/critique.md +0 -806
- package/template/.agents/skills/design/impeccable/reference/degraded/asset-producer.md +0 -37
- package/template/.agents/skills/design/impeccable/reference/degraded/documenter.md +0 -24
- package/template/.agents/skills/design/impeccable/reference/degraded/finish-reviewer.md +0 -38
- package/template/.agents/skills/design/impeccable/reference/degraded/manual-edit-applier.md +0 -92
- package/template/.agents/skills/design/impeccable/reference/delight.md +0 -70
- package/template/.agents/skills/design/impeccable/reference/distill.md +0 -111
- package/template/.agents/skills/design/impeccable/reference/doctor.md +0 -54
- package/template/.agents/skills/design/impeccable/reference/document.md +0 -416
- package/template/.agents/skills/design/impeccable/reference/extract.md +0 -69
- package/template/.agents/skills/design/impeccable/reference/harden.md +0 -336
- package/template/.agents/skills/design/impeccable/reference/hooks.md +0 -111
- package/template/.agents/skills/design/impeccable/reference/init.md +0 -131
- package/template/.agents/skills/design/impeccable/reference/ios.md +0 -51
- package/template/.agents/skills/design/impeccable/reference/layout.md +0 -84
- package/template/.agents/skills/design/impeccable/reference/live-setup.md +0 -102
- package/template/.agents/skills/design/impeccable/reference/live.md +0 -323
- package/template/.agents/skills/design/impeccable/reference/new-work.md +0 -145
- package/template/.agents/skills/design/impeccable/reference/onboard.md +0 -234
- package/template/.agents/skills/design/impeccable/reference/operate.md +0 -61
- package/template/.agents/skills/design/impeccable/reference/optimize.md +0 -258
- package/template/.agents/skills/design/impeccable/reference/overdrive.md +0 -127
- package/template/.agents/skills/design/impeccable/reference/polish.md +0 -105
- package/template/.agents/skills/design/impeccable/reference/quieter.md +0 -99
- package/template/.agents/skills/design/impeccable/reference/routing.md +0 -18
- package/template/.agents/skills/design/impeccable/reference/shape.md +0 -59
- package/template/.agents/skills/design/impeccable/reference/typeset.md +0 -80
- package/template/.agents/skills/design/impeccable/reference/visualize.md +0 -46
- package/template/.agents/skills/design/impeccable/scripts/build-phase.mjs +0 -1022
- package/template/.agents/skills/design/impeccable/scripts/command-metadata.json +0 -94
- package/template/.agents/skills/design/impeccable/scripts/comp-diff.mjs +0 -391
- package/template/.agents/skills/design/impeccable/scripts/comp-spec.mjs +0 -513
- package/template/.agents/skills/design/impeccable/scripts/concept-seed.mjs +0 -814
- package/template/.agents/skills/design/impeccable/scripts/context-signals.mjs +0 -325
- package/template/.agents/skills/design/impeccable/scripts/context.mjs +0 -1565
- package/template/.agents/skills/design/impeccable/scripts/critique-storage.mjs +0 -473
- package/template/.agents/skills/design/impeccable/scripts/data/font-index-failures.json +0 -121
- package/template/.agents/skills/design/impeccable/scripts/data/font-index.json +0 -1
- package/template/.agents/skills/design/impeccable/scripts/detect-csp.mjs +0 -198
- package/template/.agents/skills/design/impeccable/scripts/detect.mjs +0 -30
- package/template/.agents/skills/design/impeccable/scripts/detector/browser/injected/index.mjs +0 -2204
- package/template/.agents/skills/design/impeccable/scripts/detector/cli/main.mjs +0 -432
- package/template/.agents/skills/design/impeccable/scripts/detector/design-system.mjs +0 -1311
- package/template/.agents/skills/design/impeccable/scripts/detector/detect-antipatterns-browser.js +0 -9043
- package/template/.agents/skills/design/impeccable/scripts/detector/detect-antipatterns.mjs +0 -51
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/browser/detect-url.mjs +0 -434
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/regex/detect-text.mjs +0 -1319
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +0 -1241
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/detect-html.mjs +0 -288
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -189
- package/template/.agents/skills/design/impeccable/scripts/detector/findings.mjs +0 -18
- package/template/.agents/skills/design/impeccable/scripts/detector/node/file-system.mjs +0 -213
- package/template/.agents/skills/design/impeccable/scripts/detector/profile/profiler.mjs +0 -166
- package/template/.agents/skills/design/impeccable/scripts/detector/registry/antipatterns.mjs +0 -635
- package/template/.agents/skills/design/impeccable/scripts/detector/rules/checks.mjs +0 -5681
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/color.mjs +0 -596
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/constants.mjs +0 -127
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/fonts.mjs +0 -30
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/inline-ignores.mjs +0 -148
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/page.mjs +0 -7
- package/template/.agents/skills/design/impeccable/scripts/doctor.mjs +0 -329
- package/template/.agents/skills/design/impeccable/scripts/embed-prompt.mjs +0 -166
- package/template/.agents/skills/design/impeccable/scripts/font-match.mjs +0 -457
- package/template/.agents/skills/design/impeccable/scripts/generate-image.mjs +0 -447
- package/template/.agents/skills/design/impeccable/scripts/hook-admin.mjs +0 -819
- package/template/.agents/skills/design/impeccable/scripts/hook-before-edit.mjs +0 -538
- package/template/.agents/skills/design/impeccable/scripts/hook-lib.mjs +0 -2490
- package/template/.agents/skills/design/impeccable/scripts/hook.mjs +0 -79
- package/template/.agents/skills/design/impeccable/scripts/lib/artifact-schema.mjs +0 -93
- package/template/.agents/skills/design/impeccable/scripts/lib/composition-catalog.mjs +0 -200
- package/template/.agents/skills/design/impeccable/scripts/lib/concept-catalog.mjs +0 -396
- package/template/.agents/skills/design/impeccable/scripts/lib/design-parser.mjs +0 -880
- package/template/.agents/skills/design/impeccable/scripts/lib/font-fingerprint.mjs +0 -564
- package/template/.agents/skills/design/impeccable/scripts/lib/font-index.mjs +0 -130
- package/template/.agents/skills/design/impeccable/scripts/lib/hero-checks.mjs +0 -246
- package/template/.agents/skills/design/impeccable/scripts/lib/image-metrics.mjs +0 -306
- package/template/.agents/skills/design/impeccable/scripts/lib/impeccable-config.mjs +0 -640
- package/template/.agents/skills/design/impeccable/scripts/lib/impeccable-paths.mjs +0 -137
- package/template/.agents/skills/design/impeccable/scripts/lib/is-generated.mjs +0 -72
- package/template/.agents/skills/design/impeccable/scripts/lib/live-path-globs.mjs +0 -37
- package/template/.agents/skills/design/impeccable/scripts/lib/open-system-browser.mjs +0 -26
- package/template/.agents/skills/design/impeccable/scripts/lib/png.mjs +0 -281
- package/template/.agents/skills/design/impeccable/scripts/lib/provider.mjs +0 -5
- package/template/.agents/skills/design/impeccable/scripts/lib/raster.mjs +0 -194
- package/template/.agents/skills/design/impeccable/scripts/lib/roll-selection.mjs +0 -369
- package/template/.agents/skills/design/impeccable/scripts/lib/staleness-deep.mjs +0 -485
- package/template/.agents/skills/design/impeccable/scripts/lib/staleness-notice.mjs +0 -169
- package/template/.agents/skills/design/impeccable/scripts/lib/staleness.mjs +0 -533
- package/template/.agents/skills/design/impeccable/scripts/lib/surface-briefs.mjs +0 -149
- package/template/.agents/skills/design/impeccable/scripts/lib/target-args.mjs +0 -42
- package/template/.agents/skills/design/impeccable/scripts/lib/target-slug.mjs +0 -33
- package/template/.agents/skills/design/impeccable/scripts/lib/template-extensions.mjs +0 -146
- package/template/.agents/skills/design/impeccable/scripts/live/accept-css.mjs +0 -617
- package/template/.agents/skills/design/impeccable/scripts/live/accept-verify.mjs +0 -60
- package/template/.agents/skills/design/impeccable/scripts/live/browser-script-parts.mjs +0 -84
- package/template/.agents/skills/design/impeccable/scripts/live/completion.mjs +0 -28
- package/template/.agents/skills/design/impeccable/scripts/live/event-validation.mjs +0 -199
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/astro.mjs +0 -47
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/detect-utils.mjs +0 -73
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/index.mjs +0 -143
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/journal.mjs +0 -197
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/nextjs.mjs +0 -49
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/nuxt.mjs +0 -161
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/script-src.mjs +0 -17
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/static-html.mjs +0 -26
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/sveltekit.mjs +0 -71
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/tag-strategy.mjs +0 -247
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/tanstack-start.mjs +0 -70
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/vite-generic.mjs +0 -42
- package/template/.agents/skills/design/impeccable/scripts/live/generation-preflight.mjs +0 -149
- package/template/.agents/skills/design/impeccable/scripts/live/insert-ui.mjs +0 -458
- package/template/.agents/skills/design/impeccable/scripts/live/instructions.mjs +0 -142
- package/template/.agents/skills/design/impeccable/scripts/live/manual-apply.mjs +0 -939
- package/template/.agents/skills/design/impeccable/scripts/live/manual-edit-routes.mjs +0 -357
- package/template/.agents/skills/design/impeccable/scripts/live/manual-edits-buffer.mjs +0 -152
- package/template/.agents/skills/design/impeccable/scripts/live/poll-lanes.mjs +0 -14
- package/template/.agents/skills/design/impeccable/scripts/live/project-ignores.mjs +0 -139
- package/template/.agents/skills/design/impeccable/scripts/live/roots.mjs +0 -508
- package/template/.agents/skills/design/impeccable/scripts/live/session-store.mjs +0 -563
- package/template/.agents/skills/design/impeccable/scripts/live/source-lock.mjs +0 -105
- package/template/.agents/skills/design/impeccable/scripts/live/source-search.mjs +0 -105
- package/template/.agents/skills/design/impeccable/scripts/live/svelte-ast.mjs +0 -969
- package/template/.agents/skills/design/impeccable/scripts/live/svelte-component.mjs +0 -1366
- package/template/.agents/skills/design/impeccable/scripts/live/sveltekit-adapter.mjs +0 -304
- package/template/.agents/skills/design/impeccable/scripts/live/tanstack-adapter.mjs +0 -259
- package/template/.agents/skills/design/impeccable/scripts/live/ui-surfaces.mjs +0 -75
- package/template/.agents/skills/design/impeccable/scripts/live/vocabulary.mjs +0 -171
- package/template/.agents/skills/design/impeccable/scripts/live-accept.mjs +0 -938
- package/template/.agents/skills/design/impeccable/scripts/live-browser-dom.js +0 -146
- package/template/.agents/skills/design/impeccable/scripts/live-browser-ignores.js +0 -242
- package/template/.agents/skills/design/impeccable/scripts/live-browser-session.js +0 -123
- package/template/.agents/skills/design/impeccable/scripts/live-browser.js +0 -12551
- package/template/.agents/skills/design/impeccable/scripts/live-commit-manual-edits.mjs +0 -1200
- package/template/.agents/skills/design/impeccable/scripts/live-complete.mjs +0 -107
- package/template/.agents/skills/design/impeccable/scripts/live-copy-edit-agent.mjs +0 -800
- package/template/.agents/skills/design/impeccable/scripts/live-discard-manual-edits.mjs +0 -51
- package/template/.agents/skills/design/impeccable/scripts/live-inject.mjs +0 -463
- package/template/.agents/skills/design/impeccable/scripts/live-insert.mjs +0 -292
- package/template/.agents/skills/design/impeccable/scripts/live-manual-edit-evidence.mjs +0 -368
- package/template/.agents/skills/design/impeccable/scripts/live-poll.mjs +0 -430
- package/template/.agents/skills/design/impeccable/scripts/live-resume.mjs +0 -123
- package/template/.agents/skills/design/impeccable/scripts/live-server.mjs +0 -1698
- package/template/.agents/skills/design/impeccable/scripts/live-status.mjs +0 -71
- package/template/.agents/skills/design/impeccable/scripts/live-target.mjs +0 -30
- package/template/.agents/skills/design/impeccable/scripts/live-wrap.mjs +0 -927
- package/template/.agents/skills/design/impeccable/scripts/live.mjs +0 -334
- package/template/.agents/skills/design/impeccable/scripts/modern-screenshot.umd.js +0 -14
- package/template/.agents/skills/design/impeccable/scripts/palette.mjs +0 -628
- package/template/.agents/skills/design/impeccable/scripts/pin.mjs +0 -224
- package/template/.agents/skills/design/impeccable/scripts/serve-question.mjs +0 -1783
- package/template/.agents/skills/design/impeccable/scripts/surface-brief.mjs +0 -74
- package/template/.agents/skills/design/shadcn/SKILL.md +0 -277
- package/template/.agents/skills/design/shadcn/agents/openai.yml +0 -5
- package/template/.agents/skills/design/shadcn/assets/shadcn-small.png +0 -0
- package/template/.agents/skills/design/shadcn/assets/shadcn.png +0 -0
- package/template/.agents/skills/design/shadcn/cli.md +0 -290
- package/template/.agents/skills/design/shadcn/customization.md +0 -209
- package/template/.agents/skills/design/shadcn/evals/evals.json +0 -77
- package/template/.agents/skills/design/shadcn/mcp.md +0 -105
- package/template/.agents/skills/design/shadcn/registry.md +0 -277
- package/template/.agents/skills/design/shadcn/rules/base-vs-radix.md +0 -306
- package/template/.agents/skills/design/shadcn/rules/chat.md +0 -250
- package/template/.agents/skills/design/shadcn/rules/composition.md +0 -213
- package/template/.agents/skills/design/shadcn/rules/forms.md +0 -192
- package/template/.agents/skills/design/shadcn/rules/icons.md +0 -101
- package/template/.agents/skills/design/shadcn/rules/styling.md +0 -185
- package/template/.agents/skills/find-skills/SKILL.md +0 -141
- package/template/.agents/skills/hono/SKILL.md +0 -593
- package/template/.agents/skills/integrations/langfuse/SKILL.md +0 -150
- package/template/.agents/skills/integrations/langfuse/references/ci-cd.md +0 -41
- package/template/.agents/skills/integrations/langfuse/references/cli.md +0 -60
- package/template/.agents/skills/integrations/langfuse/references/create-dataset.md +0 -35
- package/template/.agents/skills/integrations/langfuse/references/error-analysis.md +0 -87
- package/template/.agents/skills/integrations/langfuse/references/instrumentation.md +0 -121
- package/template/.agents/skills/integrations/langfuse/references/judge-calibration.md +0 -293
- package/template/.agents/skills/integrations/langfuse/references/prompt-engineering.md +0 -35
- package/template/.agents/skills/integrations/langfuse/references/prompt-migration.md +0 -79
- package/template/.agents/skills/integrations/langfuse/references/sdk-upgrade.md +0 -34
- package/template/.agents/skills/integrations/langfuse/references/setting-up-evals.md +0 -65
- package/template/.agents/skills/integrations/langfuse/references/skill-feedback.md +0 -35
- package/template/.agents/skills/integrations/langfuse/references/trace-evaluator-upgrade.md +0 -76
- package/template/.agents/skills/integrations/langfuse/references/user-feedback.md +0 -66
- package/template/.agents/skills/integrations/langfuse/references/v4-project-migration.md +0 -75
- package/template/.agents/skills/integrations/posthog/SKILL.md +0 -102
- package/template/.agents/skills/integrations/posthog/references/error-tracking-alerts.md +0 -63
- package/template/.agents/skills/integrations/posthog/references/error-tracking-assigning-issues.md +0 -77
- package/template/.agents/skills/integrations/posthog/references/error-tracking-fingerprints.md +0 -57
- package/template/.agents/skills/integrations/posthog/references/error-tracking-monitoring.md +0 -140
- package/template/.agents/skills/integrations/posthog/references/error-tracking-nextjs.md +0 -490
- package/template/.agents/skills/integrations/posthog/references/error-tracking-source-maps.md +0 -45
- package/template/.agents/skills/integrations/posthog/references/feature-flags-best-practices.md +0 -139
- package/template/.agents/skills/integrations/posthog/references/feature-flags-react.md +0 -302
- package/template/.agents/skills/integrations/posthog/references/identify-users.md +0 -202
- package/template/.agents/skills/integrations/posthog/references/integration-example.md +0 -706
- package/template/.agents/skills/integrations/posthog/references/integration-nextjs.md +0 -385
- package/template/.agents/skills/integrations/posthog/references/integration-step-1-begin.md +0 -43
- package/template/.agents/skills/integrations/posthog/references/integration-step-2-edit.md +0 -37
- package/template/.agents/skills/integrations/posthog/references/integration-step-3-revise.md +0 -22
- package/template/.agents/skills/integrations/posthog/references/integration-step-4-conclude.md +0 -38
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-anthropic.md +0 -200
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-basics.md +0 -62
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-costs.md +0 -197
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-manual-capture.md +0 -397
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-traces.md +0 -98
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-vercel-ai.md +0 -120
- package/template/.agents/skills/repo/repo-ci/SKILL.md +0 -265
- package/template/.agents/skills/repo/repo-init-next-js/SKILL.md +0 -129
- package/template/.agents/skills/repo/repo-init-next-js/references/file-contents.md +0 -800
- package/template/.agents/skills/repo/repo-init-next-js/scripts/setup.sh +0 -47
- package/template/.agents/skills/repo/repo-init-node/SKILL.md +0 -196
- package/template/.agents/skills/skill-creator/LICENSE.txt +0 -202
- package/template/.agents/skills/skill-creator/SKILL.md +0 -485
- package/template/.agents/skills/skill-creator/agents/analyzer.md +0 -274
- package/template/.agents/skills/skill-creator/agents/comparator.md +0 -202
- package/template/.agents/skills/skill-creator/agents/grader.md +0 -223
- package/template/.agents/skills/skill-creator/assets/eval_review.html +0 -146
- package/template/.agents/skills/skill-creator/eval-viewer/generate_review.py +0 -471
- package/template/.agents/skills/skill-creator/eval-viewer/viewer.html +0 -1325
- package/template/.agents/skills/skill-creator/references/schemas.md +0 -430
- package/template/.agents/skills/skill-creator/scripts/__init__.py +0 -0
- package/template/.agents/skills/skill-creator/scripts/aggregate_benchmark.py +0 -401
- package/template/.agents/skills/skill-creator/scripts/generate_report.py +0 -326
- package/template/.agents/skills/skill-creator/scripts/improve_description.py +0 -247
- package/template/.agents/skills/skill-creator/scripts/package_skill.py +0 -136
- package/template/.agents/skills/skill-creator/scripts/quick_validate.py +0 -103
- package/template/.agents/skills/skill-creator/scripts/run_eval.py +0 -310
- package/template/.agents/skills/skill-creator/scripts/run_loop.py +0 -328
- package/template/.agents/skills/skill-creator/scripts/utils.py +0 -47
- package/template/.agents/skills/supabase/CHANGELOG.md +0 -78
- package/template/.agents/skills/supabase/SKILL.md +0 -149
- package/template/.agents/skills/supabase/assets/feedback-issue-template.md +0 -17
- package/template/.agents/skills/supabase/references/skill-feedback.md +0 -17
- package/template/.agents/skills/supabase-postgres-best-practices/CHANGELOG.md +0 -73
- package/template/.agents/skills/supabase-postgres-best-practices/SKILL.md +0 -64
- package/template/.agents/skills/supabase-postgres-best-practices/references/_contributing.md +0 -170
- package/template/.agents/skills/supabase-postgres-best-practices/references/_sections.md +0 -39
- package/template/.agents/skills/supabase-postgres-best-practices/references/_template.md +0 -34
- package/template/.agents/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +0 -55
- package/template/.agents/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +0 -49
- package/template/.agents/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +0 -46
- package/template/.agents/skills/supabase-postgres-best-practices/references/conn-limits.md +0 -44
- package/template/.agents/skills/supabase-postgres-best-practices/references/conn-pooling.md +0 -41
- package/template/.agents/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +0 -46
- package/template/.agents/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +0 -54
- package/template/.agents/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +0 -53
- package/template/.agents/skills/supabase-postgres-best-practices/references/data-pagination.md +0 -50
- package/template/.agents/skills/supabase-postgres-best-practices/references/data-upsert.md +0 -50
- package/template/.agents/skills/supabase-postgres-best-practices/references/lock-advisory.md +0 -56
- package/template/.agents/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +0 -68
- package/template/.agents/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +0 -50
- package/template/.agents/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +0 -54
- package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +0 -45
- package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +0 -55
- package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +0 -55
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +0 -44
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +0 -40
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-index-types.md +0 -48
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +0 -43
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +0 -45
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-constraints.md +0 -80
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-data-types.md +0 -46
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +0 -59
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +0 -55
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-partitioning.md +0 -55
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +0 -61
- package/template/.agents/skills/supabase-postgres-best-practices/references/security-privileges.md +0 -54
- package/template/.agents/skills/supabase-postgres-best-practices/references/security-rls-basics.md +0 -50
- package/template/.agents/skills/supabase-postgres-best-practices/references/security-rls-performance.md +0 -63
- package/template/.agents/skills/writing/humanizer/LICENSE +0 -21
- package/template/.agents/skills/writing/humanizer/README.md +0 -209
- package/template/.agents/skills/writing/humanizer/SKILL.md +0 -456
- package/template/.agents/upstreams.json +0 -115
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Small RGBA raster toolkit shared by the comp-fidelity scripts: crop, resize
|
|
3
|
-
* (area-averaging down, bilinear up), composite, fills, rectangles, and a
|
|
4
|
-
* bitmap-font label so composites can be captioned without a font stack.
|
|
5
|
-
*
|
|
6
|
-
* An image is `{ width, height, data }` with RGBA8 data (Uint8Array).
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export function createImage(width, height, fill = [0, 0, 0, 0]) {
|
|
10
|
-
const data = new Uint8Array(width * height * 4);
|
|
11
|
-
if (fill[0] || fill[1] || fill[2] || fill[3]) {
|
|
12
|
-
for (let i = 0; i < data.length; i += 4) { data[i] = fill[0]; data[i + 1] = fill[1]; data[i + 2] = fill[2]; data[i + 3] = fill[3]; }
|
|
13
|
-
}
|
|
14
|
-
return { width, height, data };
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function clampRect(img, x, y, w, h) {
|
|
18
|
-
const x0 = Math.max(0, Math.min(img.width, Math.round(x)));
|
|
19
|
-
const y0 = Math.max(0, Math.min(img.height, Math.round(y)));
|
|
20
|
-
const x1 = Math.max(x0, Math.min(img.width, Math.round(x + w)));
|
|
21
|
-
const y1 = Math.max(y0, Math.min(img.height, Math.round(y + h)));
|
|
22
|
-
return { x: x0, y: y0, w: x1 - x0, h: y1 - y0 };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function crop(img, x, y, w, h) {
|
|
26
|
-
const r = clampRect(img, x, y, w, h);
|
|
27
|
-
const out = createImage(Math.max(1, r.w), Math.max(1, r.h));
|
|
28
|
-
for (let yy = 0; yy < r.h; yy++) {
|
|
29
|
-
const src = ((r.y + yy) * img.width + r.x) * 4;
|
|
30
|
-
out.data.set(img.data.subarray(src, src + r.w * 4), yy * out.width * 4);
|
|
31
|
-
}
|
|
32
|
-
return out;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** Resize with area averaging when shrinking and bilinear when growing. */
|
|
36
|
-
export function resize(img, width, height) {
|
|
37
|
-
width = Math.max(1, Math.round(width));
|
|
38
|
-
height = Math.max(1, Math.round(height));
|
|
39
|
-
if (width === img.width && height === img.height) return { width, height, data: new Uint8Array(img.data) };
|
|
40
|
-
const out = createImage(width, height);
|
|
41
|
-
const sx = img.width / width, sy = img.height / height;
|
|
42
|
-
if (sx >= 1 && sy >= 1) {
|
|
43
|
-
for (let y = 0; y < height; y++) {
|
|
44
|
-
const y0 = Math.floor(y * sy), y1 = Math.min(img.height, Math.max(y0 + 1, Math.floor((y + 1) * sy)));
|
|
45
|
-
for (let x = 0; x < width; x++) {
|
|
46
|
-
const x0 = Math.floor(x * sx), x1 = Math.min(img.width, Math.max(x0 + 1, Math.floor((x + 1) * sx)));
|
|
47
|
-
let r = 0, g = 0, b = 0, a = 0, n = 0;
|
|
48
|
-
for (let yy = y0; yy < y1; yy++) {
|
|
49
|
-
let p = (yy * img.width + x0) * 4;
|
|
50
|
-
for (let xx = x0; xx < x1; xx++, p += 4) { r += img.data[p]; g += img.data[p + 1]; b += img.data[p + 2]; a += img.data[p + 3]; n++; }
|
|
51
|
-
}
|
|
52
|
-
const o = (y * width + x) * 4;
|
|
53
|
-
out.data[o] = r / n; out.data[o + 1] = g / n; out.data[o + 2] = b / n; out.data[o + 3] = a / n;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return out;
|
|
57
|
-
}
|
|
58
|
-
for (let y = 0; y < height; y++) {
|
|
59
|
-
const fy = Math.min(img.height - 1, (y + 0.5) * sy - 0.5);
|
|
60
|
-
const y0 = Math.max(0, Math.floor(fy)), y1 = Math.min(img.height - 1, y0 + 1), wy = fy - y0;
|
|
61
|
-
for (let x = 0; x < width; x++) {
|
|
62
|
-
const fx = Math.min(img.width - 1, (x + 0.5) * sx - 0.5);
|
|
63
|
-
const x0 = Math.max(0, Math.floor(fx)), x1 = Math.min(img.width - 1, x0 + 1), wx = fx - x0;
|
|
64
|
-
const o = (y * width + x) * 4;
|
|
65
|
-
for (let c = 0; c < 4; c++) {
|
|
66
|
-
const p00 = img.data[(y0 * img.width + x0) * 4 + c], p10 = img.data[(y0 * img.width + x1) * 4 + c];
|
|
67
|
-
const p01 = img.data[(y1 * img.width + x0) * 4 + c], p11 = img.data[(y1 * img.width + x1) * 4 + c];
|
|
68
|
-
out.data[o + c] = (p00 * (1 - wx) + p10 * wx) * (1 - wy) + (p01 * (1 - wx) + p11 * wx) * wy;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return out;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** Scale to fit inside (maxW x maxH) preserving aspect; never upscale unless `allowUpscale`. */
|
|
76
|
-
export function fit(img, maxW, maxH, allowUpscale = false) {
|
|
77
|
-
const s = Math.min(maxW / img.width, maxH / img.height);
|
|
78
|
-
if (s >= 1 && !allowUpscale) return img;
|
|
79
|
-
return resize(img, img.width * s, img.height * s);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/** Alpha-composite `src` onto `dst` at (x, y). */
|
|
83
|
-
export function blit(dst, src, x, y) {
|
|
84
|
-
x = Math.round(x); y = Math.round(y);
|
|
85
|
-
for (let yy = 0; yy < src.height; yy++) {
|
|
86
|
-
const dy = y + yy; if (dy < 0 || dy >= dst.height) continue;
|
|
87
|
-
for (let xx = 0; xx < src.width; xx++) {
|
|
88
|
-
const dx = x + xx; if (dx < 0 || dx >= dst.width) continue;
|
|
89
|
-
const s = (yy * src.width + xx) * 4, d = (dy * dst.width + dx) * 4;
|
|
90
|
-
const a = src.data[s + 3] / 255;
|
|
91
|
-
if (a >= 1) { dst.data[d] = src.data[s]; dst.data[d + 1] = src.data[s + 1]; dst.data[d + 2] = src.data[s + 2]; dst.data[d + 3] = 255; continue; }
|
|
92
|
-
if (a <= 0) continue;
|
|
93
|
-
const da = dst.data[d + 3] / 255, oa = a + da * (1 - a);
|
|
94
|
-
for (let c = 0; c < 3; c++) dst.data[d + c] = (src.data[s + c] * a + dst.data[d + c] * da * (1 - a)) / (oa || 1);
|
|
95
|
-
dst.data[d + 3] = oa * 255;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export function fillRect(img, x, y, w, h, rgba) {
|
|
101
|
-
const r = clampRect(img, x, y, w, h);
|
|
102
|
-
const a = (rgba[3] ?? 255) / 255;
|
|
103
|
-
for (let yy = r.y; yy < r.y + r.h; yy++) {
|
|
104
|
-
for (let xx = r.x; xx < r.x + r.w; xx++) {
|
|
105
|
-
const o = (yy * img.width + xx) * 4;
|
|
106
|
-
if (a >= 1) { img.data[o] = rgba[0]; img.data[o + 1] = rgba[1]; img.data[o + 2] = rgba[2]; img.data[o + 3] = 255; }
|
|
107
|
-
else { for (let c = 0; c < 3; c++) img.data[o + c] = rgba[c] * a + img.data[o + c] * (1 - a); img.data[o + 3] = Math.max(img.data[o + 3], a * 255); }
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function strokeRect(img, x, y, w, h, rgba, thickness = 2) {
|
|
113
|
-
fillRect(img, x, y, w, thickness, rgba);
|
|
114
|
-
fillRect(img, x, y + h - thickness, w, thickness, rgba);
|
|
115
|
-
fillRect(img, x, y, thickness, h, rgba);
|
|
116
|
-
fillRect(img, x + w - thickness, y, thickness, h, rgba);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// 5x7 bitmap font, uppercase + digits + a little punctuation. Enough for labels.
|
|
120
|
-
const GLYPHS = {
|
|
121
|
-
A: ['01110', '10001', '10001', '11111', '10001', '10001', '10001'],
|
|
122
|
-
B: ['11110', '10001', '10001', '11110', '10001', '10001', '11110'],
|
|
123
|
-
C: ['01110', '10001', '10000', '10000', '10000', '10001', '01110'],
|
|
124
|
-
D: ['11110', '10001', '10001', '10001', '10001', '10001', '11110'],
|
|
125
|
-
E: ['11111', '10000', '10000', '11110', '10000', '10000', '11111'],
|
|
126
|
-
F: ['11111', '10000', '10000', '11110', '10000', '10000', '10000'],
|
|
127
|
-
G: ['01110', '10001', '10000', '10111', '10001', '10001', '01111'],
|
|
128
|
-
H: ['10001', '10001', '10001', '11111', '10001', '10001', '10001'],
|
|
129
|
-
I: ['11111', '00100', '00100', '00100', '00100', '00100', '11111'],
|
|
130
|
-
J: ['00111', '00010', '00010', '00010', '00010', '10010', '01100'],
|
|
131
|
-
K: ['10001', '10010', '10100', '11000', '10100', '10010', '10001'],
|
|
132
|
-
L: ['10000', '10000', '10000', '10000', '10000', '10000', '11111'],
|
|
133
|
-
M: ['10001', '11011', '10101', '10101', '10001', '10001', '10001'],
|
|
134
|
-
N: ['10001', '10001', '11001', '10101', '10011', '10001', '10001'],
|
|
135
|
-
O: ['01110', '10001', '10001', '10001', '10001', '10001', '01110'],
|
|
136
|
-
P: ['11110', '10001', '10001', '11110', '10000', '10000', '10000'],
|
|
137
|
-
Q: ['01110', '10001', '10001', '10001', '10101', '10010', '01101'],
|
|
138
|
-
R: ['11110', '10001', '10001', '11110', '10100', '10010', '10001'],
|
|
139
|
-
S: ['01111', '10000', '10000', '01110', '00001', '00001', '11110'],
|
|
140
|
-
T: ['11111', '00100', '00100', '00100', '00100', '00100', '00100'],
|
|
141
|
-
U: ['10001', '10001', '10001', '10001', '10001', '10001', '01110'],
|
|
142
|
-
V: ['10001', '10001', '10001', '10001', '10001', '01010', '00100'],
|
|
143
|
-
W: ['10001', '10001', '10001', '10101', '10101', '10101', '01010'],
|
|
144
|
-
X: ['10001', '10001', '01010', '00100', '01010', '10001', '10001'],
|
|
145
|
-
Y: ['10001', '10001', '01010', '00100', '00100', '00100', '00100'],
|
|
146
|
-
Z: ['11111', '00001', '00010', '00100', '01000', '10000', '11111'],
|
|
147
|
-
0: ['01110', '10001', '10011', '10101', '11001', '10001', '01110'],
|
|
148
|
-
1: ['00100', '01100', '00100', '00100', '00100', '00100', '01110'],
|
|
149
|
-
2: ['01110', '10001', '00001', '00010', '00100', '01000', '11111'],
|
|
150
|
-
3: ['11110', '00001', '00001', '01110', '00001', '00001', '11110'],
|
|
151
|
-
4: ['00010', '00110', '01010', '10010', '11111', '00010', '00010'],
|
|
152
|
-
5: ['11111', '10000', '11110', '00001', '00001', '10001', '01110'],
|
|
153
|
-
6: ['00110', '01000', '10000', '11110', '10001', '10001', '01110'],
|
|
154
|
-
7: ['11111', '00001', '00010', '00100', '01000', '01000', '01000'],
|
|
155
|
-
8: ['01110', '10001', '10001', '01110', '10001', '10001', '01110'],
|
|
156
|
-
9: ['01110', '10001', '10001', '01111', '00001', '00010', '01100'],
|
|
157
|
-
' ': ['00000', '00000', '00000', '00000', '00000', '00000', '00000'],
|
|
158
|
-
'.': ['00000', '00000', '00000', '00000', '00000', '01100', '01100'],
|
|
159
|
-
':': ['00000', '01100', '01100', '00000', '01100', '01100', '00000'],
|
|
160
|
-
'-': ['00000', '00000', '00000', '11111', '00000', '00000', '00000'],
|
|
161
|
-
'/': ['00001', '00010', '00010', '00100', '01000', '01000', '10000'],
|
|
162
|
-
'%': ['11001', '11010', '00010', '00100', '01000', '01011', '10011'],
|
|
163
|
-
'(': ['00010', '00100', '01000', '01000', '01000', '00100', '00010'],
|
|
164
|
-
')': ['01000', '00100', '00010', '00010', '00010', '00100', '01000'],
|
|
165
|
-
'#': ['01010', '01010', '11111', '01010', '11111', '01010', '01010'],
|
|
166
|
-
'_': ['00000', '00000', '00000', '00000', '00000', '00000', '11111'],
|
|
167
|
-
'?': ['01110', '10001', '00001', '00010', '00100', '00000', '00100'],
|
|
168
|
-
'=': ['00000', '00000', '11111', '00000', '11111', '00000', '00000'],
|
|
169
|
-
'+': ['00000', '00100', '00100', '11111', '00100', '00100', '00000'],
|
|
170
|
-
',': ['00000', '00000', '00000', '00000', '01100', '00100', '01000'],
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
export function textWidth(text, scale = 2) {
|
|
174
|
-
return text.length * 6 * scale;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/** Draw uppercase bitmap text. Returns width drawn. */
|
|
178
|
-
export function drawText(img, text, x, y, rgba, scale = 2) {
|
|
179
|
-
let cx = Math.round(x);
|
|
180
|
-
for (const chRaw of String(text).toUpperCase()) {
|
|
181
|
-
const g = GLYPHS[chRaw] || GLYPHS['?'];
|
|
182
|
-
for (let r = 0; r < 7; r++) for (let c = 0; c < 5; c++) if (g[r][c] === '1') fillRect(img, cx + c * scale, y + r * scale, scale, scale, rgba);
|
|
183
|
-
cx += 6 * scale;
|
|
184
|
-
}
|
|
185
|
-
return cx - x;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/** Draw a label with a background pill. */
|
|
189
|
-
export function drawLabel(img, text, x, y, { fg = [255, 255, 255, 255], bg = [0, 0, 0, 220], scale = 2, pad = 4 } = {}) {
|
|
190
|
-
const w = textWidth(text, scale) + pad * 2, h = 7 * scale + pad * 2;
|
|
191
|
-
fillRect(img, x, y, w, h, bg);
|
|
192
|
-
drawText(img, text, x + pad, y + pad, fg, scale);
|
|
193
|
-
return { w, h };
|
|
194
|
-
}
|
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
// The one implementation of world-roll selection.
|
|
2
|
-
//
|
|
3
|
-
// Two copies of this logic used to exist: this repo's concept-seed.mjs and the
|
|
4
|
-
// service repo's functions/api/_worldroll-core.js, whose header claimed they
|
|
5
|
-
// matched "exactly". They did not. The API had no breadth gate on either pool,
|
|
6
|
-
// no rating weighting for compositions, and dealt one composition where the
|
|
7
|
-
// seeder dealt three. Because the catalog never ships with the skill, every real
|
|
8
|
-
// user rolls through that API, so those gates reached nobody.
|
|
9
|
-
//
|
|
10
|
-
// Why generators. The two callers cannot agree on a hash: Node has a
|
|
11
|
-
// synchronous one, Workers only have async crypto.subtle, and concept-seed's
|
|
12
|
-
// local render path is deliberately synchronous so prepared eval sessions and
|
|
13
|
-
// tests can call it without awaiting. Rather than fork the logic or force the
|
|
14
|
-
// whole seeder async, the selection is written once as a generator that yields
|
|
15
|
-
// batches of strings to hash and resumes with their digests. runSyncSelection
|
|
16
|
-
// and runAsyncSelection below are the only runtime-specific code, about eight
|
|
17
|
-
// lines each. Both digests are the same bytes, so a roll is identical either way.
|
|
18
|
-
//
|
|
19
|
-
// Nothing here reads a file, an environment variable, or the network: callers
|
|
20
|
-
// pass pools in.
|
|
21
|
-
|
|
22
|
-
export const WELL_TIERS = ['graphic', 'interaction', 'atmosphere'];
|
|
23
|
-
|
|
24
|
-
// Grain: how much of the product a composition composes. Named grain rather than
|
|
25
|
-
// scope because scope already means direction-or-surface on every roll, and
|
|
26
|
-
// 'surface' is already a register value, so a scope of 'surface' would collide
|
|
27
|
-
// with both.
|
|
28
|
-
//
|
|
29
|
-
// This axis is framed by what the skill can be asked for, not by what the
|
|
30
|
-
// catalog happens to hold. A user asks for a docs site, an onboarding flow, a
|
|
31
|
-
// landing page, or a data table, and those are four different amounts of
|
|
32
|
-
// product. Register says what kind of work it is; grain says how much of it.
|
|
33
|
-
// Without grain, a request for a hero section can be dealt a whole-site
|
|
34
|
-
// navigation structure and nothing notices.
|
|
35
|
-
//
|
|
36
|
-
// Measured when this was added: 137 of 173 approved compositions were view
|
|
37
|
-
// grain, product grain was empty, and flow grain held one entry. That is why an
|
|
38
|
-
// onboarding request had nothing to draw.
|
|
39
|
-
export const COMPOSITION_GRAINS = [
|
|
40
|
-
'product', // a whole site or app: its information architecture
|
|
41
|
-
'flow', // a sequence of views with one outcome: onboarding, checkout, setup
|
|
42
|
-
'view', // one page or screen
|
|
43
|
-
'region', // a section inside a view: a hero, a feature grid, a table
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
// Delivery targets a composition can survive. Mirrors the skill's platform axis
|
|
47
|
-
// minus 'adaptive', which is a project-level value meaning both native targets
|
|
48
|
-
// rather than something a single composition is authored for.
|
|
49
|
-
//
|
|
50
|
-
// A composition that leans on hover, a pointer, or a wide viewport does not
|
|
51
|
-
// survive a phone, and nothing in the schema could say so before this.
|
|
52
|
-
export const COMPOSITION_PLATFORMS = ['web', 'ios', 'android'];
|
|
53
|
-
|
|
54
|
-
// Both fields are optional and absence means eligible everywhere, so no entry
|
|
55
|
-
// has to be backfilled before this ships and no existing roll changes.
|
|
56
|
-
export function isGrain(value) {
|
|
57
|
-
return COMPOSITION_GRAINS.includes(value);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function isPlatform(value) {
|
|
61
|
-
return COMPOSITION_PLATFORMS.includes(value);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Drives a selection generator with a synchronous hash.
|
|
67
|
-
* @param {Generator} generator yields string[] to hash, resumes with hex string[]
|
|
68
|
-
* @param {(input: string) => string} hash
|
|
69
|
-
*/
|
|
70
|
-
export function runSyncSelection(generator, hash) {
|
|
71
|
-
let step = generator.next();
|
|
72
|
-
while (!step.done) step = generator.next(step.value.map(hash));
|
|
73
|
-
return step.value;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Drives a selection generator with an asynchronous hash.
|
|
78
|
-
* @param {Generator} generator
|
|
79
|
-
* @param {(input: string) => Promise<string>} hash
|
|
80
|
-
*/
|
|
81
|
-
export async function runAsyncSelection(generator, hash) {
|
|
82
|
-
let step = generator.next();
|
|
83
|
-
while (!step.done) step = generator.next(await Promise.all(step.value.map(hash)));
|
|
84
|
-
return step.value;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Ranks items by the digest of `${input}:${id}`, descending, with the id as a
|
|
88
|
-
// stable tiebreak. Yields every needed digest in one batch so the async driver
|
|
89
|
-
// can resolve them concurrently.
|
|
90
|
-
function* rank(items, input, idFor = item => item.id) {
|
|
91
|
-
const ids = items.map(idFor);
|
|
92
|
-
const digests = yield ids.map(id => `${input}:${id}`);
|
|
93
|
-
return items
|
|
94
|
-
.map((item, index) => ({ item, id: ids[index], score: digests[index] }))
|
|
95
|
-
.sort((a, b) => b.score.localeCompare(a.score) || a.id.localeCompare(b.id))
|
|
96
|
-
.map(entry => entry.item);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Rating sets how many tickets a world holds; breadth decides whether it draws
|
|
100
|
-
// at all. A niche world leaves the pool however good it is, keeping its approval
|
|
101
|
-
// for direct briefs. Breadth was split out of rating because the only way to
|
|
102
|
-
// hold a narrow world back used to be calling it marginal, which made "excellent
|
|
103
|
-
// but narrow" unrecordable and corrupted ratings as a calibration signal.
|
|
104
|
-
//
|
|
105
|
-
// Two tickets for a 3-star, one for everything else, was too sharp. Measured
|
|
106
|
-
// against the catalog as it stood: 3-star worlds absorbed 57% of the graphic
|
|
107
|
-
// draw from 65 of 163 eligible worlds, 46% of atmosphere from 13 of 43, and
|
|
108
|
-
// 75% of interaction from 15 of 25. The reviewer's complaint, that the same
|
|
109
|
-
// worlds keep coming back, is what a rating multiplier does to a pool whose
|
|
110
|
-
// thinnest tier holds 25 worlds.
|
|
111
|
-
//
|
|
112
|
-
// So a 3-star no longer outdraws a 2-star, and a 1-star draws at half rather
|
|
113
|
-
// than not at all. A marginal keep is still worth showing sometimes: the
|
|
114
|
-
// judgement it records is "narrow or unexceptional", not "wrong", and excluding
|
|
115
|
-
// it entirely made a rating do a job breadth already does properly.
|
|
116
|
-
const RATING_TICKETS = { 1: 1, 2: 2, 3: 2 };
|
|
117
|
-
const ticketsForRating = rating => RATING_TICKETS[rating] ?? 2;
|
|
118
|
-
|
|
119
|
-
function challengerTickets(pool) {
|
|
120
|
-
return pool.flatMap(concept => {
|
|
121
|
-
if (concept.review?.breadth === 'niche') return [];
|
|
122
|
-
return Array.from({ length: ticketsForRating(concept.review?.rating) },
|
|
123
|
-
(_, ticket) => ({ concept, ticket }));
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function compositionTickets(pool) {
|
|
128
|
-
return pool.flatMap(composition => Array.from(
|
|
129
|
-
{ length: ticketsForRating(composition.review?.rating) },
|
|
130
|
-
(_, ticket) => ({ composition, ticket })));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Six challengers, two per translation tier, from an explicit approved pool.
|
|
135
|
-
* Drive with runSyncSelection or runAsyncSelection.
|
|
136
|
-
*
|
|
137
|
-
* @param {object} options
|
|
138
|
-
* @param {'direction'|'surface'} options.scope
|
|
139
|
-
* @param {string} options.key same key reproduces the roll
|
|
140
|
-
* @param {number} [options.reroll] round of the re-roll chain
|
|
141
|
-
* @param {number|null} [options.minRating] optional floor, skipped per tier it would empty
|
|
142
|
-
* @param {Array} options.concepts merged concepts with status, review, wellTier, familyId
|
|
143
|
-
* @returns {Generator<string[], {approved: Array, picks: Array}, string[]>}
|
|
144
|
-
*/
|
|
145
|
-
// A world with no allowedModes is eligible everywhere, which is what keeps this
|
|
146
|
-
// additive: nothing has to be backfilled for the filter to be safe.
|
|
147
|
-
function modeAllows(concept, mode) {
|
|
148
|
-
const allowed = concept.review?.allowedModes;
|
|
149
|
-
if (!Array.isArray(allowed) || allowed.length === 0) return true;
|
|
150
|
-
return allowed.includes(mode);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export function* selectApprovedChallengers({ scope, key, reroll = 0, minRating = null, mode = null, concepts }) {
|
|
154
|
-
const approved = concepts.filter(concept => concept.status === 'approved');
|
|
155
|
-
// Direction chooses a durable identity, so it draws worlds; surface designs
|
|
156
|
-
// one page inside a committed identity, so it draws compositions. Duals serve
|
|
157
|
-
// both. A tier with no matching-strength approvals falls back to its full
|
|
158
|
-
// approved pool rather than starving the roll.
|
|
159
|
-
const wanted = scope === 'direction'
|
|
160
|
-
? new Set(['world', 'dual'])
|
|
161
|
-
: new Set(['composition', 'dual']);
|
|
162
|
-
|
|
163
|
-
const approvedByTier = new Map();
|
|
164
|
-
for (const concept of approved) {
|
|
165
|
-
const tier = approvedByTier.get(concept.wellTier) || [];
|
|
166
|
-
tier.push(concept);
|
|
167
|
-
approvedByTier.set(concept.wellTier, tier);
|
|
168
|
-
}
|
|
169
|
-
if (WELL_TIERS.some(tier => !(approvedByTier.get(tier) || []).length)) {
|
|
170
|
-
throw new Error('concept-seed: every challenger tier needs at least one approved concept');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Optional minimum-rating gate, applied per tier and skipped for any tier it
|
|
174
|
-
// would empty, so a thin tier degrades to its full approved pool.
|
|
175
|
-
if (minRating) {
|
|
176
|
-
for (const [tier, pool] of approvedByTier) {
|
|
177
|
-
const rated = pool.filter(concept => (concept.review?.rating || 0) >= minRating);
|
|
178
|
-
if (rated.length > 0) approvedByTier.set(tier, rated);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
// Mode eligibility, per tier and skipped where it would empty a tier. Worlds
|
|
182
|
-
// used to be drawn with no mode awareness at all, so a build asking for an app
|
|
183
|
-
// UI could get six worlds that only make sense on a landing page. A world is an
|
|
184
|
-
// identity and identities transfer further than compositions do, so this is a
|
|
185
|
-
// ceiling the reviewer sets rather than a category assignment: eligible
|
|
186
|
-
// everywhere until someone says otherwise.
|
|
187
|
-
if (mode) {
|
|
188
|
-
for (const [tier, pool] of approvedByTier) {
|
|
189
|
-
const eligible = pool.filter(concept => modeAllows(concept, mode));
|
|
190
|
-
if (eligible.length > 0) approvedByTier.set(tier, eligible);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
for (const [tier, pool] of approvedByTier) {
|
|
194
|
-
const matching = pool.filter(concept => wanted.has(concept.strength));
|
|
195
|
-
if (matching.length > 0) approvedByTier.set(tier, matching);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Two challengers per tier, so every roll carries near-zero-translation
|
|
199
|
-
// graphic systems beside instrument languages and atmosphere worlds, with the
|
|
200
|
-
// second pick preferring a different family. Tier order is rolled too, to
|
|
201
|
-
// avoid positional bias.
|
|
202
|
-
function* pickRound(round, excluded) {
|
|
203
|
-
const salt = round === 0 ? '' : `:reroll-${round}`;
|
|
204
|
-
const tierOrder = (yield* rank(
|
|
205
|
-
WELL_TIERS.map(id => ({ id })),
|
|
206
|
-
`${scope}:${key}:tiers${salt}`
|
|
207
|
-
)).map(item => item.id);
|
|
208
|
-
const picks = [];
|
|
209
|
-
for (const [index, tier] of tierOrder.entries()) {
|
|
210
|
-
let pool = approvedByTier.get(tier).filter(concept => !excluded.has(concept.id));
|
|
211
|
-
// A tier exhausted by prior rounds falls back to reuse over starvation.
|
|
212
|
-
if (pool.length === 0) pool = approvedByTier.get(tier);
|
|
213
|
-
let tickets = challengerTickets(pool);
|
|
214
|
-
if (tickets.length === 0) tickets = pool.map(concept => ({ concept, ticket: 0 }));
|
|
215
|
-
const ranked = yield* rank(
|
|
216
|
-
tickets,
|
|
217
|
-
`${scope}:${key}:challenger-${index}${salt}`,
|
|
218
|
-
entry => `${entry.concept.id}#${entry.ticket}`
|
|
219
|
-
);
|
|
220
|
-
const order = [];
|
|
221
|
-
const seen = new Set();
|
|
222
|
-
for (const entry of ranked) {
|
|
223
|
-
if (seen.has(entry.concept.id)) continue;
|
|
224
|
-
seen.add(entry.concept.id);
|
|
225
|
-
order.push(entry.concept);
|
|
226
|
-
}
|
|
227
|
-
const first = order[0];
|
|
228
|
-
const second = order.find(concept => concept.familyId !== first.familyId)
|
|
229
|
-
|| order.find(concept => concept.id !== first.id);
|
|
230
|
-
picks.push(...(second ? [first, second] : [first]));
|
|
231
|
-
}
|
|
232
|
-
return picks;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Round n of a re-roll chain excludes everything rounds 0..n-1 drew, so the
|
|
236
|
-
// same base key reproduces the whole chain.
|
|
237
|
-
const excluded = new Set();
|
|
238
|
-
let picks = yield* pickRound(0, excluded);
|
|
239
|
-
for (let round = 1; round <= reroll; round += 1) {
|
|
240
|
-
for (const pick of picks) excluded.add(pick.id);
|
|
241
|
-
picks = yield* pickRound(round, excluded);
|
|
242
|
-
}
|
|
243
|
-
return { approved, picks };
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
function emptyMatch(grain, platform, platformExcluded = 0) {
|
|
247
|
-
return { grain: grain ?? null, atGrain: grain ? 0 : null, grainAvailable: grain ? 0 : null, platform: platform ?? null, platformExcluded };
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Three identity-free composition inputs from an explicit approved pool.
|
|
252
|
-
* Drive with runSyncSelection or runAsyncSelection.
|
|
253
|
-
*
|
|
254
|
-
* One input was too weak a counterweight to a model's habitual page skeleton:
|
|
255
|
-
* it became a single optional flourish beside six identity challengers rather
|
|
256
|
-
* than a real search over composition. Distinct composition families are preferred
|
|
257
|
-
* so a roll tests materially different hierarchy, sequence, and interaction
|
|
258
|
-
* laws. Cross-mode fallback would make the input misleading, so an absent mode
|
|
259
|
-
* returns nothing rather than borrowing. Re-rolls exclude every earlier set
|
|
260
|
-
* until the pool runs out.
|
|
261
|
-
*
|
|
262
|
-
* @param {object} options
|
|
263
|
-
* @param {'direction'|'surface'} options.scope
|
|
264
|
-
* @param {string} options.key
|
|
265
|
-
* @param {number} [options.reroll]
|
|
266
|
-
* @param {string|null} [options.mode] surface register to stay inside
|
|
267
|
-
* @param {string|null} [options.grain] how much of the product is in play
|
|
268
|
-
* @param {string|null} [options.platform] delivery target the result has to survive
|
|
269
|
-
* @param {Array} options.compositions merged compositions with status, review, surface, familyId
|
|
270
|
-
* @param {number} [options.count]
|
|
271
|
-
* @returns {Generator<string[], {picks: Array, match: object}, string[]>}
|
|
272
|
-
*/
|
|
273
|
-
export function* selectApprovedCompositions({ scope, key, reroll = 0, mode = null, grain = null, platform = null, compositions, count = 3 }) {
|
|
274
|
-
// Compositions honour the same breadth gate as worlds: one too specific to serve
|
|
275
|
-
// an arbitrary build stays approved for direct briefs and leaves the
|
|
276
|
-
// challenger pool. Falls back to the full approved set rather than returning
|
|
277
|
-
// nothing if every approved composition is niche.
|
|
278
|
-
let approved = compositions.filter(composition => composition.status === 'approved');
|
|
279
|
-
const broad = approved.filter(composition => composition.review?.breadth !== 'niche');
|
|
280
|
-
if (broad.length > 0) approved = broad;
|
|
281
|
-
if (approved.length === 0) return { picks: [], match: emptyMatch(grain, platform) };
|
|
282
|
-
if (mode) {
|
|
283
|
-
const matching = approved.filter(composition => composition.surface === mode);
|
|
284
|
-
if (matching.length === 0) return { picks: [], match: emptyMatch(grain, platform) };
|
|
285
|
-
approved = matching;
|
|
286
|
-
}
|
|
287
|
-
// Platform is a hard filter, unlike grain. A composition that needs hover or a
|
|
288
|
-
// pointer does not degrade on a phone into something slightly worse; it stops
|
|
289
|
-
// working, so borrowing it would be a defect rather than a stretch. Absent
|
|
290
|
-
// platforms means it survives anywhere.
|
|
291
|
-
let platformExcluded = 0;
|
|
292
|
-
if (platform) {
|
|
293
|
-
const survives = approved.filter(composition => {
|
|
294
|
-
const only = composition.platforms;
|
|
295
|
-
return !Array.isArray(only) || only.length === 0 || only.includes(platform);
|
|
296
|
-
});
|
|
297
|
-
platformExcluded = approved.length - survives.length;
|
|
298
|
-
// No fallback here either: dealing a hover-only composition to a phone build
|
|
299
|
-
// is worse than dealing nothing, and an empty deal is a visible gap.
|
|
300
|
-
approved = survives;
|
|
301
|
-
if (approved.length === 0) return { picks: [], match: emptyMatch(grain, platform, platformExcluded) };
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
const prior = new Set();
|
|
305
|
-
let picks = [];
|
|
306
|
-
for (let round = 0; round <= reroll; round += 1) {
|
|
307
|
-
const available = approved.filter(composition => !prior.has(composition.id));
|
|
308
|
-
const base = available.length >= Math.min(count, approved.length) ? available : approved;
|
|
309
|
-
// Rating weights the draw as it does for worlds. It matters more here
|
|
310
|
-
// because the per-surface pools are small, so an unweighted shuffle repeats
|
|
311
|
-
// a weak composition far more often. Each ticket carries its index so the rank
|
|
312
|
-
// sees a distinct key per ticket: ranking bare duplicates would hash
|
|
313
|
-
// identically and the pick loop's id-dedupe would silently discard the
|
|
314
|
-
// second copy, making the weighting a no-op.
|
|
315
|
-
let tickets = compositionTickets(base);
|
|
316
|
-
// A pool of nothing but 1-star keeps still has to yield compositions.
|
|
317
|
-
if (tickets.length === 0) tickets = base.map(composition => ({ composition, ticket: 0 }));
|
|
318
|
-
const ranked = (yield* rank(
|
|
319
|
-
tickets,
|
|
320
|
-
// The salt keeps the word "staging" deliberately. It is hash input, so
|
|
321
|
-
// renaming it would re-deal every roll anyone has ever reproduced by key.
|
|
322
|
-
round === 0 ? `${scope}:${key}:staging` : `${scope}:${key}:staging:reroll-${round}`,
|
|
323
|
-
entry => `${entry.composition.id}#${entry.ticket}`
|
|
324
|
-
)).map(entry => entry.composition);
|
|
325
|
-
|
|
326
|
-
// Grain is a preference, not a filter: requesting an onboarding flow deals
|
|
327
|
-
// flow-grain compositions first and tops up from the rest of the register
|
|
328
|
-
// rather than dealing fewer than three. A stable partition of an already
|
|
329
|
-
// deterministic ranking is still deterministic.
|
|
330
|
-
//
|
|
331
|
-
// The top-up is why match is reported. Dealing three plausible view-grain
|
|
332
|
-
// compositions against a flow request, with no signal that none matched, is
|
|
333
|
-
// the same silent-plausibility failure this whole axis exists to fix: the
|
|
334
|
-
// model would improvise the flow structure while believing it was handed one.
|
|
335
|
-
const ordered = grain
|
|
336
|
-
? [...ranked.filter(composition => composition.grain === grain),
|
|
337
|
-
...ranked.filter(composition => composition.grain !== grain)]
|
|
338
|
-
: ranked;
|
|
339
|
-
|
|
340
|
-
const families = new Set();
|
|
341
|
-
picks = [];
|
|
342
|
-
for (const composition of ordered) {
|
|
343
|
-
const family = composition.familyId ?? composition.id;
|
|
344
|
-
if (families.has(family)) continue;
|
|
345
|
-
picks.push(composition);
|
|
346
|
-
families.add(family);
|
|
347
|
-
if (picks.length >= count) break;
|
|
348
|
-
}
|
|
349
|
-
for (const composition of ordered) {
|
|
350
|
-
if (picks.length >= count) break;
|
|
351
|
-
if (!picks.some(pick => pick.id === composition.id)) picks.push(composition);
|
|
352
|
-
}
|
|
353
|
-
if (round < reroll) picks.forEach(composition => prior.add(composition.id));
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
const atGrain = grain ? picks.filter(composition => composition.grain === grain).length : null;
|
|
357
|
-
return {
|
|
358
|
-
picks,
|
|
359
|
-
match: {
|
|
360
|
-
grain: grain ?? null,
|
|
361
|
-
// How many of the dealt compositions actually sit at the requested grain.
|
|
362
|
-
// 0 with a grain requested means every pick is a borrowed structure.
|
|
363
|
-
atGrain,
|
|
364
|
-
grainAvailable: grain ? approved.filter(composition => composition.grain === grain).length : null,
|
|
365
|
-
platform: platform ?? null,
|
|
366
|
-
platformExcluded,
|
|
367
|
-
},
|
|
368
|
-
};
|
|
369
|
-
}
|