@thorprovider/storefront 0.4.0-mvp.0 → 0.4.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 +174 -156
- package/VENDOR.md +69 -0
- package/assets/openspec/config.yaml +38 -0
- package/assets/templates/AGENTS.md +76 -0
- package/assets/templates/app/app/[[...slug]]/page.tsx +56 -2
- package/assets/templates/app/app/[[...slug]]/renderer.tsx +44 -2
- package/assets/templates/app/app/globals.css +5 -8
- package/assets/templates/app/app/layout.tsx +1 -5
- package/assets/templates/app/app/robots.ts +9 -3
- package/assets/templates/app/app/sitemap.ts +64 -5
- package/assets/templates/app/lib/__STOREFRONT__/account-boundary.client.tsx +76 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-lifecycle.client.tsx +461 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-mutation.client.ts +46 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-private.core.ts +103 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-reconcile.client.ts +465 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-session.core.ts +177 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-session.ts +44 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-user.core.ts +65 -0
- package/assets/templates/app/lib/__STOREFRONT__/actions.ts +135 -16
- package/assets/templates/app/lib/__STOREFRONT__/catalog.ts +19 -9
- package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +61 -0
- package/assets/templates/app/lib/__STOREFRONT__/composition.ts +26 -0
- package/assets/templates/app/lib/__STOREFRONT__/handlers.core.ts +36 -4
- package/assets/templates/app/lib/__STOREFRONT__/mappers.ts +17 -18
- package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.client.tsx +209 -0
- package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.ts +247 -0
- package/assets/templates/app/lib/__STOREFRONT__/registry.tsx +123 -62
- package/assets/templates/app/lib/__STOREFRONT__/runtime.ts +3 -0
- package/assets/templates/app/lib/__STOREFRONT__/schema.ts +78 -25
- package/assets/templates/app/lib/__STOREFRONT__/section-observation.ts +182 -0
- package/assets/templates/app/lib/__STOREFRONT__/section-sources.ts +128 -0
- package/assets/templates/app/lib/__STOREFRONT__/shell/content.ts +31 -7
- package/assets/templates/app/lib/__STOREFRONT__/shell/props.ts +4 -0
- package/assets/templates/app/lib/__STOREFRONT__/spec/index.ts +81 -26
- package/assets/templates/app/lib/__STOREFRONT__/spec/seo.ts +165 -0
- package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +4 -2
- package/assets/templates/app/lib/__STOREFRONT__/store-context.ts +26 -7
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/cta.client.tsx +1 -1
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/faq.client.tsx +1 -1
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/index.ts +2 -1
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/logoCloud.tsx +1 -1
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/pricing.tsx +1 -1
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/products.client.tsx +100 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/products.tsx +19 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.products.ts +39 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/statistics.tsx +1 -1
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/testimonials.tsx +1 -1
- package/assets/templates/features/checkout/handlers.ts +6 -0
- package/assets/templates/features/customer-auth/handlers.ts +19 -23
- package/assets/templates/features/customer-auth/state.ts +31 -1
- package/assets/templates/views/account/index.tsx +20 -8
- package/assets/templates/views/account/registry.tsx +294 -154
- package/assets/templates/views/account/schema.ts +1 -0
- package/assets/templates/views/cart/content.ts +11 -0
- package/assets/templates/views/cart/data.ts +23 -0
- package/assets/templates/views/cart/index.tsx +53 -0
- package/assets/templates/views/cart/props.ts +12 -0
- package/assets/templates/views/cart/registry.tsx +82 -0
- package/assets/templates/views/cart/schema.ts +52 -0
- package/assets/templates/views/category/assembly/assembly.json +2 -1
- package/assets/templates/views/category/assembly/index.skeleton.tsx +64 -6
- package/assets/templates/views/category/assembly/registry.skeleton.tsx +7 -6
- package/assets/templates/views/category/assembly/slots/breadcrumb/Breadcrumb/binding.json +5 -0
- package/assets/templates/views/category/assembly/slots/breadcrumb/Breadcrumb/catalog.part +4 -0
- package/assets/templates/views/category/assembly/slots/breadcrumb/Breadcrumb/element.part +7 -0
- package/assets/templates/views/category/assembly/slots/breadcrumb/Breadcrumb/registry.part +18 -0
- package/assets/templates/views/category/index.tsx +76 -7
- package/assets/templates/views/category/props.ts +7 -0
- package/assets/templates/views/category/registry.tsx +25 -6
- package/assets/templates/views/category/schema.ts +13 -0
- package/assets/templates/views/checkout/registry.tsx +3 -5
- package/assets/templates/views/home/assembly/assembly.json +12 -3
- package/assets/templates/views/home/assembly/index.skeleton.tsx +24 -5
- package/assets/templates/views/home/assembly/registry.skeleton.tsx +4 -1
- package/assets/templates/views/home/assembly/slots/benefits/cards/binding.json +5 -0
- package/assets/templates/views/home/assembly/slots/benefits/cards/registry.part +17 -0
- package/assets/templates/views/home/assembly/slots/benefits/split/binding.json +5 -0
- package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → split}/registry.part +6 -2
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/binding.json +5 -0
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/catalog.part +8 -0
- package/assets/templates/views/home/assembly/slots/categories/{ProductCategory2 → CategoryGrid}/element.part +1 -1
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/registry.part +31 -0
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/binding.json +5 -0
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/catalog.part +4 -0
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/element.part +5 -0
- package/assets/templates/views/home/assembly/slots/hero/{StorefrontHero1 → StorefrontHero}/registry.part +5 -3
- package/assets/templates/views/home/content.ts +22 -0
- package/assets/templates/views/home/data.ts +9 -0
- package/assets/templates/views/home/index.tsx +34 -11
- package/assets/templates/views/home/props.ts +1 -0
- package/assets/templates/views/home/registry.tsx +41 -17
- package/assets/templates/views/home/schema.ts +141 -24
- package/assets/templates/views/product/data.ts +5 -3
- package/assets/templates/views/product/index.tsx +49 -5
- package/assets/templates/views/product/props.ts +7 -0
- package/assets/templates/views/product/registry.tsx +34 -5
- package/assets/templates/views/product/schema.ts +49 -1
- package/assets/templates/views/static/content.ts +4 -4
- package/assets/templates/views/static/index.tsx +1 -1
- package/bin/storefront.js +1231 -154
- package/examples/merchandising/category-led.json +37 -0
- package/examples/merchandising/collection-led.json +37 -0
- package/package.json +10 -7
- package/recipes/archetypes.json +33 -46
- package/recipes/catalog.json +245 -153
- package/recipes/catalog.mjs +10 -0
- package/recipes/catalog.schema.json +4 -0
- package/recipes/features.json +28 -5
- package/recipes/recipe.schema.json +1 -1
- package/recipes/recipes.json +159 -59
- package/recipes/sections.json +10 -0
- package/recipes/validate.mjs +75 -4
- package/scripts/candidate.mjs +4 -4
- package/scripts/composers.mjs +25 -5
- package/scripts/env-file.mjs +86 -0
- package/scripts/file-classes.mjs +15 -0
- package/scripts/migrate-english-routes.mjs +276 -0
- package/scripts/ownership-conflict.mjs +5 -2
- package/scripts/pinning.mjs +74 -5
- package/scripts/plan-apply.mjs +149 -5
- package/scripts/reconcile.mjs +49 -11
- package/scripts/render-templates.mjs +97 -44
- package/scripts/section-config.mjs +253 -0
- package/scripts/starter.mjs +17 -0
- package/scripts/theme/color.mjs +185 -0
- package/scripts/theme/css-theme.mjs +233 -0
- package/scripts/theme/fonts.mjs +123 -0
- package/scripts/theme/import-export.mjs +125 -0
- package/scripts/theme/preset.mjs +93 -0
- package/scripts/theme/theme-plan.mjs +292 -0
- package/scripts/theme/tokens.mjs +137 -0
- package/scripts/view-assembly.mjs +57 -3
- package/scripts/view-selection.mjs +1 -1
- package/skills/sf-feature/SKILL.md +32 -19
- package/skills/sf-setup/SKILL.md +79 -0
- package/skills/sf-theme-gen/SKILL.md +99 -36
- package/skills/sf-theme-gen/references/shadcn-theming.md +87 -0
- package/skills/{shadcn-theming/references/templates → sf-theme-gen/references}/theme-setup.md +15 -19
- package/skills/{shadcn-theming → sf-theme-gen}/references/theming-guide.md +6 -11
- package/skills/sf-view-gen/SKILL.md +63 -40
- package/skills/sf-view-gen/assets/recipes/archetypes.json +33 -46
- package/skills/sf-view-gen/assets/recipes/catalog.json +245 -153
- package/skills/sf-view-gen/assets/recipes/catalog.schema.json +4 -0
- package/skills/sf-view-gen/assets/recipes/features.json +28 -5
- package/skills/sf-view-gen/assets/recipes/recipes.json +159 -59
- package/skills/sf-view-gen/assets/recipes/sections.json +10 -0
- package/skills/sf-view-gen/assets/templates/views/sections/cta.client.tsx +1 -1
- package/skills/sf-view-gen/assets/templates/views/sections/faq.client.tsx +1 -1
- package/skills/sf-view-gen/assets/templates/views/sections/logoCloud.client.tsx +1 -1
- package/skills/sf-view-gen/assets/templates/views/sections/pricing.client.tsx +1 -1
- package/skills/sf-view-gen/assets/templates/views/sections/products.client.tsx +100 -0
- package/skills/sf-view-gen/assets/templates/views/sections/products.tsx +19 -0
- package/skills/sf-view-gen/assets/templates/views/sections/schema.products.ts +39 -0
- package/skills/sf-view-gen/assets/templates/views/sections/statistics.client.tsx +1 -1
- package/skills/sf-view-gen/assets/templates/views/sections/testimonials.client.tsx +1 -1
- package/skills/{json-render-core/SKILL.md → sf-view-gen/references/json-render-core.md} +4 -27
- package/skills/{json-render-next/SKILL.md → sf-view-gen/references/json-render-next.md} +5 -8
- package/skills/{json-render-react/SKILL.md → sf-view-gen/references/json-render-react.md} +3 -5
- package/skills/{json-render-shadcn/SKILL.md → sf-view-gen/references/json-render-shadcn.md} +3 -5
- package/skills/sf-view-gen/references/views.md +28 -37
- package/skills/sf-view-gen/scripts/catalog.mjs +10 -0
- package/skills/sf-view-gen/scripts/validate.mjs +75 -4
- package/skills/storefront-workflow/SKILL.md +94 -31
- package/skills/{storefront-best-practices/reference/design.md → storefront-workflow/references/design-consistency.md} +13 -29
- package/CHANGELOG.md +0 -84
- package/assets/templates/views/home/assembly/slots/benefits/Feature1/binding.json +0 -5
- package/assets/templates/views/home/assembly/slots/benefits/Feature2/binding.json +0 -5
- package/assets/templates/views/home/assembly/slots/benefits/Feature2/registry.part +0 -10
- package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/binding.json +0 -5
- package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/catalog.part +0 -4
- package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/registry.part +0 -16
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/binding.json +0 -5
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/catalog.part +0 -4
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/element.part +0 -5
- package/assets/templates/views/user-panel/index.tsx +0 -106
- package/assets/templates/views/user-panel/registry.tsx +0 -54
- package/assets/templates/views/user-panel/schema.ts +0 -79
- package/commands/sf-add-view.md +0 -57
- package/commands/sf-feature.md +0 -28
- package/commands/sf-theme.md +0 -26
- package/commands/sf-view.md +0 -67
- package/skills/building-storefronts/SKILL.md +0 -178
- package/skills/building-storefronts/references/frontend-integration.md +0 -229
- package/skills/json-render-remotion/SKILL.md +0 -111
- package/skills/json-render-solid/SKILL.md +0 -204
- package/skills/nextjs-shadcn/SKILL.md +0 -367
- package/skills/nextjs-shadcn/references/architecture.md +0 -499
- package/skills/nextjs-shadcn/references/project-setup.md +0 -162
- package/skills/nextjs-shadcn/references/shadcn-platform.md +0 -261
- package/skills/nextjs-shadcn/references/sidebar.md +0 -274
- package/skills/nextjs-shadcn/references/styling.md +0 -555
- package/skills/shadcn-component-discovery/SKILL.md +0 -273
- package/skills/shadcn-component-discovery/references/registries.md +0 -226
- package/skills/shadcn-theming/SKILL.md +0 -104
- package/skills/storefront-best-practices/SKILL.md +0 -421
- package/skills/storefront-best-practices/reference/components/breadcrumbs.md +0 -123
- package/skills/storefront-best-practices/reference/components/cart-popup.md +0 -189
- package/skills/storefront-best-practices/reference/components/country-selector.md +0 -298
- package/skills/storefront-best-practices/reference/components/footer.md +0 -112
- package/skills/storefront-best-practices/reference/components/hero.md +0 -241
- package/skills/storefront-best-practices/reference/components/megamenu.md +0 -239
- package/skills/storefront-best-practices/reference/components/navbar.md +0 -397
- package/skills/storefront-best-practices/reference/components/popups.md +0 -221
- package/skills/storefront-best-practices/reference/components/product-card.md +0 -125
- package/skills/storefront-best-practices/reference/components/product-reviews.md +0 -217
- package/skills/storefront-best-practices/reference/components/product-slider.md +0 -174
- package/skills/storefront-best-practices/reference/components/search.md +0 -101
- package/skills/storefront-best-practices/reference/connecting-to-backend.md +0 -391
- package/skills/storefront-best-practices/reference/features/promotions.md +0 -307
- package/skills/storefront-best-practices/reference/features/wishlist.md +0 -230
- package/skills/storefront-best-practices/reference/layouts/account.md +0 -380
- package/skills/storefront-best-practices/reference/layouts/cart.md +0 -316
- package/skills/storefront-best-practices/reference/layouts/checkout.md +0 -486
- package/skills/storefront-best-practices/reference/layouts/home-page.md +0 -264
- package/skills/storefront-best-practices/reference/layouts/order-confirmation.md +0 -231
- package/skills/storefront-best-practices/reference/layouts/product-details.md +0 -527
- package/skills/storefront-best-practices/reference/layouts/product-listing.md +0 -520
- package/skills/storefront-best-practices/reference/layouts/static-pages.md +0 -356
- package/skills/storefront-best-practices/reference/medusa.md +0 -307
- /package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/catalog.part +0 -0
- /package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/element.part +0 -0
- /package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/catalog.part +0 -0
- /package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/element.part +0 -0
- /package/skills/{storefront-best-practices/reference → storefront-workflow/references}/mobile-responsiveness.md +0 -0
- /package/skills/{storefront-best-practices/reference → storefront-workflow/references}/seo.md +0 -0
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
# View
|
|
1
|
+
# View modules reference
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
Reference material for the `sf-view-gen` skill. Each view is a self-contained
|
|
4
|
+
module the CLI generates into `lib/<name>/views/<view>/`. The CLI — not the
|
|
5
|
+
agent — writes the barrel and every derived file; `npx @thorprovider/storefront
|
|
6
|
+
view add <view>` generates one view's derived files and reconciles the barrel.
|
|
7
|
+
|
|
8
|
+
The available views are whatever `npx @thorprovider/storefront views --json`
|
|
9
|
+
reports; this file names none of them as the authoritative set.
|
|
7
10
|
|
|
8
11
|
## Module shape
|
|
9
12
|
|
|
@@ -11,7 +14,7 @@ Each view is the **three-file split** (RSC):
|
|
|
11
14
|
|
|
12
15
|
- `views/<view>/index.tsx` — pure Server Component module: name, elements,
|
|
13
16
|
zod catalog, route, loader. Never imports values from `@json-render/react`
|
|
14
|
-
or `@thorprovider/blocks`.
|
|
17
|
+
or `@thorprovider/blocks`. **Derived — the CLI writes it; never hand-edit it.**
|
|
15
18
|
- `views/<view>/schema.ts` — pure Zod schemas mirroring the block contracts
|
|
16
19
|
the view renders (props only). No React, no `'use client'`, no Next imports.
|
|
17
20
|
- `views/<view>/registry.tsx` — `'use client'`: exports
|
|
@@ -50,25 +53,14 @@ not hand-edit them; add or remove a view with
|
|
|
50
53
|
and one entry per installed view, so a view removed from the manifest cannot
|
|
51
54
|
reappear through folder scanning.
|
|
52
55
|
|
|
53
|
-
##
|
|
54
|
-
|
|
55
|
-
Every slot imports its block variant under a **stable alias** and ships the
|
|
56
|
-
recipe's default variant:
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
import { ProductOverview1 as ProductOverviewBlock } from '@thorprovider/blocks'
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
To apply a different (recipe-allowed) variant, replace **only the imported
|
|
63
|
-
identifier** — never the alias, never the props:
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
import { ProductOverview5 as ProductOverviewBlock } from '@thorprovider/blocks'
|
|
67
|
-
```
|
|
56
|
+
## Variants
|
|
68
57
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
58
|
+
A slot's variant is a presentation choice recorded in the manifest and applied by
|
|
59
|
+
the reconciler. Change it through the CLI — `view add`/`remove` with
|
|
60
|
+
`--variant slot=Name` (a supported variant the registry reports), or a
|
|
61
|
+
`section.add` / `section.reorder` operation for editorial sections. Do not
|
|
62
|
+
hand-edit a derived `index.tsx` or registry to swap an imported identifier; the
|
|
63
|
+
next `sync` would overwrite it and the manifest would disagree with the files.
|
|
72
64
|
|
|
73
65
|
## Data contracts and icons
|
|
74
66
|
|
|
@@ -76,21 +68,20 @@ Two rules that keep generated views from crashing at render time:
|
|
|
76
68
|
|
|
77
69
|
1. **Mappers are applied at loaders, never in registries.** Adapter canon does
|
|
78
70
|
not match block props 1:1 (e.g. a category may carry `productCount?: number`
|
|
79
|
-
or no count at all, and
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
which would render a false "0 items". A genuine `0` from a richer source is
|
|
71
|
+
or no count at all, and some count props are optional). The view's loader maps
|
|
72
|
+
adapter data through `lib/<name>/mappers.ts` before it reaches state.
|
|
73
|
+
Registries receive already-mapped, block-shaped props. When a value is unknown
|
|
74
|
+
(e.g. no category count), **omit** it — never fabricate a `0` default, which
|
|
75
|
+
would render a false "0 items". A genuine `0` from a richer source is
|
|
85
76
|
preserved.
|
|
86
77
|
|
|
87
|
-
2. **Icons cross registries as components, via `icon-map`.** Several blocks
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
78
|
+
2. **Icons cross registries as components, via `icon-map`.** Several blocks type
|
|
79
|
+
icon props as `LucideIcon` (a component). A string like `'truck'` bound
|
|
80
|
+
directly renders a literal `<truck>` tag in the DOM. Registries resolve icon
|
|
81
|
+
names through `lib/<name>/icon-map.ts` (`resolveIcon(name)`, kebab-case →
|
|
82
|
+
`LucideIcon`, neutral `Circle` fallback). When adding a view that uses a new
|
|
83
|
+
icon, extend `icon-map.ts` with an entry — never inline a string where a
|
|
84
|
+
component is expected.
|
|
94
85
|
|
|
95
86
|
Supporting rules for the same goal:
|
|
96
87
|
|
|
@@ -100,6 +100,16 @@ export function validateCatalog(catalog) {
|
|
|
100
100
|
if (typeof slot.default === 'string' && !hasOwn(variants, slot.default)) {
|
|
101
101
|
errors.push(`Slot "${slotId}" default "${slot.default}" is not a declared variant.`)
|
|
102
102
|
}
|
|
103
|
+
// A legacy alias must land on a declared variant of the same slot: an alias
|
|
104
|
+
// pointing outside the variant set would resolve selections to nothing.
|
|
105
|
+
const aliases = isPlainObject(slot.legacyAliases) ? slot.legacyAliases : {}
|
|
106
|
+
for (const [alias, target] of Object.entries(aliases)) {
|
|
107
|
+
if (!hasOwn(variants, target)) {
|
|
108
|
+
errors.push(
|
|
109
|
+
`Slot "${slotId}" legacy alias "${alias}" maps to "${target}", which is not a declared variant.`
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
103
113
|
for (const [variantName, entry] of Object.entries(variants)) {
|
|
104
114
|
if (!isPlainObject(entry)) continue
|
|
105
115
|
if (entry.status === 'held' && !(typeof entry.reason === 'string' && entry.reason.length > 0)) {
|
|
@@ -455,6 +455,27 @@ export function sectionRegistry() {
|
|
|
455
455
|
}))
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
+
/**
|
|
459
|
+
* The full registry entry for a section type, or null when it is not
|
|
460
|
+
* registered. Unlike `sectionRegistry()` (the projected introspection view),
|
|
461
|
+
* this exposes every declared field — including `dataBound` and `variants` —
|
|
462
|
+
* so the CLI can tell which instances need user-owned source configuration.
|
|
463
|
+
*/
|
|
464
|
+
export function sectionDefinitionByName(name) {
|
|
465
|
+
const list = Array.isArray(sections.sections) ? sections.sections : []
|
|
466
|
+
return list.find((entry) => isPlainObject(entry) && entry.name === name) ?? null
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Whether a section type resolves its content from a data source configured by
|
|
471
|
+
* the user (for example the `products` type) rather than from static editorial
|
|
472
|
+
* content. Unregistered types are not data-bound.
|
|
473
|
+
*/
|
|
474
|
+
export function sectionIsDataBound(name) {
|
|
475
|
+
const section = sectionDefinitionByName(name)
|
|
476
|
+
return section?.status === 'executable' && section.dataBound === true
|
|
477
|
+
}
|
|
478
|
+
|
|
458
479
|
export function getRecipe(name) {
|
|
459
480
|
return recipes.views.find((v) => v.name === name) ?? null
|
|
460
481
|
}
|
|
@@ -485,6 +506,39 @@ export function isCuratedFeature(name) {
|
|
|
485
506
|
return getFeature(name)?.mvp === true
|
|
486
507
|
}
|
|
487
508
|
|
|
509
|
+
/**
|
|
510
|
+
* The starter composition: every curated (installable) feature plus every
|
|
511
|
+
* curated view no installed curated feature owns. A feature-owned view (for
|
|
512
|
+
* example `checkout`, owned by the `checkout` feature) is installed through its
|
|
513
|
+
* feature, not listed directly. The set is derived from the registry's
|
|
514
|
+
* `mvp: true` declaration — never a hand-maintained list — so a curated unit
|
|
515
|
+
* added or removed flows automatically and a held unit (`recommendations`, a
|
|
516
|
+
* held section) is excluded by construction.
|
|
517
|
+
*
|
|
518
|
+
* `registries` is the injection seam for tests: pass fixture `{ views }` /
|
|
519
|
+
* `{ features }` sources to exercise the derivation without mutating the loaded
|
|
520
|
+
* registry.
|
|
521
|
+
*/
|
|
522
|
+
export function starterComposition(registries = {}) {
|
|
523
|
+
const recipeSource = registries.recipes ?? recipes
|
|
524
|
+
const featureSource = registries.features ?? features
|
|
525
|
+
const featureNames = featureSource.features
|
|
526
|
+
.filter((f) => f.mvp === true)
|
|
527
|
+
.map((f) => f.name)
|
|
528
|
+
const ownedViews = new Set()
|
|
529
|
+
for (const name of featureNames) {
|
|
530
|
+
const feature = featureSource.features.find((f) => f.name === name)
|
|
531
|
+
for (const view of Array.isArray(feature?.views) ? feature.views : []) {
|
|
532
|
+
ownedViews.add(view)
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
const viewNames = recipeSource.views
|
|
536
|
+
.filter((v) => v.mvp === true)
|
|
537
|
+
.map((v) => v.name)
|
|
538
|
+
.filter((name) => !ownedViews.has(name))
|
|
539
|
+
return { views: viewNames, features: featureNames }
|
|
540
|
+
}
|
|
541
|
+
|
|
488
542
|
/**
|
|
489
543
|
* The catalog entry for one slot ("<view>.<slot>"), or null when the slot is
|
|
490
544
|
* outside the catalog scope (a held, non-curated view). The catalog is the
|
|
@@ -496,15 +550,30 @@ export function getCatalogSlot(viewName, slot) {
|
|
|
496
550
|
return hasOwn(slots, key) ? slots[key] : null
|
|
497
551
|
}
|
|
498
552
|
|
|
553
|
+
/**
|
|
554
|
+
* The legacy alias target for a slot variant name, or the input unchanged when
|
|
555
|
+
* it is not an alias. The canonical selection surface is the catalog's variant
|
|
556
|
+
* set (the canonical block's presentations); retired numbered names survive
|
|
557
|
+
* only as slot-level `legacyAliases` and resolve here, at the single catalog
|
|
558
|
+
* authority, before any validation or fragment lookup.
|
|
559
|
+
*/
|
|
560
|
+
export function resolveLegacyVariant(viewName, slot, variant) {
|
|
561
|
+
const slotEntry = getCatalogSlot(viewName, slot)
|
|
562
|
+
const aliases = isPlainObject(slotEntry?.legacyAliases) ? slotEntry.legacyAliases : {}
|
|
563
|
+
return hasOwn(aliases, variant) ? aliases[variant] : variant
|
|
564
|
+
}
|
|
565
|
+
|
|
499
566
|
/**
|
|
500
567
|
* The catalog entry for one variant of a slot, or null when the slot or the
|
|
501
568
|
* variant is outside the catalog scope. Used to name a held variant's reason at
|
|
502
|
-
* the point a selection is rejected (E1 task 1.4 / CU-07).
|
|
569
|
+
* the point a selection is rejected (E1 task 1.4 / CU-07). Legacy alias names
|
|
570
|
+
* resolve to their canonical variant's entry.
|
|
503
571
|
*/
|
|
504
572
|
export function getCatalogVariant(viewName, slot, variant) {
|
|
505
573
|
const slotEntry = getCatalogSlot(viewName, slot)
|
|
506
574
|
const variants = isPlainObject(slotEntry?.variants) ? slotEntry.variants : {}
|
|
507
|
-
|
|
575
|
+
const canonical = resolveLegacyVariant(viewName, slot, variant)
|
|
576
|
+
return hasOwn(variants, canonical) ? variants[canonical] : null
|
|
508
577
|
}
|
|
509
578
|
|
|
510
579
|
/**
|
|
@@ -576,7 +645,7 @@ export function supportedVariant(viewName, slot) {
|
|
|
576
645
|
}
|
|
577
646
|
|
|
578
647
|
export function isSupportedVariant(viewName, slot, variant) {
|
|
579
|
-
return executableVariants(viewName, slot).includes(variant)
|
|
648
|
+
return executableVariants(viewName, slot).includes(resolveLegacyVariant(viewName, slot, variant))
|
|
580
649
|
}
|
|
581
650
|
|
|
582
651
|
/**
|
|
@@ -608,7 +677,9 @@ export function isAllowedVariant(viewName, slot, variant) {
|
|
|
608
677
|
const allowedBySlot = isPlainObject(recipe.allowedVariants) ? recipe.allowedVariants : {}
|
|
609
678
|
if (!hasOwn(allowedBySlot, slot)) return false
|
|
610
679
|
const allowed = allowedBySlot[slot]
|
|
611
|
-
return
|
|
680
|
+
return (
|
|
681
|
+
Array.isArray(allowed) && allowed.includes(resolveLegacyVariant(viewName, slot, variant))
|
|
682
|
+
)
|
|
612
683
|
}
|
|
613
684
|
|
|
614
685
|
export function isAllowedSection(viewName, sectionName) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: storefront-workflow
|
|
3
|
-
description: The Thor Commerce storefront workflow model — bootstrap, compose, customize, verify — and the CLI/manifest authority.
|
|
3
|
+
description: The Thor Commerce storefront workflow model — bootstrap, compose, customize, verify — and the CLI/manifest authority. Use when working in a generated storefront, before adding/removing views or features, changing the theme, or editing storefront files.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Storefront workflow model
|
|
@@ -8,7 +8,8 @@ description: The Thor Commerce storefront workflow model — bootstrap, compose,
|
|
|
8
8
|
A generated storefront is defined by a **manifest** (`storefront.config.json` at
|
|
9
9
|
the project root) and produced by the `storefront` CLI. The manifest is the
|
|
10
10
|
structural source of truth; the CLI is the only writer of derived files; the
|
|
11
|
-
developer (or agent) edits only user-owned files
|
|
11
|
+
developer (or agent) edits only user-owned files and the bounded surface of the
|
|
12
|
+
two external files.
|
|
12
13
|
|
|
13
14
|
Run every command from inside the project (the CLI resolves the project from the
|
|
14
15
|
current directory). The CLI is installed as a dependency of the project, so
|
|
@@ -24,9 +25,12 @@ Create the project. The CLI scaffolds Next.js, installs the pinned candidate
|
|
|
24
25
|
toolset, writes the initial manifest, and reconciles.
|
|
25
26
|
|
|
26
27
|
```bash
|
|
27
|
-
npx @thorprovider/storefront create <dir> --name <name> --preset <preset>
|
|
28
|
+
npx @thorprovider/storefront create <dir> --name <name> --preset <preset> [--starter]
|
|
28
29
|
```
|
|
29
30
|
|
|
31
|
+
Pass `--starter` to seed the full curated composition — every curated view and
|
|
32
|
+
feature — in the same pass; omit it for the minimal baseline.
|
|
33
|
+
|
|
30
34
|
Authority: **CLI only.** Do not scaffold or copy templates by hand.
|
|
31
35
|
|
|
32
36
|
### 2. Compose
|
|
@@ -42,26 +46,45 @@ npx @thorprovider/storefront plan --operations <file> [--out <file>] [--json]
|
|
|
42
46
|
npx @thorprovider/storefront apply --plan <file> [--json]
|
|
43
47
|
```
|
|
44
48
|
|
|
45
|
-
Section composition (`section.add` / `section.remove` / `section.reorder`
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
Section composition (`section.add` / `section.remove` / `section.reorder`) goes
|
|
50
|
+
through the same operations envelope (`{ "formatVersion": 1, "operations": [ ... ] }`):
|
|
51
|
+
`plan` is read-only and validates the whole intended state, `apply --plan` is the
|
|
52
|
+
only writer.
|
|
49
53
|
|
|
50
|
-
Authority: **CLI only.** Agents choose *what* to compose by reading
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
`sectionTypes` list — and then delegate the write to the CLI. The user states the
|
|
54
|
-
change in natural language and never types a command. Held section types
|
|
55
|
-
(`testimonials`, `statistics`, `logoCloud`, `pricing`) are refused with a bounded
|
|
56
|
-
reason; only the executable types (`faq`, `cta`) may be composed.
|
|
54
|
+
Authority: **CLI only.** Agents choose *what* to compose by reading the curated
|
|
55
|
+
registry at runtime and then delegate the write to the CLI. The user states the
|
|
56
|
+
change in natural language and never types a command.
|
|
57
57
|
|
|
58
58
|
### 3. Customize
|
|
59
59
|
|
|
60
|
-
Edit the **user-owned** files (content, props, data, local schema, mappers)
|
|
61
|
-
|
|
62
|
-
them
|
|
60
|
+
Edit the **user-owned** files (content, props, data, local schema, mappers), and —
|
|
61
|
+
within narrow bounds — the two **external** files described below. Reconcile never
|
|
62
|
+
rewrites user-owned files; it regenerates the thin derived wrappers around them,
|
|
63
|
+
and appends CLI-managed markers to the external files idempotently.
|
|
64
|
+
|
|
65
|
+
Authority: **agent/developer.** Hand-edit only user-owned files and the bounded
|
|
66
|
+
external surface.
|
|
67
|
+
|
|
68
|
+
#### Trivial vs non-trivial — and the spec-driven loop
|
|
63
69
|
|
|
64
|
-
|
|
70
|
+
Classify the customization before editing:
|
|
71
|
+
|
|
72
|
+
- **Trivial** — the CLI can perform it deterministically and record it in the
|
|
73
|
+
manifest (`storefront theme --mode`, `view add|remove`, `feature add|remove`,
|
|
74
|
+
`setup`). Run the CLI operation; it **does not** require an OpenSpec change —
|
|
75
|
+
`storefront.config.json` is its record.
|
|
76
|
+
- **Non-trivial** — the change needs judgment: content authoring, prop/data
|
|
77
|
+
mapping, composition reshaping, or a cross-file redesign whose acceptance is not
|
|
78
|
+
a CLI assertion. Drive it through the **spec-driven loop** and surface the five
|
|
79
|
+
stages to the user: **explore → plan → build → verify → inform**. Open the change
|
|
80
|
+
through the OpenSpec workflow (`openspec/config.yaml` is seeded with this model),
|
|
81
|
+
carry it to completion, and **never** ask the user to run `openspec`, name an
|
|
82
|
+
artifact, or approve one artifact at a time. Structural edits inside the loop
|
|
83
|
+
still go through the CLI; the loop adds intent and acceptance, not a second
|
|
84
|
+
writer.
|
|
85
|
+
|
|
86
|
+
A non-trivial change is not done until `storefront sync` and `storefront doctor`
|
|
87
|
+
pass and the change's acceptance is met.
|
|
65
88
|
|
|
66
89
|
### 4. Verify
|
|
67
90
|
|
|
@@ -75,17 +98,58 @@ npx @thorprovider/storefront doctor # composition drift + truthful version/BOM
|
|
|
75
98
|
Authority: **CLI.** A build (`yarn build`) is the final acceptance; `doctor`
|
|
76
99
|
must report no drift.
|
|
77
100
|
|
|
101
|
+
## Read the curated registry through the CLI (never a copied list)
|
|
102
|
+
|
|
103
|
+
The installable set is whatever the registry reports; do not trust a list copied
|
|
104
|
+
into any skill. Read it at runtime, from the project root:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
npx @thorprovider/storefront views --json # curated views, routes, intents/variants, installed
|
|
108
|
+
npx @thorprovider/storefront features --json # feature bundles, owned views/routes, mounts
|
|
109
|
+
npx @thorprovider/storefront recipes --json # whole curated registry (views + features)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
- `views --json` and `recipes --json` include the top-level `sectionTypes` list
|
|
113
|
+
that marks each section type `executable` or `held` (with a reason). That list
|
|
114
|
+
is the authority for which section types may be composed.
|
|
115
|
+
- `npx @thorprovider/storefront sections --json` reports only the currently
|
|
116
|
+
**installed** section instances; use it when the current composition matters,
|
|
117
|
+
never as the set of available types.
|
|
118
|
+
- Publishing a fixed view/feature/section list in a skill is a bug: the registry
|
|
119
|
+
is the single source, so add or remove a unit there, not in this text.
|
|
120
|
+
|
|
121
|
+
A unit the registry does not expose is a **gap to report**, not a reason to
|
|
122
|
+
install another UI framework, hand-edit a derived file, or scaffold structure
|
|
123
|
+
outside the CLI.
|
|
124
|
+
|
|
78
125
|
## File ownership
|
|
79
126
|
|
|
80
127
|
| Class | Examples | Who writes it |
|
|
81
128
|
|---|---|---|
|
|
82
129
|
| **Derived** | `views/index.ts`, `views/registry.ts`, `index.tsx`, `registry.tsx`, `catalog.ts`, `runtime.ts`, `spec/index.ts`, `state.ts`, `handlers.ts`, `features/*/adapter.ts` | CLI (reconcile); never hand-edited |
|
|
83
|
-
| **User-owned** | `views/<view>/content.ts`, `props.ts`, `data.ts`, `schema.ts`, `mappers.ts` | developer/agent |
|
|
84
|
-
| **External** | `app/
|
|
130
|
+
| **User-owned** | `views/<view>/content.ts`, `props.ts`, `data.ts`, `schema.ts`, `mappers.ts`, `icon-map.ts`, `shell/**` | developer/agent |
|
|
131
|
+
| **External** | `app/globals.css`, `app/layout.tsx` (plus create-next-app/shadcn support files) | developer/agent within the bounded surface below; the CLI only appends idempotent markers |
|
|
85
132
|
|
|
86
133
|
Removing a unit removes its derived wrapper but **preserves** any customized
|
|
87
134
|
user-owned file and reports its location.
|
|
88
135
|
|
|
136
|
+
## Bounded external customization
|
|
137
|
+
|
|
138
|
+
`app/globals.css` and `app/layout.tsx` are `external` files. The supported
|
|
139
|
+
customization surface is deliberately narrow:
|
|
140
|
+
|
|
141
|
+
- **`app/globals.css`** — theme tokens and their foreground pairs, the Tailwind
|
|
142
|
+
`@theme` bridge, font variable wiring.
|
|
143
|
+
- **`app/layout.tsx`** — font loading (`next/font`) and global identity/metadata
|
|
144
|
+
(title, description, Open Graph / Twitter).
|
|
145
|
+
|
|
146
|
+
Everything else in those files is CLI-managed and must survive: the stylesheet
|
|
147
|
+
import, the provider import and its marker, the theme-mode marker, and the block
|
|
148
|
+
token contract. The CLI appends idempotently, so a `sync` must not duplicate a
|
|
149
|
+
marker or drop an edit. Use the `sf-theme-gen` skill for these files; never edit
|
|
150
|
+
the mode wiring by hand. Per-entity SEO still comes from backend entities — global
|
|
151
|
+
customization cannot invent a canonical.
|
|
152
|
+
|
|
89
153
|
## Manifest authority
|
|
90
154
|
|
|
91
155
|
- `storefront.config.json` declares the name, theme, installed views, installed
|
|
@@ -95,17 +159,7 @@ user-owned file and reports its location.
|
|
|
95
159
|
version, declared compatibility ranges, resolved versions, lockfile hash,
|
|
96
160
|
owned asset BOM). `doctor` validates it against the live project.
|
|
97
161
|
- A **legacy** (pre-manifest) project is detected and refused with a no-write
|
|
98
|
-
diagnostic
|
|
99
|
-
|
|
100
|
-
## Curated MVP defaults
|
|
101
|
-
|
|
102
|
-
- Standalone views: `home`, `category`, `product`.
|
|
103
|
-
- Feature: `checkout` (owns the `checkout` view; `view add checkout` is
|
|
104
|
-
rejected — use `feature add checkout`).
|
|
105
|
-
- Held post-MVP and rejected before writes: `user-panel` and recommendations.
|
|
106
|
-
- Composable sections: `faq` and `cta` are executable per view; held types
|
|
107
|
-
(`testimonials`, `statistics`, `logoCloud`, `pricing`) are refused with a
|
|
108
|
-
bounded reason.
|
|
162
|
+
diagnostic.
|
|
109
163
|
|
|
110
164
|
## Pinning and prerequisites
|
|
111
165
|
|
|
@@ -114,3 +168,12 @@ user-owned file and reports its location.
|
|
|
114
168
|
- The `checkout` feature ships structural wiring only; the purchase flow is
|
|
115
169
|
owned by the separate `single-tenant-commerce-mvp` change. A generated
|
|
116
170
|
storefront is not a complete commerce implementation on its own.
|
|
171
|
+
|
|
172
|
+
## References
|
|
173
|
+
|
|
174
|
+
Relative to this `SKILL.md`:
|
|
175
|
+
|
|
176
|
+
- `references/design-consistency.md` — keeping UI changes consistent with the
|
|
177
|
+
scaffold's brand and tokens.
|
|
178
|
+
- `references/mobile-responsiveness.md` — mobile-first storefront patterns.
|
|
179
|
+
- `references/seo.md` — ecommerce SEO and structured data.
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Design Guidelines
|
|
2
2
|
|
|
3
|
+
Reference material for the `storefront-workflow` skill: guardrails for keeping
|
|
4
|
+
UI changes consistent with an already-scaffolded storefront's brand. The CLI and
|
|
5
|
+
the manifest remain the structural authority; this file only guides visual
|
|
6
|
+
consistency inside the bounded surface (`app/globals.css` tokens, `app/layout.tsx`
|
|
7
|
+
fonts/identity) and `@thorprovider/blocks` usage.
|
|
8
|
+
|
|
3
9
|
## Contents
|
|
4
10
|
|
|
5
11
|
- [Overview](#overview)
|
|
@@ -243,36 +249,14 @@ When starting a new project WITHOUT existing theme:
|
|
|
243
249
|
This helps me understand your aesthetic preferences."
|
|
244
250
|
```
|
|
245
251
|
|
|
246
|
-
###
|
|
247
|
-
|
|
248
|
-
After gathering preferences, configure Tailwind theme:
|
|
249
|
-
|
|
250
|
-
```typescript
|
|
251
|
-
// tailwind.config.ts
|
|
252
|
-
export default {
|
|
253
|
-
theme: {
|
|
254
|
-
extend: {
|
|
255
|
-
colors: {
|
|
256
|
-
primary: '#3B82F6', // User's primary color
|
|
257
|
-
secondary: '#8B5CF6', // User's secondary
|
|
258
|
-
accent: '#F59E0B', // Accent if needed
|
|
259
|
-
// Full scales if sophisticated design
|
|
260
|
-
brand: {
|
|
261
|
-
50: '#eff6ff',
|
|
262
|
-
500: '#3b82f6',
|
|
263
|
-
900: '#1e3a8a',
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
fontFamily: {
|
|
267
|
-
sans: ['Inter', 'system-ui', 'sans-serif'],
|
|
268
|
-
heading: ['Poppins', 'sans-serif'],
|
|
269
|
-
},
|
|
270
|
-
},
|
|
271
|
-
},
|
|
272
|
-
}
|
|
273
|
-
```
|
|
252
|
+
### Where tokens live
|
|
274
253
|
|
|
275
|
-
|
|
254
|
+
The scaffold ships its design tokens as CSS variables in `app/globals.css`
|
|
255
|
+
(`:root` + `.dark`) with a Tailwind v4 `@theme` bridge. That file is `external`
|
|
256
|
+
with a bounded surface: change token values and foreground pairs, fonts, and
|
|
257
|
+
global identity only, and keep the CLI-managed imports/markers intact. Use the
|
|
258
|
+
`sf-theme-gen` skill for color, typography, and identity changes; do not
|
|
259
|
+
introduce a separate Tailwind theme configuration.
|
|
276
260
|
|
|
277
261
|
## Decision Tree
|
|
278
262
|
|
package/CHANGELOG.md
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## Unreleased
|
|
4
|
-
|
|
5
|
-
- **Candidate pinning contract (local prerelease `0.4.0-mvp.0`, not published)**:
|
|
6
|
-
the install record separates declared compatibility (Node `>=20.9.0`, Yarn 4,
|
|
7
|
-
the `node-modules` linker, direct dependency ranges including `@thorprovider/types`
|
|
8
|
-
and the CLI itself, and `cliVersion`) from the resolved pin (exact `node_modules`
|
|
9
|
-
versions, the real `yarn.lock` content hash, and the package-owned asset BOM).
|
|
10
|
-
`doctor`/`update` validate the record against the live project and refuse to stamp
|
|
11
|
-
an incomplete or mismatched pin set; `doctor` compares the live declarations,
|
|
12
|
-
resolved versions, lockfile, and installed owned BOM against the record instead of
|
|
13
|
-
the record against itself. Only package-owned suite paths are hashed, so a user's
|
|
14
|
-
own skill/command files are neither stamped nor reported as drift.
|
|
15
|
-
- **Composition manifest (in progress)**: a `storefront.config.json` manifest becomes
|
|
16
|
-
the source of truth for composition (theme, views, features, per-slot intents) and
|
|
17
|
-
the structural files are derived from it. This reuses the existing `recipes/` +
|
|
18
|
-
`archetypes.json` registry and the CLI rather than the LLM-driven view-edit path,
|
|
19
|
-
which is superseded: agents will delegate structural changes to the CLI and edit
|
|
20
|
-
only user-owned files. Coordinated with the in-progress `storefront-automation-commands`
|
|
21
|
-
and `deterministic-sf-init-cli` changes (shared registry and CLI).
|
|
22
|
-
- **Project resolution**: only `create` takes a directory. Every other command resolves
|
|
23
|
-
the storefront from the current directory upward (looking for `storefront.config.json`)
|
|
24
|
-
and errors without writing when none is found.
|
|
25
|
-
|
|
26
|
-
## 0.4.0
|
|
27
|
-
|
|
28
|
-
- **Renamed package**: `@thorprovider/create-storefront` → `@thorprovider/storefront`;
|
|
29
|
-
the `bin` is now `storefront` (`npx @thorprovider/storefront create`).
|
|
30
|
-
- **Single scaffold command**: `storefront create <dir>` scaffolds the storefront and
|
|
31
|
-
installs the OpenCode command suite in the same run. The standalone `install` action
|
|
32
|
-
is gone; `storefront update` refreshes, prunes removed files, and migrates the
|
|
33
|
-
version record.
|
|
34
|
-
- **Interactive wizard**: on a TTY, `create` prompts for name, site name, backend URL,
|
|
35
|
-
and preset (Maia preselected). Brand color is decided via `/sf-theme`, not the wizard.
|
|
36
|
-
Without a TTY, every required input must be passed as a flag or the command fails
|
|
37
|
-
fast before writing anything.
|
|
38
|
-
- **Command surface**: `<dir>` is positional; `--dir` is removed; `--name` is a flag or
|
|
39
|
-
wizard prompt. Commands are `storefront create|update|doctor <dir>`.
|
|
40
|
-
- **Removed `/sf-init`**: the `sf-init` command and `sf-scaffold` skill are gone.
|
|
41
|
-
Scaffolding is fully deterministic inside the binary.
|
|
42
|
-
- **Decoupled templates**: the scaffold templates moved from the `sf-scaffold` skill
|
|
43
|
-
into `assets/templates/` at the package root.
|
|
44
|
-
- **Version record**: `.opencode/storefront.json` (replacing `.create-storefront.json`);
|
|
45
|
-
`update` migrates existing installs.
|
|
46
|
-
|
|
47
|
-
## 0.3.0
|
|
48
|
-
|
|
49
|
-
- **Embedded assets**: each skill now carries the templates, recipes, and scripts it
|
|
50
|
-
uses inside its own directory (`assets/`, `scripts/`, `references/`) and addresses
|
|
51
|
-
them by relative path. No path marker is needed to locate the package.
|
|
52
|
-
- **Versioned install command**: `bin` exposes `create-storefront` with `install`,
|
|
53
|
-
`update`, and `doctor`. Installation is an explicit command; there is no
|
|
54
|
-
`postinstall`. The installer records `{ version, installedAt }` in
|
|
55
|
-
`.opencode/.create-storefront.json` (replacing the `.create-storefront-root` marker).
|
|
56
|
-
- **Single source, generated copies**: `recipes/` stays the single source at the
|
|
57
|
-
package root; `scripts/sync-assets.mjs` generates the per-skill copies and a
|
|
58
|
-
`--check` mode fails on drift. The check runs at build/pretest and before the
|
|
59
|
-
installer copies anything into a target project.
|
|
60
|
-
- **Positive source-of-truth rule**: the skills state that the workflow uses the assets
|
|
61
|
-
inside the skill and that an undecided choice is resolved by asking the user.
|
|
62
|
-
- **Named interfaces**: each skill declares the target-project inputs it reads and the
|
|
63
|
-
outputs it produces.
|
|
64
|
-
- **General self-containment check**: the test fails on any absolute machine path in a
|
|
65
|
-
shipped artifact, independent of any name.
|
|
66
|
-
|
|
67
|
-
## 0.2.0
|
|
68
|
-
|
|
69
|
-
- Per-view templates: every recipe view (`home`, `product`, `category`, `checkout`,
|
|
70
|
-
`user-panel`) ships as a self-contained module under `templates/views/<view>/`.
|
|
71
|
-
- Generated storefronts now compose views through a barrel (`lib/<name>/views/index.ts`);
|
|
72
|
-
shared files (`catalog.ts`, `registry.tsx`, `runtime.ts`, `spec/index.ts`) derive from
|
|
73
|
-
the registered views and are never edited per view.
|
|
74
|
-
- `/sf-add-view` copies a view module and registers one barrel entry, substituting only
|
|
75
|
-
the imported block identifier for the resolved variant. No hand-authored wiring.
|
|
76
|
-
- Optional sections (testimonials, FAQ, statistics, logo cloud, pricing) ship as
|
|
77
|
-
fragments under `views/sections/` and are validated against `recipes/sections.json`.
|
|
78
|
-
- `sf-scaffold` copies `templates/app/` plus `templates/views/home/` and registers
|
|
79
|
-
`home` in the barrel.
|
|
80
|
-
- Templates and skills no longer reference any repository-local application.
|
|
81
|
-
|
|
82
|
-
## 0.1.3
|
|
83
|
-
|
|
84
|
-
- Previous release.
|
package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/registry.part
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
CategoryCards: ({ props, emit }) => {
|
|
2
|
-
const { set } = useStateStore()
|
|
3
|
-
const cards = categoryCardsPropsSchema.parse(props)
|
|
4
|
-
return (
|
|
5
|
-
<CategoryCardsBlock
|
|
6
|
-
title={cards.title}
|
|
7
|
-
description={cards.description}
|
|
8
|
-
categories={cards.categories}
|
|
9
|
-
cta={cards.cta}
|
|
10
|
-
onBrowse={(category) => {
|
|
11
|
-
set('/lastCategory', category.handle ?? String(category.id))
|
|
12
|
-
emit('openCategory')
|
|
13
|
-
}}
|
|
14
|
-
/>
|
|
15
|
-
)
|
|
16
|
-
},
|