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,880 +0,0 @@
|
|
|
1
|
-
// Parse a DESIGN.md (Stitch-spec format) into a structured JSON model that
|
|
2
|
-
// the live-mode design-system panel can render. Deterministic, dependency-free.
|
|
3
|
-
//
|
|
4
|
-
// Two-layer: YAML frontmatter (machine-readable tokens) + markdown body
|
|
5
|
-
// (prose with eight canonical H2 sections). When frontmatter is present, it's
|
|
6
|
-
// exposed on `model.frontmatter` alongside the prose-scraped sections;
|
|
7
|
-
// consumers can prefer frontmatter values and fall back to prose.
|
|
8
|
-
|
|
9
|
-
// Array order is also match precedence: matchCanonicalSection's keyword-contained
|
|
10
|
-
// pass returns the first entry a heading contains, so reordering this changes
|
|
11
|
-
// which section an ambiguous heading resolves to.
|
|
12
|
-
const CANONICAL_SECTIONS = [
|
|
13
|
-
'Overview',
|
|
14
|
-
'Colors',
|
|
15
|
-
'Typography',
|
|
16
|
-
'Layout',
|
|
17
|
-
'Elevation',
|
|
18
|
-
'Shapes',
|
|
19
|
-
'Components',
|
|
20
|
-
"Do's and Don'ts",
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
// ---------- Frontmatter (Stitch YAML subset) ----------
|
|
24
|
-
|
|
25
|
-
function parseFrontmatter(md) {
|
|
26
|
-
const lines = md.split(/\r?\n/);
|
|
27
|
-
if (lines[0]?.trim() !== '---') return { frontmatter: null, body: md };
|
|
28
|
-
|
|
29
|
-
let end = -1;
|
|
30
|
-
for (let i = 1; i < lines.length; i++) {
|
|
31
|
-
if (lines[i].trim() === '---') { end = i; break; }
|
|
32
|
-
}
|
|
33
|
-
if (end === -1) return { frontmatter: null, body: md };
|
|
34
|
-
|
|
35
|
-
const yaml = lines.slice(1, end).join('\n');
|
|
36
|
-
const body = lines.slice(end + 1).join('\n');
|
|
37
|
-
try {
|
|
38
|
-
return { frontmatter: parseYamlSubset(yaml), body };
|
|
39
|
-
} catch {
|
|
40
|
-
return { frontmatter: null, body: md };
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Minimal YAML reader for the Stitch frontmatter subset: scalar maps with
|
|
45
|
-
// one level of nested objects (typography roles, components). Indent-based,
|
|
46
|
-
// 2-space convention. No arrays, no anchors, no multi-line scalars — Stitch's
|
|
47
|
-
// schema doesn't need them and accepting them would require a real YAML
|
|
48
|
-
// dependency we don't want to vendor.
|
|
49
|
-
function parseYamlSubset(yaml) {
|
|
50
|
-
const lines = yaml.split(/\r?\n/);
|
|
51
|
-
const root = {};
|
|
52
|
-
const stack = [{ indent: -1, obj: root }];
|
|
53
|
-
|
|
54
|
-
for (const raw of lines) {
|
|
55
|
-
// Skip blanks and line-only comments. Don't strip inline comments:
|
|
56
|
-
// unquoted hex values start with `#` and can't be safely distinguished
|
|
57
|
-
// from a comment after whitespace.
|
|
58
|
-
if (!raw.trim() || /^\s*#/.test(raw)) continue;
|
|
59
|
-
|
|
60
|
-
const indent = raw.match(/^\s*/)[0].length;
|
|
61
|
-
const content = raw.slice(indent);
|
|
62
|
-
|
|
63
|
-
const colonIdx = findTopLevelColon(content);
|
|
64
|
-
if (colonIdx === -1) continue;
|
|
65
|
-
|
|
66
|
-
while (stack.length > 1 && stack[stack.length - 1].indent >= indent) {
|
|
67
|
-
stack.pop();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const key = unquoteYamlKey(content.slice(0, colonIdx).trim());
|
|
71
|
-
const rest = stripInlineYamlComment(content.slice(colonIdx + 1).trim());
|
|
72
|
-
const parent = stack[stack.length - 1].obj;
|
|
73
|
-
|
|
74
|
-
if (rest === '') {
|
|
75
|
-
const obj = {};
|
|
76
|
-
parent[key] = obj;
|
|
77
|
-
stack.push({ indent, obj });
|
|
78
|
-
} else {
|
|
79
|
-
parent[key] = parseScalar(rest);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return root;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function findTopLevelColon(s) {
|
|
87
|
-
let inQuote = null;
|
|
88
|
-
for (let i = 0; i < s.length; i++) {
|
|
89
|
-
const ch = s[i];
|
|
90
|
-
if (inQuote) {
|
|
91
|
-
if (ch === inQuote && s[i - 1] !== '\\') inQuote = null;
|
|
92
|
-
} else if (ch === '"' || ch === "'") {
|
|
93
|
-
inQuote = ch;
|
|
94
|
-
} else if (ch === ':') {
|
|
95
|
-
return i;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return -1;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function unquoteYamlKey(key) {
|
|
102
|
-
if ((key.startsWith('"') && key.endsWith('"')) || (key.startsWith("'") && key.endsWith("'"))) {
|
|
103
|
-
return key.slice(1, -1);
|
|
104
|
-
}
|
|
105
|
-
return key;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function stripInlineYamlComment(s) {
|
|
109
|
-
let inQuote = null;
|
|
110
|
-
for (let i = 0; i < s.length; i++) {
|
|
111
|
-
const ch = s[i];
|
|
112
|
-
if (inQuote) {
|
|
113
|
-
if (ch === inQuote && s[i - 1] !== '\\') inQuote = null;
|
|
114
|
-
} else if (ch === '"' || ch === "'") {
|
|
115
|
-
inQuote = ch;
|
|
116
|
-
} else if (ch === '#' && i > 0 && /\s/.test(s[i - 1])) {
|
|
117
|
-
return s.slice(0, i).trimEnd();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return s;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// YAML double-quoted scalars process backslash escapes. Stripping the outer
|
|
124
|
-
// quotes without unescaping leaves them in place, so a nested font family like
|
|
125
|
-
// fontFamily: "\"IBM Plex Sans\", system-ui, sans-serif"
|
|
126
|
-
// keeps its literal backslashes and never matches the same family in CSS.
|
|
127
|
-
// The full YAML 1.2 double-quote escape set (spec section 5.7).
|
|
128
|
-
const YAML_SIMPLE_ESCAPES = {
|
|
129
|
-
'0': '\0',
|
|
130
|
-
a: '\x07',
|
|
131
|
-
b: '\b',
|
|
132
|
-
t: '\t',
|
|
133
|
-
n: '\n',
|
|
134
|
-
v: '\v',
|
|
135
|
-
f: '\f',
|
|
136
|
-
r: '\r',
|
|
137
|
-
e: '\x1b',
|
|
138
|
-
' ': ' ',
|
|
139
|
-
'"': '"',
|
|
140
|
-
'/': '/',
|
|
141
|
-
'\\': '\\',
|
|
142
|
-
N: '\u0085',
|
|
143
|
-
_: '\u00a0',
|
|
144
|
-
L: '\u2028',
|
|
145
|
-
P: '\u2029',
|
|
146
|
-
};
|
|
147
|
-
const YAML_HEX_ESCAPE_LENGTHS = { x: 2, u: 4, U: 8 };
|
|
148
|
-
|
|
149
|
-
function unescapeYamlDoubleQuoted(body) {
|
|
150
|
-
let out = '';
|
|
151
|
-
for (let i = 0; i < body.length; i++) {
|
|
152
|
-
const ch = body[i];
|
|
153
|
-
if (ch !== '\\' || i === body.length - 1) {
|
|
154
|
-
out += ch;
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
const next = body[i + 1];
|
|
158
|
-
if (Object.prototype.hasOwnProperty.call(YAML_SIMPLE_ESCAPES, next)) {
|
|
159
|
-
out += YAML_SIMPLE_ESCAPES[next];
|
|
160
|
-
i++;
|
|
161
|
-
continue;
|
|
162
|
-
}
|
|
163
|
-
// \xNN, \uNNNN, \UNNNNNNNN. Malformed or out-of-range sequences stay
|
|
164
|
-
// literal rather than corrupting the rest of the scalar.
|
|
165
|
-
const hexLen = YAML_HEX_ESCAPE_LENGTHS[next];
|
|
166
|
-
if (hexLen) {
|
|
167
|
-
const hex = body.slice(i + 2, i + 2 + hexLen);
|
|
168
|
-
const codePoint = hex.length === hexLen && /^[0-9a-fA-F]+$/.test(hex) ? parseInt(hex, 16) : -1;
|
|
169
|
-
if (codePoint >= 0 && codePoint <= 0x10ffff) {
|
|
170
|
-
out += String.fromCodePoint(codePoint);
|
|
171
|
-
i += 1 + hexLen;
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
out += ch;
|
|
176
|
-
}
|
|
177
|
-
return out;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function parseScalar(raw) {
|
|
181
|
-
const s = raw.trim();
|
|
182
|
-
if (s.length >= 2 && s.startsWith('"') && s.endsWith('"')) {
|
|
183
|
-
return unescapeYamlDoubleQuoted(s.slice(1, -1));
|
|
184
|
-
}
|
|
185
|
-
// Single-quoted YAML escapes only the quote itself, by doubling it.
|
|
186
|
-
if (s.length >= 2 && s.startsWith("'") && s.endsWith("'")) {
|
|
187
|
-
return s.slice(1, -1).split("''").join("'");
|
|
188
|
-
}
|
|
189
|
-
if (s === 'true') return true;
|
|
190
|
-
if (s === 'false') return false;
|
|
191
|
-
if (s === 'null' || s === '~') return null;
|
|
192
|
-
if (/^-?\d+$/.test(s)) return Number(s);
|
|
193
|
-
if (/^-?\d*\.\d+$/.test(s)) return Number(s);
|
|
194
|
-
return s;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
const HEX_RE = /#[0-9a-fA-F]{3,8}\b/g;
|
|
198
|
-
const OKLCH_RE = /oklch\([^)]+\)/gi;
|
|
199
|
-
|
|
200
|
-
// ---------- Section splitting ----------
|
|
201
|
-
|
|
202
|
-
function splitSections(md) {
|
|
203
|
-
const lines = md.split(/\r?\n/);
|
|
204
|
-
let title = null;
|
|
205
|
-
const sections = {};
|
|
206
|
-
let current = null;
|
|
207
|
-
|
|
208
|
-
for (const raw of lines) {
|
|
209
|
-
const line = raw.trimEnd();
|
|
210
|
-
|
|
211
|
-
if (!title && line.startsWith('# ') && !line.startsWith('## ')) {
|
|
212
|
-
title = line.replace(/^#\s+/, '').trim();
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const h2 = line.match(/^##\s+(?:\d+\.\s*)?([^:\n]+?)(?::\s*(.+))?$/);
|
|
217
|
-
if (h2) {
|
|
218
|
-
const rawName = normalizeApostrophes(h2[1].trim());
|
|
219
|
-
const subtitle = h2[2] ? h2[2].trim() : null;
|
|
220
|
-
const canonical = matchCanonicalSection(rawName);
|
|
221
|
-
if (canonical) {
|
|
222
|
-
current = { name: canonical, subtitle, lines: [] };
|
|
223
|
-
sections[canonical] = current;
|
|
224
|
-
continue;
|
|
225
|
-
}
|
|
226
|
-
// non-canonical H2 — ignore but stop feeding into current
|
|
227
|
-
current = null;
|
|
228
|
-
continue;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (current) current.lines.push(raw);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return { title, sections };
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function normalizeApostrophes(s) {
|
|
238
|
-
return s.replace(/[\u2018\u2019]/g, "'");
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
function matchCanonicalSection(name) {
|
|
242
|
-
const normalized = normalizeApostrophes(name).toLowerCase();
|
|
243
|
-
// Exact match first
|
|
244
|
-
for (const c of CANONICAL_SECTIONS) {
|
|
245
|
-
if (normalizeApostrophes(c).toLowerCase() === normalized) return c;
|
|
246
|
-
}
|
|
247
|
-
// Keyword-contained match: "Overview & Creative North Star" -> "Overview",
|
|
248
|
-
// "Elevation & Depth" -> "Elevation", etc.
|
|
249
|
-
for (const c of CANONICAL_SECTIONS) {
|
|
250
|
-
const key = normalizeApostrophes(c).toLowerCase();
|
|
251
|
-
const pattern = new RegExp(`\\b${key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\b`);
|
|
252
|
-
if (pattern.test(normalized)) return c;
|
|
253
|
-
}
|
|
254
|
-
return null;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
// ---------- Subsection splitting (inside a canonical section) ----------
|
|
258
|
-
|
|
259
|
-
function splitSubsections(lines) {
|
|
260
|
-
const subs = [];
|
|
261
|
-
let current = { name: null, lines: [] };
|
|
262
|
-
subs.push(current);
|
|
263
|
-
|
|
264
|
-
for (const raw of lines) {
|
|
265
|
-
const h3 = raw.match(/^###\s+(.+?)\s*$/);
|
|
266
|
-
if (h3) {
|
|
267
|
-
current = { name: h3[1].trim(), lines: [] };
|
|
268
|
-
subs.push(current);
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
current.lines.push(raw);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return subs;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// ---------- Generic helpers ----------
|
|
278
|
-
|
|
279
|
-
function collectParagraphs(lines) {
|
|
280
|
-
const paragraphs = [];
|
|
281
|
-
let buf = [];
|
|
282
|
-
const flush = () => {
|
|
283
|
-
if (buf.length) {
|
|
284
|
-
paragraphs.push(buf.join(' ').trim());
|
|
285
|
-
buf = [];
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
for (const raw of lines) {
|
|
289
|
-
const trimmed = raw.trim();
|
|
290
|
-
if (trimmed === '') { flush(); continue; }
|
|
291
|
-
// Horizontal rules (---, ***) and headings/bullets end a paragraph.
|
|
292
|
-
if (/^(?:-{3,}|\*{3,}|_{3,})$/.test(trimmed)) { flush(); continue; }
|
|
293
|
-
if (raw.startsWith('#') || raw.match(/^[-*]\s/)) { flush(); continue; }
|
|
294
|
-
buf.push(trimmed);
|
|
295
|
-
}
|
|
296
|
-
flush();
|
|
297
|
-
return paragraphs.filter(Boolean);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
function collectBullets(lines) {
|
|
301
|
-
const bullets = [];
|
|
302
|
-
let current = null;
|
|
303
|
-
for (const raw of lines) {
|
|
304
|
-
const m = raw.match(/^\s*[-*]\s+(.+)$/);
|
|
305
|
-
if (m) {
|
|
306
|
-
if (current) bullets.push(current);
|
|
307
|
-
current = m[1];
|
|
308
|
-
continue;
|
|
309
|
-
}
|
|
310
|
-
// continuation of a bullet (indented line)
|
|
311
|
-
if (current && raw.match(/^\s{2,}\S/)) {
|
|
312
|
-
current += ' ' + raw.trim();
|
|
313
|
-
continue;
|
|
314
|
-
}
|
|
315
|
-
// blank line ends a bullet
|
|
316
|
-
if (raw.trim() === '' && current) {
|
|
317
|
-
bullets.push(current);
|
|
318
|
-
current = null;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
if (current) bullets.push(current);
|
|
322
|
-
return bullets;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function stripBold(s) {
|
|
326
|
-
return s.replace(/\*\*(.+?)\*\*/g, '$1');
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
function extractNamedRules(lines) {
|
|
330
|
-
const rules = [];
|
|
331
|
-
const seen = new Set();
|
|
332
|
-
const addRule = (name, body, { allowDuplicate = false } = {}) => {
|
|
333
|
-
const key = name.toLowerCase();
|
|
334
|
-
if (!allowDuplicate && seen.has(key)) return;
|
|
335
|
-
seen.add(key);
|
|
336
|
-
rules.push({ name, body });
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
// Style A (Impeccable): "**The X Rule.** body body body" — can span lines.
|
|
340
|
-
const joined = lines.join('\n');
|
|
341
|
-
const inlineMatches = [...joined.matchAll(/\*\*(The [^*]+?Rule)\.\*\*/g)];
|
|
342
|
-
for (let i = 0; i < inlineMatches.length; i++) {
|
|
343
|
-
const match = inlineMatches[i];
|
|
344
|
-
const bodyEnd = inlineMatches[i + 1]?.index ?? joined.length;
|
|
345
|
-
const body = joined
|
|
346
|
-
.slice(match.index + match[0].length, bodyEnd)
|
|
347
|
-
.replace(/\n##[^\n]*$/s, '')
|
|
348
|
-
.replace(/\n###[^\n]*$/s, '')
|
|
349
|
-
.trim();
|
|
350
|
-
// Preserve the inline format's historical behavior: repeated inline rules
|
|
351
|
-
// remain visible, while the later heading and bullet formats dedupe.
|
|
352
|
-
addRule(stripBold(match[1]).trim(), stripBold(body), { allowDuplicate: true });
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// Style B (Stitch): `### The "X" Rule` or `### The X Fallback`, body is the
|
|
356
|
-
// bullets/paragraphs until the next heading. Accept Rule / Fallback / Principle.
|
|
357
|
-
for (const subsection of splitSubsections(lines).slice(1)) {
|
|
358
|
-
const headerName = stripBold(subsection.name).replace(/["“”]/g, '').trim();
|
|
359
|
-
if (!/^The\b.*\b(Rule|Fallback|Principle)\b/i.test(headerName)) continue;
|
|
360
|
-
|
|
361
|
-
const body = stripBold(subsection.lines.join('\n').replace(/\n+/g, ' ')).trim();
|
|
362
|
-
if (body) addRule(headerName, body);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// Style C (Stitch bullet form): "* **The Layering Principle:** body"
|
|
366
|
-
// Colon/period lives inside the bold, so match "**...**" then inspect.
|
|
367
|
-
for (const b of collectBullets(lines)) {
|
|
368
|
-
const mm = b.match(/^\*\*([^*]+?)\*\*\s*(.+)$/);
|
|
369
|
-
if (!mm) continue;
|
|
370
|
-
const nameRaw = mm[1].replace(/[.:]\s*$/, '').replace(/["“”]/g, '').trim();
|
|
371
|
-
if (!/^The\b.+\b(Rule|Fallback|Principle)$/i.test(nameRaw)) continue;
|
|
372
|
-
addRule(nameRaw, stripBold(mm[2]).trim());
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
return rules;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
// ---------- Per-section extractors ----------
|
|
379
|
-
|
|
380
|
-
function extractOverview(section) {
|
|
381
|
-
if (!section) return null;
|
|
382
|
-
const text = section.lines.join('\n');
|
|
383
|
-
const northStar = text.match(/\*\*Creative North Star:\s*"([^"]+)"\*\*/);
|
|
384
|
-
const keyCharMatch = text.match(/\*\*Key Characteristics:\*\*\s*\n([\s\S]+?)(?:\n##|\n###|$)/);
|
|
385
|
-
const keyChars = keyCharMatch
|
|
386
|
-
? collectBullets(keyCharMatch[1].split('\n')).map((bullet) => stripBold(bullet.trim()))
|
|
387
|
-
: [];
|
|
388
|
-
const prose = keyCharMatch
|
|
389
|
-
? text.slice(0, keyCharMatch.index) + text.slice(keyCharMatch.index + keyCharMatch[0].length)
|
|
390
|
-
: text;
|
|
391
|
-
|
|
392
|
-
// Philosophy paragraphs: everything that isn't a rule header or key-char block
|
|
393
|
-
const paragraphs = collectParagraphs(prose.split('\n')).filter(
|
|
394
|
-
(p) =>
|
|
395
|
-
!p.startsWith('**Creative North Star') &&
|
|
396
|
-
!p.startsWith('**Key Characteristics')
|
|
397
|
-
);
|
|
398
|
-
|
|
399
|
-
return {
|
|
400
|
-
subtitle: section.subtitle,
|
|
401
|
-
creativeNorthStar: northStar ? northStar[1] : null,
|
|
402
|
-
philosophy: paragraphs,
|
|
403
|
-
keyCharacteristics: keyChars,
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
function extractColors(section) {
|
|
408
|
-
if (!section) return null;
|
|
409
|
-
const subs = splitSubsections(section.lines);
|
|
410
|
-
|
|
411
|
-
const description = collectParagraphs(subs[0].lines).join(' ');
|
|
412
|
-
const groups = [];
|
|
413
|
-
const ROLE_KEYWORDS = /^(primary|secondary|tertiary|neutral|accent)\b/i;
|
|
414
|
-
|
|
415
|
-
for (const sub of subs.slice(1)) {
|
|
416
|
-
if (!sub.name || /Named Rules?/i.test(sub.name) || /^The\s/i.test(sub.name)) continue;
|
|
417
|
-
|
|
418
|
-
const bullets = collectBullets(sub.lines);
|
|
419
|
-
const parsed = bullets.map((b) => parseColorBullet(b)).filter(Boolean);
|
|
420
|
-
if (parsed.length === 0) continue;
|
|
421
|
-
|
|
422
|
-
// If every bullet starts with a role keyword (Primary/Secondary/...), promote
|
|
423
|
-
// each bullet to its own group. Otherwise keep the subsection as the group.
|
|
424
|
-
const allRoleBullets =
|
|
425
|
-
parsed.length > 0 && parsed.every((p) => p.name && ROLE_KEYWORDS.test(p.name));
|
|
426
|
-
|
|
427
|
-
if (allRoleBullets) {
|
|
428
|
-
for (const p of parsed) {
|
|
429
|
-
groups.push({ role: p.name, colors: [p] });
|
|
430
|
-
}
|
|
431
|
-
} else {
|
|
432
|
-
groups.push({ role: sub.name, colors: parsed });
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
// If the Colors section has no subsections at all (unlikely), fall back to
|
|
437
|
-
// scanning the whole section as a flat bullet list.
|
|
438
|
-
if (groups.length === 0) {
|
|
439
|
-
const flat = collectBullets(section.lines)
|
|
440
|
-
.map((b) => parseColorBullet(b))
|
|
441
|
-
.filter(Boolean);
|
|
442
|
-
if (flat.length) {
|
|
443
|
-
for (const p of flat) {
|
|
444
|
-
if (p.name && ROLE_KEYWORDS.test(p.name)) {
|
|
445
|
-
groups.push({ role: p.name, colors: [p] });
|
|
446
|
-
} else {
|
|
447
|
-
const fallback = groups.find((g) => g.role === 'Palette');
|
|
448
|
-
if (fallback) fallback.colors.push(p);
|
|
449
|
-
else groups.push({ role: 'Palette', colors: [p] });
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
return {
|
|
456
|
-
subtitle: section.subtitle,
|
|
457
|
-
description: description || null,
|
|
458
|
-
groups,
|
|
459
|
-
rules: extractNamedRules(section.lines),
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
function parseColorBullet(bullet) {
|
|
464
|
-
const text = bullet.trim();
|
|
465
|
-
|
|
466
|
-
// Case 1 (Impeccable): **Name** (value-with-maybe-nested-parens): description
|
|
467
|
-
const bold = text.match(/^\*\*(.+?)\*\*\s*(.*)$/);
|
|
468
|
-
if (bold && bold[2].startsWith('(')) {
|
|
469
|
-
const value = extractParenGroup(bold[2]);
|
|
470
|
-
if (value !== null) {
|
|
471
|
-
const after = bold[2].slice(value.length + 2).trimStart();
|
|
472
|
-
if (after.startsWith(':')) {
|
|
473
|
-
return buildColor(bold[1], value, after.slice(1).trim());
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
// Case 2 (Stitch): **Name (values):** description — value embedded in bold.
|
|
479
|
-
const stitch = text.match(/^\*\*([^*]+?)\s*\(([^)]+)\):\*\*\s*(.*)$/);
|
|
480
|
-
if (stitch) {
|
|
481
|
-
return buildColor(stitch[1].trim(), stitch[2], stitch[3]);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
// Case 3: bullet without bold, just hex/oklch inside.
|
|
485
|
-
const values = collectColorValues(text);
|
|
486
|
-
if (values.length) {
|
|
487
|
-
return buildColor(null, values.join(' to '), text);
|
|
488
|
-
}
|
|
489
|
-
return null;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
function extractParenGroup(s) {
|
|
493
|
-
if (s[0] !== '(') return null;
|
|
494
|
-
let depth = 0;
|
|
495
|
-
for (let i = 0; i < s.length; i++) {
|
|
496
|
-
if (s[i] === '(') depth++;
|
|
497
|
-
else if (s[i] === ')') {
|
|
498
|
-
depth--;
|
|
499
|
-
if (depth === 0) return s.slice(1, i);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
return null;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
function buildColor(name, rawValue, description) {
|
|
506
|
-
const values = collectColorValues(rawValue);
|
|
507
|
-
const primary = values[0] ?? rawValue.trim();
|
|
508
|
-
return {
|
|
509
|
-
name: name ? stripBold(name).trim() : null,
|
|
510
|
-
value: primary,
|
|
511
|
-
valueRange: values.length > 1 ? values : null,
|
|
512
|
-
format: detectFormat(primary),
|
|
513
|
-
description: stripBold(description || '').trim() || null,
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
function collectColorValues(s) {
|
|
518
|
-
const out = [];
|
|
519
|
-
s.replace(HEX_RE, (v) => {
|
|
520
|
-
out.push(v);
|
|
521
|
-
return v;
|
|
522
|
-
});
|
|
523
|
-
s.replace(OKLCH_RE, (v) => {
|
|
524
|
-
out.push(v);
|
|
525
|
-
return v;
|
|
526
|
-
});
|
|
527
|
-
return out;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
function detectFormat(v) {
|
|
531
|
-
if (!v) return 'unknown';
|
|
532
|
-
if (v.startsWith('#')) return 'hex';
|
|
533
|
-
if (/^oklch/i.test(v)) return 'oklch';
|
|
534
|
-
if (/^rgb/i.test(v)) return 'rgb';
|
|
535
|
-
return 'unknown';
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
function extractTypography(section) {
|
|
539
|
-
if (!section) return null;
|
|
540
|
-
const text = section.lines.join('\n');
|
|
541
|
-
|
|
542
|
-
const fonts = {};
|
|
543
|
-
// Pattern A: **Display Font:** Family (with fallback)
|
|
544
|
-
const fontLineRe = /\*\*([\w\s/]+?)Font:\*\*\s*([^\n(]+?)(?:\s*\(with\s+([^)]+)\))?\s*$/gm;
|
|
545
|
-
let fm;
|
|
546
|
-
while ((fm = fontLineRe.exec(text)) !== null) {
|
|
547
|
-
const rawRole = fm[1].trim().toLowerCase().replace(/\s+/g, '-');
|
|
548
|
-
const role = normalizeFontRole(rawRole) || 'display';
|
|
549
|
-
fonts[role] = {
|
|
550
|
-
family: fm[2].trim(),
|
|
551
|
-
fallback: fm[3] ? fm[3].trim() : null,
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
// Pattern B (Stitch): * **Display & Headlines (Noto Serif):** description
|
|
556
|
-
if (Object.keys(fonts).length === 0) {
|
|
557
|
-
const stitchRe = /\*\*([\w\s&/]+?)\s*\(([^)]+)\):\*\*\s*(.+)/g;
|
|
558
|
-
let sm;
|
|
559
|
-
while ((sm = stitchRe.exec(text)) !== null) {
|
|
560
|
-
const rawRole = sm[1]
|
|
561
|
-
.trim()
|
|
562
|
-
.toLowerCase()
|
|
563
|
-
.replace(/\s*&\s*/g, '-')
|
|
564
|
-
.replace(/\s+/g, '-');
|
|
565
|
-
const role = normalizeFontRole(rawRole) || rawRole;
|
|
566
|
-
fonts[role] = { family: sm[2].trim(), fallback: null, purpose: sm[3].trim() };
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
// Character paragraph — either a **Character:** label, or fall back to the
|
|
571
|
-
// first free paragraph under the section header (Stitch style).
|
|
572
|
-
const characterMatch = text.match(/\*\*Character:\*\*\s*([^\n]+(?:\n[^\n]+)*?)(?=\n\n|\n###|\n##|$)/);
|
|
573
|
-
let character = characterMatch ? characterMatch[1].replace(/\n/g, ' ').trim() : null;
|
|
574
|
-
if (!character) {
|
|
575
|
-
const paragraphs = collectParagraphs(section.lines).filter(
|
|
576
|
-
(p) => !/^\*\*[\w\s/&]+Font/i.test(p) && !/^\*\*[\w\s/&]+\([^)]+\)/.test(p)
|
|
577
|
-
);
|
|
578
|
-
if (paragraphs.length) character = paragraphs[0];
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
// Hierarchy bullets under ### Hierarchy
|
|
582
|
-
const subs = splitSubsections(section.lines);
|
|
583
|
-
let hierarchy = [];
|
|
584
|
-
const hierSub = subs.find((s) => s.name && /hierarch/i.test(s.name));
|
|
585
|
-
if (hierSub) {
|
|
586
|
-
const bullets = collectBullets(hierSub.lines);
|
|
587
|
-
hierarchy = bullets.map(parseTypeBullet).filter(Boolean);
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
return {
|
|
591
|
-
subtitle: section.subtitle,
|
|
592
|
-
fonts,
|
|
593
|
-
character,
|
|
594
|
-
hierarchy,
|
|
595
|
-
rules: extractNamedRules(section.lines),
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
function normalizeFontRole(raw) {
|
|
600
|
-
// Canonical roles the panel cares about: display, body, label, mono.
|
|
601
|
-
// Stitch often writes compound roles like "display-&-headlines" or "ui-&-body"
|
|
602
|
-
// — collapse them to the first canonical role present.
|
|
603
|
-
const tokens = raw.split(/[-/&\s]+/).filter(Boolean);
|
|
604
|
-
const priority = ['display', 'headline', 'body', 'ui', 'label', 'mono'];
|
|
605
|
-
const canonical = { headline: 'display', ui: 'body' };
|
|
606
|
-
for (const p of priority) {
|
|
607
|
-
if (tokens.includes(p)) return canonical[p] || p;
|
|
608
|
-
}
|
|
609
|
-
return null;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
function parseTypeBullet(bullet) {
|
|
613
|
-
// - **Display** (family, weight 300, italic, clamp(...), line-height 1): purpose
|
|
614
|
-
const m = bullet.match(/^\*\*(.+?)\*\*\s*\(([^)]+)\):\s*(.*)$/);
|
|
615
|
-
if (!m) return null;
|
|
616
|
-
const name = m[1].trim();
|
|
617
|
-
const specs = m[2].split(',').map((s) => s.trim());
|
|
618
|
-
return {
|
|
619
|
-
name,
|
|
620
|
-
specs,
|
|
621
|
-
purpose: stripBold(m[3] || '').trim() || null,
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
function extractGuidance(section) {
|
|
626
|
-
if (!section) return null;
|
|
627
|
-
const subs = splitSubsections(section.lines);
|
|
628
|
-
return {
|
|
629
|
-
subtitle: section.subtitle,
|
|
630
|
-
description: collectParagraphs(subs[0].lines).join(' ') || null,
|
|
631
|
-
rules: extractNamedRules(section.lines),
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
function extractElevation(section) {
|
|
636
|
-
const guidance = extractGuidance(section);
|
|
637
|
-
if (!guidance) return null;
|
|
638
|
-
|
|
639
|
-
const shadows = [];
|
|
640
|
-
const seen = new Set();
|
|
641
|
-
const dedupe = (entry) => {
|
|
642
|
-
const key = (entry.name || '') + '::' + entry.value;
|
|
643
|
-
if (seen.has(key)) return;
|
|
644
|
-
seen.add(key);
|
|
645
|
-
shadows.push(entry);
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
for (const b of collectBullets(section.lines)) {
|
|
649
|
-
const parsed = parseShadowBullet(b);
|
|
650
|
-
if (parsed) dedupe(parsed);
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
// Fallback: extract shadows written inline in prose. Stitch style is
|
|
654
|
-
// "...use an extra-diffused shadow: `box-shadow: 0 12px 40px rgba(...)`."
|
|
655
|
-
for (const p of collectParagraphs(section.lines)) {
|
|
656
|
-
for (const inline of extractInlineShadows(p)) dedupe(inline);
|
|
657
|
-
}
|
|
658
|
-
for (const b of collectBullets(section.lines)) {
|
|
659
|
-
for (const inline of extractInlineShadows(b)) dedupe(inline);
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
return { ...guidance, shadows };
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
function extractInlineShadows(text) {
|
|
666
|
-
// Find `box-shadow: ...` anywhere in prose and capture the value. Work on the
|
|
667
|
-
// raw string so it handles both backtick-fenced and unfenced variants.
|
|
668
|
-
const out = [];
|
|
669
|
-
const re = /box-shadow\s*:\s*([^`;\n]+)/gi;
|
|
670
|
-
let m;
|
|
671
|
-
while ((m = re.exec(text)) !== null) {
|
|
672
|
-
const value = m[1].replace(/[`.)]+$/, '').trim();
|
|
673
|
-
if (!value) continue;
|
|
674
|
-
// Name heuristic: the noun immediately before the shadow phrase.
|
|
675
|
-
// e.g. "an extra-diffused shadow: ..." -> "extra-diffused shadow"
|
|
676
|
-
const before = text.slice(0, m.index);
|
|
677
|
-
const nameMatch = before.match(/\b([A-Za-z][A-Za-z\- ]{2,40})\s+shadow\b[^A-Za-z0-9]*$/i);
|
|
678
|
-
let name = null;
|
|
679
|
-
if (nameMatch) {
|
|
680
|
-
const stripped = nameMatch[1]
|
|
681
|
-
.replace(/^(?:use|using|apply|applying|is|are|looks? like)\s+/i, '')
|
|
682
|
-
.replace(/^(?:a|an|the)\s+/i, '')
|
|
683
|
-
.trim();
|
|
684
|
-
if (stripped) {
|
|
685
|
-
name =
|
|
686
|
-
stripped.charAt(0).toUpperCase() + stripped.slice(1) + ' shadow';
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
out.push({
|
|
690
|
-
name,
|
|
691
|
-
value,
|
|
692
|
-
purpose: null,
|
|
693
|
-
});
|
|
694
|
-
}
|
|
695
|
-
return out;
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
function parseShadowBullet(bullet) {
|
|
699
|
-
// - **Name** (`box-shadow: value`): purpose
|
|
700
|
-
// - **Name** (`value`): purpose
|
|
701
|
-
// Only accept if the paren content looks like a shadow value (contains px,
|
|
702
|
-
// rem, rgba, or box-shadow). This filters out `**Rule Name:**` bullets.
|
|
703
|
-
const m = bullet.match(/^\*\*(.+?)\*\*\s*\(`?([^`]+?)`?\):\s*(.*)$/);
|
|
704
|
-
if (!m) return null;
|
|
705
|
-
const rawValue = m[2].replace(/^box-shadow:\s*/i, '').trim();
|
|
706
|
-
const looksLikeShadow =
|
|
707
|
-
/box-shadow|rgba?\(|\bpx\b|\brem\b|^-?\d+\s/i.test(rawValue) &&
|
|
708
|
-
/\d/.test(rawValue);
|
|
709
|
-
if (!looksLikeShadow) return null;
|
|
710
|
-
const name = stripBold(m[1]).trim();
|
|
711
|
-
return {
|
|
712
|
-
name,
|
|
713
|
-
value: rawValue,
|
|
714
|
-
purpose: stripBold(m[3] || '').trim() || null,
|
|
715
|
-
};
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
function extractComponents(section) {
|
|
719
|
-
if (!section) return null;
|
|
720
|
-
const subs = splitSubsections(section.lines);
|
|
721
|
-
const components = [];
|
|
722
|
-
|
|
723
|
-
for (const sub of subs.slice(1)) {
|
|
724
|
-
if (!sub.name) continue;
|
|
725
|
-
|
|
726
|
-
const bullets = collectBullets(sub.lines);
|
|
727
|
-
const paragraphs = collectParagraphs(sub.lines);
|
|
728
|
-
|
|
729
|
-
const variants = [];
|
|
730
|
-
const properties = {};
|
|
731
|
-
|
|
732
|
-
for (const b of bullets) {
|
|
733
|
-
// - **Key:** value
|
|
734
|
-
const m = b.match(/^\*\*(.+?):?\*\*:?\s*(.+)$/);
|
|
735
|
-
if (m) {
|
|
736
|
-
const key = stripBold(m[1]).trim();
|
|
737
|
-
const value = stripBold(m[2]).trim();
|
|
738
|
-
// Heuristic: "Primary", "Secondary", "Hover", "Focus" etc are variants;
|
|
739
|
-
// "Shape", "Background", "Padding" are properties.
|
|
740
|
-
if (/^(primary|secondary|tertiary|ghost|hover|focus|active|disabled|default|error|selected|unselected|state)$/i.test(key.split(/[\s/]/)[0])) {
|
|
741
|
-
variants.push({ name: key, description: value });
|
|
742
|
-
} else {
|
|
743
|
-
properties[key.toLowerCase()] = value;
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
components.push({
|
|
749
|
-
name: sub.name,
|
|
750
|
-
description: paragraphs.join(' ') || null,
|
|
751
|
-
properties,
|
|
752
|
-
variants,
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
return {
|
|
757
|
-
subtitle: section.subtitle,
|
|
758
|
-
components,
|
|
759
|
-
};
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
function extractDosDonts(section) {
|
|
763
|
-
if (!section) return null;
|
|
764
|
-
const subs = splitSubsections(section.lines);
|
|
765
|
-
const dos = [];
|
|
766
|
-
const donts = [];
|
|
767
|
-
|
|
768
|
-
for (const sub of subs.slice(1)) {
|
|
769
|
-
if (!sub.name) continue;
|
|
770
|
-
const subName = normalizeApostrophes(sub.name);
|
|
771
|
-
const bullets = collectBullets(sub.lines).map((b) => stripBold(b).trim());
|
|
772
|
-
if (/^do'?t?:?$/i.test(subName) || /^do:?$/i.test(subName)) {
|
|
773
|
-
dos.push(...bullets);
|
|
774
|
-
} else if (/^don'?t:?$/i.test(subName)) {
|
|
775
|
-
donts.push(...bullets);
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
// Classify by bullet prefix as a backup (catches loose bullets outside H3 wrappers)
|
|
780
|
-
for (const b of collectBullets(section.lines)) {
|
|
781
|
-
const stripped = normalizeApostrophes(stripBold(b).trim());
|
|
782
|
-
if (/^don'?t\b/i.test(stripped)) {
|
|
783
|
-
if (!donts.some((d) => normalizeApostrophes(d) === stripped)) donts.push(stripped);
|
|
784
|
-
} else if (/^do\b/i.test(stripped)) {
|
|
785
|
-
if (!dos.some((d) => normalizeApostrophes(d) === stripped)) dos.push(stripped);
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
return { dos, donts };
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
// ---------- Coverage assessment ----------
|
|
793
|
-
|
|
794
|
-
// Sections whose model is description-plus-rules only (see extractGuidance).
|
|
795
|
-
const guidanceCoverage = (guidance) =>
|
|
796
|
-
guidance
|
|
797
|
-
? {
|
|
798
|
-
description: Boolean(guidance.description),
|
|
799
|
-
rules: guidance.rules.length,
|
|
800
|
-
}
|
|
801
|
-
: 'missing';
|
|
802
|
-
|
|
803
|
-
function assessCoverage(model) {
|
|
804
|
-
const report = {};
|
|
805
|
-
|
|
806
|
-
report.overview = model.overview
|
|
807
|
-
? {
|
|
808
|
-
northStar: Boolean(model.overview.creativeNorthStar),
|
|
809
|
-
philosophy: model.overview.philosophy.length > 0,
|
|
810
|
-
keyCharacteristics: model.overview.keyCharacteristics.length,
|
|
811
|
-
}
|
|
812
|
-
: 'missing';
|
|
813
|
-
|
|
814
|
-
report.colors = model.colors
|
|
815
|
-
? {
|
|
816
|
-
groups: model.colors.groups.length,
|
|
817
|
-
totalColors: model.colors.groups.reduce((n, g) => n + g.colors.length, 0),
|
|
818
|
-
rules: model.colors.rules.length,
|
|
819
|
-
}
|
|
820
|
-
: 'missing';
|
|
821
|
-
|
|
822
|
-
report.typography = model.typography
|
|
823
|
-
? {
|
|
824
|
-
fonts: Object.keys(model.typography.fonts).length,
|
|
825
|
-
hierarchyEntries: model.typography.hierarchy.length,
|
|
826
|
-
character: Boolean(model.typography.character),
|
|
827
|
-
rules: model.typography.rules.length,
|
|
828
|
-
}
|
|
829
|
-
: 'missing';
|
|
830
|
-
|
|
831
|
-
report.layout = guidanceCoverage(model.layout);
|
|
832
|
-
|
|
833
|
-
report.elevation = model.elevation
|
|
834
|
-
? {
|
|
835
|
-
shadows: model.elevation.shadows.length,
|
|
836
|
-
rules: model.elevation.rules.length,
|
|
837
|
-
description: Boolean(model.elevation.description),
|
|
838
|
-
}
|
|
839
|
-
: 'missing';
|
|
840
|
-
|
|
841
|
-
report.shapes = guidanceCoverage(model.shapes);
|
|
842
|
-
|
|
843
|
-
report.components = model.components
|
|
844
|
-
? {
|
|
845
|
-
count: model.components.components.length,
|
|
846
|
-
variantTotal: model.components.components.reduce((n, c) => n + c.variants.length, 0),
|
|
847
|
-
}
|
|
848
|
-
: 'missing';
|
|
849
|
-
|
|
850
|
-
report.dosDonts = model.dosDonts
|
|
851
|
-
? {
|
|
852
|
-
dos: model.dosDonts.dos.length,
|
|
853
|
-
donts: model.dosDonts.donts.length,
|
|
854
|
-
}
|
|
855
|
-
: 'missing';
|
|
856
|
-
|
|
857
|
-
return report;
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
// ---------- Main ----------
|
|
861
|
-
|
|
862
|
-
export function parseDesignMd(md) {
|
|
863
|
-
const { frontmatter, body } = parseFrontmatter(md);
|
|
864
|
-
const { title, sections } = splitSections(body);
|
|
865
|
-
return {
|
|
866
|
-
schemaVersion: 2,
|
|
867
|
-
title,
|
|
868
|
-
frontmatter,
|
|
869
|
-
overview: extractOverview(sections['Overview']),
|
|
870
|
-
colors: extractColors(sections['Colors']),
|
|
871
|
-
typography: extractTypography(sections['Typography']),
|
|
872
|
-
layout: extractGuidance(sections['Layout']),
|
|
873
|
-
elevation: extractElevation(sections['Elevation']),
|
|
874
|
-
shapes: extractGuidance(sections['Shapes']),
|
|
875
|
-
components: extractComponents(sections['Components']),
|
|
876
|
-
dosDonts: extractDosDonts(sections["Do's and Don'ts"]),
|
|
877
|
-
};
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
export { assessCoverage };
|