@caartzee/theme-sdk 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/caartzee-theme.js +464 -53
- package/dist/lib/index.js +464 -53
- package/dist/types/src/cli/mcp/ui-patterns-tools.d.ts +26 -0
- package/dist/types/src/cli/mcp/v2-commerce-tools.d.ts +16 -0
- package/dist/types/src/scaffold/design-presets.d.ts +41 -0
- package/dist/types/src/scaffold/template-generator.d.ts +2 -0
- package/package.json +1 -1
package/dist/lib/index.js
CHANGED
|
@@ -6587,6 +6587,323 @@ var candyStarterProductCard = `<article class="candy-product-card">
|
|
|
6587
6587
|
</article>
|
|
6588
6588
|
`;
|
|
6589
6589
|
|
|
6590
|
+
// src/scaffold/design-presets.ts
|
|
6591
|
+
var CANDY_DESIGN_PRESETS = {
|
|
6592
|
+
"minimal-luxury": {
|
|
6593
|
+
id: "minimal-luxury",
|
|
6594
|
+
name: "Minimal Luxury",
|
|
6595
|
+
description: "Warm ivory canvas, editorial serif headings, hairline borders, and champagne bronze accents.",
|
|
6596
|
+
bestFor: "Fashion, jewelry, skincare, home fragrance, boutique lifestyle brands.",
|
|
6597
|
+
googleFontsUrl: "https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600&display=swap",
|
|
6598
|
+
tokens: {
|
|
6599
|
+
colors: {
|
|
6600
|
+
background: "#FAF9F6",
|
|
6601
|
+
surface: "#F2EFE9",
|
|
6602
|
+
text: "#141414",
|
|
6603
|
+
muted: "#6B665E",
|
|
6604
|
+
border: "#E5E0D8",
|
|
6605
|
+
primary: "#141414",
|
|
6606
|
+
primaryText: "#FAF9F6",
|
|
6607
|
+
accent: "#9A7B4F",
|
|
6608
|
+
danger: "#B91C1C",
|
|
6609
|
+
success: "#166534"
|
|
6610
|
+
},
|
|
6611
|
+
typography: {
|
|
6612
|
+
headingFont: "'Cormorant Garamond', Georgia, serif",
|
|
6613
|
+
bodyFont: "'Plus Jakarta Sans', system-ui, -apple-system, sans-serif"
|
|
6614
|
+
},
|
|
6615
|
+
borderRadius: { sm: "2px", md: "4px", lg: "6px", button: "2px" }
|
|
6616
|
+
}
|
|
6617
|
+
},
|
|
6618
|
+
"streetwear-editorial": {
|
|
6619
|
+
id: "streetwear-editorial",
|
|
6620
|
+
name: "Streetwear Editorial",
|
|
6621
|
+
description: "High-contrast stark monochrome, architectural zero-radius grid, and punchy grotesk typography.",
|
|
6622
|
+
bestFor: "Streetwear, sneakers, archival fashion, skate, music merch.",
|
|
6623
|
+
googleFontsUrl: "https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&display=swap",
|
|
6624
|
+
tokens: {
|
|
6625
|
+
colors: {
|
|
6626
|
+
background: "#FFFFFF",
|
|
6627
|
+
surface: "#F4F4F5",
|
|
6628
|
+
text: "#09090B",
|
|
6629
|
+
muted: "#52525B",
|
|
6630
|
+
border: "#E4E4E7",
|
|
6631
|
+
primary: "#09090B",
|
|
6632
|
+
primaryText: "#FFFFFF",
|
|
6633
|
+
accent: "#E11D48",
|
|
6634
|
+
danger: "#DC2626",
|
|
6635
|
+
success: "#15803D"
|
|
6636
|
+
},
|
|
6637
|
+
typography: {
|
|
6638
|
+
headingFont: "'Space Grotesk', system-ui, sans-serif",
|
|
6639
|
+
bodyFont: "'Inter', system-ui, -apple-system, sans-serif"
|
|
6640
|
+
},
|
|
6641
|
+
borderRadius: { sm: "0px", md: "0px", lg: "2px", button: "0px" }
|
|
6642
|
+
}
|
|
6643
|
+
},
|
|
6644
|
+
"organic-wellness": {
|
|
6645
|
+
id: "organic-wellness",
|
|
6646
|
+
name: "Organic Wellness",
|
|
6647
|
+
description: "Soft oat background, forest green ink, sage surfaces, and calm rounded cards.",
|
|
6648
|
+
bestFor: "Skincare, botanicals, tea/coffee, supplements, sustainable living.",
|
|
6649
|
+
googleFontsUrl: "https://fonts.googleapis.com/css2?family=Fraunces:wght@500;600;700&family=DM+Sans:wght@400;500;600&display=swap",
|
|
6650
|
+
tokens: {
|
|
6651
|
+
colors: {
|
|
6652
|
+
background: "#F7F5F0",
|
|
6653
|
+
surface: "#ECECE4",
|
|
6654
|
+
text: "#1F2D24",
|
|
6655
|
+
muted: "#5A6B5F",
|
|
6656
|
+
border: "#DCE0D6",
|
|
6657
|
+
primary: "#2F523B",
|
|
6658
|
+
primaryText: "#F7F5F0",
|
|
6659
|
+
accent: "#C26D47",
|
|
6660
|
+
danger: "#B91C1C",
|
|
6661
|
+
success: "#166534"
|
|
6662
|
+
},
|
|
6663
|
+
typography: {
|
|
6664
|
+
headingFont: "'Fraunces', Georgia, serif",
|
|
6665
|
+
bodyFont: "'DM Sans', system-ui, -apple-system, sans-serif"
|
|
6666
|
+
},
|
|
6667
|
+
borderRadius: { sm: "8px", md: "14px", lg: "20px", button: "9999px" }
|
|
6668
|
+
}
|
|
6669
|
+
},
|
|
6670
|
+
"modern-tech": {
|
|
6671
|
+
id: "modern-tech",
|
|
6672
|
+
name: "Modern Tech",
|
|
6673
|
+
description: "Sleek dark slate surfaces, luminous contrast, geometric sans, and electric indigo accent.",
|
|
6674
|
+
bestFor: "Electronics, audio gear, gaming hardware, digital products, SaaS merch.",
|
|
6675
|
+
googleFontsUrl: "https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@600;700&family=Inter:wght@400;500;600&display=swap",
|
|
6676
|
+
tokens: {
|
|
6677
|
+
colors: {
|
|
6678
|
+
background: "#090D16",
|
|
6679
|
+
surface: "#111827",
|
|
6680
|
+
text: "#F8FAFC",
|
|
6681
|
+
muted: "#94A3B8",
|
|
6682
|
+
border: "#1E293B",
|
|
6683
|
+
primary: "#6366F1",
|
|
6684
|
+
primaryText: "#FFFFFF",
|
|
6685
|
+
accent: "#38BDF8",
|
|
6686
|
+
danger: "#F43F5E",
|
|
6687
|
+
success: "#10B981"
|
|
6688
|
+
},
|
|
6689
|
+
typography: {
|
|
6690
|
+
headingFont: "'Plus Jakarta Sans', system-ui, sans-serif",
|
|
6691
|
+
bodyFont: "'Inter', system-ui, -apple-system, sans-serif"
|
|
6692
|
+
},
|
|
6693
|
+
borderRadius: { sm: "6px", md: "10px", lg: "16px", button: "8px" }
|
|
6694
|
+
}
|
|
6695
|
+
},
|
|
6696
|
+
"vibrant-d2c": {
|
|
6697
|
+
id: "vibrant-d2c",
|
|
6698
|
+
name: "Vibrant D2C",
|
|
6699
|
+
description: "Energetic high-conversion D2C palette, pill buttons, clear savings badges, and crisp card hierarchy.",
|
|
6700
|
+
bestFor: "Snacks, beverages, pets, fitness, everyday consumer brands.",
|
|
6701
|
+
googleFontsUrl: "https://fonts.googleapis.com/css2?family=Outfit:wght@600;700&family=Inter:wght@400;500;600&display=swap",
|
|
6702
|
+
tokens: {
|
|
6703
|
+
colors: {
|
|
6704
|
+
background: "#FFFFFF",
|
|
6705
|
+
surface: "#FFF7ED",
|
|
6706
|
+
text: "#0F172A",
|
|
6707
|
+
muted: "#475569",
|
|
6708
|
+
border: "#E2E8F0",
|
|
6709
|
+
primary: "#EA580C",
|
|
6710
|
+
primaryText: "#FFFFFF",
|
|
6711
|
+
accent: "#0F172A",
|
|
6712
|
+
danger: "#DC2626",
|
|
6713
|
+
success: "#059669"
|
|
6714
|
+
},
|
|
6715
|
+
typography: {
|
|
6716
|
+
headingFont: "'Outfit', system-ui, sans-serif",
|
|
6717
|
+
bodyFont: "'Inter', system-ui, -apple-system, sans-serif"
|
|
6718
|
+
},
|
|
6719
|
+
borderRadius: { sm: "8px", md: "14px", lg: "20px", button: "9999px" }
|
|
6720
|
+
}
|
|
6721
|
+
}
|
|
6722
|
+
};
|
|
6723
|
+
var CANDY_DESIGN_PRESET_IDS = Object.keys(CANDY_DESIGN_PRESETS);
|
|
6724
|
+
function resolveDesignPreset(id) {
|
|
6725
|
+
const key = (id || "minimal-luxury").trim().toLowerCase();
|
|
6726
|
+
return CANDY_DESIGN_PRESETS[key] || CANDY_DESIGN_PRESETS["minimal-luxury"];
|
|
6727
|
+
}
|
|
6728
|
+
function buildCandyDesignSystemCss(presetInput) {
|
|
6729
|
+
const preset = typeof presetInput === "string" || !presetInput ? resolveDesignPreset(presetInput) : presetInput;
|
|
6730
|
+
const { colors, typography, borderRadius } = preset.tokens;
|
|
6731
|
+
return `/* Caartzee Candy Design System — Preset: ${preset.name} (${preset.id}) */
|
|
6732
|
+
@import url('${preset.googleFontsUrl}');
|
|
6733
|
+
|
|
6734
|
+
:root {
|
|
6735
|
+
--cz-bg: ${colors.background};
|
|
6736
|
+
--cz-surface: ${colors.surface};
|
|
6737
|
+
--cz-ink: ${colors.text};
|
|
6738
|
+
--cz-muted: ${colors.muted};
|
|
6739
|
+
--cz-border: ${colors.border};
|
|
6740
|
+
--cz-primary: ${colors.primary};
|
|
6741
|
+
--cz-primary-ink: ${colors.primaryText};
|
|
6742
|
+
--cz-accent: ${colors.accent};
|
|
6743
|
+
--cz-danger: ${colors.danger};
|
|
6744
|
+
--cz-success: ${colors.success};
|
|
6745
|
+
--cz-font-heading: ${typography.headingFont};
|
|
6746
|
+
--cz-font-body: ${typography.bodyFont};
|
|
6747
|
+
--cz-radius-sm: ${borderRadius.sm};
|
|
6748
|
+
--cz-radius-md: ${borderRadius.md};
|
|
6749
|
+
--cz-radius-lg: ${borderRadius.lg};
|
|
6750
|
+
--cz-radius-btn: ${borderRadius.button};
|
|
6751
|
+
--cz-container: 1280px;
|
|
6752
|
+
--cz-space-xs: 0.5rem;
|
|
6753
|
+
--cz-space-sm: 1rem;
|
|
6754
|
+
--cz-space-md: 1.5rem;
|
|
6755
|
+
--cz-space-lg: 3rem;
|
|
6756
|
+
--cz-space-xl: 4.5rem;
|
|
6757
|
+
}
|
|
6758
|
+
|
|
6759
|
+
*, *::before, *::after { box-sizing: border-box; }
|
|
6760
|
+
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
|
|
6761
|
+
body {
|
|
6762
|
+
margin: 0;
|
|
6763
|
+
background: var(--cz-bg);
|
|
6764
|
+
color: var(--cz-ink);
|
|
6765
|
+
font-family: var(--cz-font-body);
|
|
6766
|
+
line-height: 1.6;
|
|
6767
|
+
}
|
|
6768
|
+
h1, h2, h3, h4 { font-family: var(--cz-font-heading); line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.75rem; }
|
|
6769
|
+
a { color: inherit; text-decoration: none; }
|
|
6770
|
+
img { max-width: 100%; height: auto; display: block; }
|
|
6771
|
+
|
|
6772
|
+
.cz-container { width: 100%; max-width: var(--cz-container); margin: 0 auto; padding: 0 1.25rem; }
|
|
6773
|
+
|
|
6774
|
+
/* Buttons */
|
|
6775
|
+
.cz-btn, button.js-add-to-cart, button.js-submit-btn {
|
|
6776
|
+
display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
|
|
6777
|
+
padding: 0.75rem 1.4rem; border-radius: var(--cz-radius-btn);
|
|
6778
|
+
background: var(--cz-primary); color: var(--cz-primary-ink);
|
|
6779
|
+
border: 1px solid var(--cz-primary); font: 600 0.875rem/1 var(--cz-font-body);
|
|
6780
|
+
cursor: pointer; transition: opacity 0.18s ease, transform 0.15s ease;
|
|
6781
|
+
}
|
|
6782
|
+
.cz-btn:hover, button.js-add-to-cart:hover, button.js-submit-btn:hover { opacity: 0.88; }
|
|
6783
|
+
.cz-btn--outline { background: transparent; color: var(--cz-ink); border-color: var(--cz-border); }
|
|
6784
|
+
.cz-btn--outline:hover { border-color: var(--cz-ink); opacity: 1; }
|
|
6785
|
+
|
|
6786
|
+
/* Announcement & Header */
|
|
6787
|
+
.cz-announcement-bar {
|
|
6788
|
+
background: var(--cz-primary); color: var(--cz-primary-ink);
|
|
6789
|
+
text-align: center; font-size: 0.78rem; font-weight: 500;
|
|
6790
|
+
padding: 0.5rem 1rem; letter-spacing: 0.03em;
|
|
6791
|
+
}
|
|
6792
|
+
.cz-candy-header {
|
|
6793
|
+
position: sticky; top: 0; z-index: 40;
|
|
6794
|
+
background: var(--cz-bg); color: var(--cz-ink);
|
|
6795
|
+
border-bottom: 1px solid var(--cz-border);
|
|
6796
|
+
}
|
|
6797
|
+
.cz-header-inner {
|
|
6798
|
+
max-width: var(--cz-container); margin: 0 auto; padding: 0.9rem 1.25rem;
|
|
6799
|
+
display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap;
|
|
6800
|
+
}
|
|
6801
|
+
.cz-header-logo { font-family: var(--cz-font-heading); font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
|
|
6802
|
+
.cz-candy-header nav { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; font-size: 0.9rem; font-weight: 500; }
|
|
6803
|
+
.cz-candy-header nav a:hover { color: var(--cz-accent); }
|
|
6804
|
+
.cz-header-actions { display: flex; align-items: center; gap: 1rem; font-size: 0.875rem; font-weight: 500; }
|
|
6805
|
+
|
|
6806
|
+
/* Hero Banner */
|
|
6807
|
+
.cz-candy-hero {
|
|
6808
|
+
position: relative; overflow: hidden; background: var(--cz-surface);
|
|
6809
|
+
padding: clamp(3rem, 7vw, 6.5rem) 1.25rem; text-align: center;
|
|
6810
|
+
border-bottom: 1px solid var(--cz-border);
|
|
6811
|
+
}
|
|
6812
|
+
.cz-candy-hero h1 { font-size: clamp(2.1rem, 5vw, 4rem); max-width: 18ch; margin: 0 auto 1rem; }
|
|
6813
|
+
.cz-candy-hero p { color: var(--cz-muted); max-width: 54ch; margin: 0 auto 1.75rem; font-size: 1.05rem; }
|
|
6814
|
+
.cz-candy-hero > a {
|
|
6815
|
+
display: inline-flex; padding: 0.85rem 1.8rem; border-radius: var(--cz-radius-btn);
|
|
6816
|
+
background: var(--cz-primary); color: var(--cz-primary-ink); font-weight: 600; font-size: 0.9rem;
|
|
6817
|
+
}
|
|
6818
|
+
.cz-hero-desktop-img {
|
|
6819
|
+
width: 100%; max-width: 1120px; max-height: 480px; object-fit: cover;
|
|
6820
|
+
margin: 0 auto 2rem; border-radius: var(--cz-radius-lg);
|
|
6821
|
+
}
|
|
6822
|
+
|
|
6823
|
+
/* Uniform Product Grid & Cards (used on Home, Collection, Search, Related Products) */
|
|
6824
|
+
.cz-candy-featured-products, .cz-candy-collection, .cz-candy-search {
|
|
6825
|
+
max-width: var(--cz-container); margin: 0 auto; padding: var(--cz-space-lg) 1.25rem;
|
|
6826
|
+
}
|
|
6827
|
+
.candy-product-grid {
|
|
6828
|
+
display: grid; gap: 1.5rem;
|
|
6829
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
6830
|
+
}
|
|
6831
|
+
.candy-product-card {
|
|
6832
|
+
display: flex; flex-direction: column; gap: 0.65rem;
|
|
6833
|
+
background: var(--cz-bg); border: 1px solid var(--cz-border);
|
|
6834
|
+
border-radius: var(--cz-radius-md); overflow: hidden; padding-bottom: 1rem;
|
|
6835
|
+
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
6836
|
+
}
|
|
6837
|
+
.candy-product-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06); }
|
|
6838
|
+
.candy-product-card img {
|
|
6839
|
+
width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--cz-surface);
|
|
6840
|
+
}
|
|
6841
|
+
.candy-product-card h3, .candy-product-card .candy-card-title {
|
|
6842
|
+
font-size: 1rem; font-weight: 600; margin: 0; padding: 0 0.9rem;
|
|
6843
|
+
}
|
|
6844
|
+
.candy-product-card .candy-price { padding: 0 0.9rem; font-weight: 600; color: var(--cz-ink); font-size: 0.95rem; }
|
|
6845
|
+
.candy-product-card .js-add-to-cart { margin: 0.25rem 0.9rem 0; width: calc(100% - 1.8rem); }
|
|
6846
|
+
|
|
6847
|
+
/* Product Detail Page */
|
|
6848
|
+
.cz-candy-product-detail {
|
|
6849
|
+
max-width: var(--cz-container); margin: 0 auto; padding: var(--cz-space-lg) 1.25rem;
|
|
6850
|
+
display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 3rem; align-items: start;
|
|
6851
|
+
}
|
|
6852
|
+
.cz-candy-product-detail img[data-product-main-image] {
|
|
6853
|
+
width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
|
|
6854
|
+
border-radius: var(--cz-radius-lg); background: var(--cz-surface); border: 1px solid var(--cz-border);
|
|
6855
|
+
}
|
|
6856
|
+
|
|
6857
|
+
/* Cart, Auth, Wishlist & Content Pages */
|
|
6858
|
+
.cz-candy-cart, .cz-wishlist-section, .cz-candy-page {
|
|
6859
|
+
max-width: 960px; margin: 0 auto; padding: var(--cz-space-lg) 1.25rem;
|
|
6860
|
+
}
|
|
6861
|
+
.cz-auth-section {
|
|
6862
|
+
max-width: 440px; margin: 3.5rem auto; padding: 2rem;
|
|
6863
|
+
background: var(--cz-surface); border: 1px solid var(--cz-border);
|
|
6864
|
+
border-radius: var(--cz-radius-lg);
|
|
6865
|
+
}
|
|
6866
|
+
.cz-auth-section form { display: grid; gap: 0.85rem; margin-top: 1.25rem; }
|
|
6867
|
+
.cz-auth-section input {
|
|
6868
|
+
width: 100%; padding: 0.75rem 0.9rem; border-radius: var(--cz-radius-sm);
|
|
6869
|
+
border: 1px solid var(--cz-border); background: var(--cz-bg); color: var(--cz-ink);
|
|
6870
|
+
font: inherit;
|
|
6871
|
+
}
|
|
6872
|
+
|
|
6873
|
+
/* Editorial Split Section */
|
|
6874
|
+
.cz-candy-image-with-text {
|
|
6875
|
+
max-width: var(--cz-container); margin: var(--cz-space-lg) auto; padding: 2.5rem;
|
|
6876
|
+
background: var(--cz-surface); border: 1px solid var(--cz-border); border-radius: var(--cz-radius-lg);
|
|
6877
|
+
}
|
|
6878
|
+
|
|
6879
|
+
/* Footer */
|
|
6880
|
+
.cz-candy-footer {
|
|
6881
|
+
margin-top: var(--cz-space-xl); border-top: 1px solid var(--cz-border);
|
|
6882
|
+
padding: var(--cz-space-lg) 1.25rem 2rem;
|
|
6883
|
+
}
|
|
6884
|
+
.cz-footer-grid {
|
|
6885
|
+
max-width: var(--cz-container); margin: 0 auto 2rem;
|
|
6886
|
+
display: grid; grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr)); gap: 2rem;
|
|
6887
|
+
}
|
|
6888
|
+
.cz-footer-col { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.875rem; }
|
|
6889
|
+
.cz-footer-bottom {
|
|
6890
|
+
max-width: var(--cz-container); margin: 0 auto; padding-top: 1.25rem;
|
|
6891
|
+
border-top: 1px solid rgba(255, 255, 255, 0.14); font-size: 0.8rem; opacity: 0.8;
|
|
6892
|
+
}
|
|
6893
|
+
|
|
6894
|
+
/* Responsive Breakpoints */
|
|
6895
|
+
@media (max-width: 1024px) {
|
|
6896
|
+
.candy-product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
6897
|
+
.cz-footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
6898
|
+
}
|
|
6899
|
+
@media (max-width: 768px) {
|
|
6900
|
+
.candy-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
|
|
6901
|
+
.cz-candy-product-detail { grid-template-columns: 1fr; gap: 1.75rem; }
|
|
6902
|
+
.cz-footer-grid { grid-template-columns: 1fr; }
|
|
6903
|
+
}
|
|
6904
|
+
`;
|
|
6905
|
+
}
|
|
6906
|
+
|
|
6590
6907
|
// src/scaffold/template-generator.ts
|
|
6591
6908
|
function scaffoldTheme(options) {
|
|
6592
6909
|
const rawSlug = options.slug || options.name?.toLowerCase().replace(/[^a-z0-9_-]+/g, "-") || "starter-theme";
|
|
@@ -6615,7 +6932,7 @@ function scaffoldTheme(options) {
|
|
|
6615
6932
|
};
|
|
6616
6933
|
if (options.engine === "candy") {
|
|
6617
6934
|
const sdkDependency = options.sdkVersion ?? (options.sdkPath ? "file:" + relative2(rootDir, options.sdkPath).replace(/\\/g, "/") : "^1.0.0");
|
|
6618
|
-
return scaffoldCandyThemeInternal({ slug, name, author, description, rootDir, writeFile, createdFiles, sdkDependency });
|
|
6935
|
+
return scaffoldCandyThemeInternal({ slug, name, author, description, rootDir, writeFile, createdFiles, sdkDependency, preset: options.preset });
|
|
6619
6936
|
}
|
|
6620
6937
|
writeFile("package.json", JSON.stringify({
|
|
6621
6938
|
name: `@caartzee-theme/${slug}`,
|
|
@@ -6969,7 +7286,7 @@ npm run push
|
|
|
6969
7286
|
};
|
|
6970
7287
|
}
|
|
6971
7288
|
function scaffoldCandyThemeInternal(params) {
|
|
6972
|
-
const { slug, name, author, description, rootDir, writeFile, createdFiles, sdkDependency } = params;
|
|
7289
|
+
const { slug, name, author, description, rootDir, writeFile, createdFiles, sdkDependency, preset } = params;
|
|
6973
7290
|
writeFile("candy.config.json", JSON.stringify({
|
|
6974
7291
|
engine: "candy",
|
|
6975
7292
|
candyVersion: "1.0.0",
|
|
@@ -7441,15 +7758,26 @@ Read [AGENTS.md](./AGENTS.md) and call the Candy MCP tool \`read_candy_guide\` b
|
|
|
7441
7758
|
`);
|
|
7442
7759
|
}
|
|
7443
7760
|
writeFile("snippets/product-card.candy", candyStarterProductCard);
|
|
7761
|
+
const resolvedPreset = resolveDesignPreset(preset);
|
|
7444
7762
|
writeFile("schemas/settings_schema.json", JSON.stringify([
|
|
7445
7763
|
{
|
|
7446
7764
|
name: "Colors",
|
|
7447
7765
|
settings: [
|
|
7448
|
-
{ id: "primary_color", type: "color", label: "Primary Color", default:
|
|
7766
|
+
{ id: "primary_color", type: "color", label: "Primary Color", default: resolvedPreset.tokens.colors.primary },
|
|
7767
|
+
{ id: "accent_color", type: "color", label: "Accent Color", default: resolvedPreset.tokens.colors.accent },
|
|
7768
|
+
{ id: "background_color", type: "color", label: "Background Color", default: resolvedPreset.tokens.colors.background },
|
|
7769
|
+
{ id: "text_color", type: "color", label: "Text Color", default: resolvedPreset.tokens.colors.text }
|
|
7770
|
+
]
|
|
7771
|
+
},
|
|
7772
|
+
{
|
|
7773
|
+
name: "Typography",
|
|
7774
|
+
settings: [
|
|
7775
|
+
{ id: "heading_font", type: "font", label: "Heading Font", default: resolvedPreset.tokens.typography.headingFont },
|
|
7776
|
+
{ id: "body_font", type: "font", label: "Body Font", default: resolvedPreset.tokens.typography.bodyFont }
|
|
7449
7777
|
]
|
|
7450
7778
|
}
|
|
7451
7779
|
], null, 2));
|
|
7452
|
-
writeFile("assets/theme.css",
|
|
7780
|
+
writeFile("assets/theme.css", buildCandyDesignSystemCss(resolvedPreset));
|
|
7453
7781
|
writeFile("assets/theme.js", `window.__CAARTZEE_CANDY_THEME__ = true;
|
|
7454
7782
|
document.addEventListener('caartzee:section:load', function () {
|
|
7455
7783
|
// Re-initialize any section-specific UI widgets after Theme Editor live swaps.
|
|
@@ -10406,8 +10734,8 @@ function collectThemeSources(root) {
|
|
|
10406
10734
|
}
|
|
10407
10735
|
|
|
10408
10736
|
// src/cli/caartzee-cli.ts
|
|
10409
|
-
import { existsSync as
|
|
10410
|
-
import { resolve as
|
|
10737
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync5, readFileSync as readFileSync12, writeFileSync as writeFileSync5 } from "node:fs";
|
|
10738
|
+
import { resolve as resolve10, join as join12 } from "node:path";
|
|
10411
10739
|
|
|
10412
10740
|
// src/cli/mcp/editor-tools.ts
|
|
10413
10741
|
import { existsSync as existsSync9, readFileSync as readFileSync9 } from "node:fs";
|
|
@@ -10652,7 +10980,7 @@ ${productCard}`;
|
|
|
10652
10980
|
slug,
|
|
10653
10981
|
version,
|
|
10654
10982
|
packageHash,
|
|
10655
|
-
sdkVersion: "1.2.
|
|
10983
|
+
sdkVersion: "1.2.1",
|
|
10656
10984
|
runtimeVersion: "candy-1.0",
|
|
10657
10985
|
status: summary.failed > 0 ? "failed" : summary.warnings > 0 ? "partial" : "passed",
|
|
10658
10986
|
summary,
|
|
@@ -10660,6 +10988,58 @@ ${productCard}`;
|
|
|
10660
10988
|
};
|
|
10661
10989
|
}
|
|
10662
10990
|
|
|
10991
|
+
// src/cli/mcp/ui-patterns-tools.ts
|
|
10992
|
+
import { existsSync as existsSync11, readFileSync as readFileSync11 } from "node:fs";
|
|
10993
|
+
import { join as join11, resolve as resolve9 } from "node:path";
|
|
10994
|
+
import { z as z8 } from "zod";
|
|
10995
|
+
function auditCandyUiConsistency(themeDir) {
|
|
10996
|
+
const dir = resolve9(themeDir);
|
|
10997
|
+
const readRel = (rel) => {
|
|
10998
|
+
const p = join11(dir, rel);
|
|
10999
|
+
return existsSync11(p) ? readFileSync11(p, "utf8") : "";
|
|
11000
|
+
};
|
|
11001
|
+
const css = readRel("assets/theme.css");
|
|
11002
|
+
const productCard = readRel("snippets/product-card.candy");
|
|
11003
|
+
const cart = readRel("templates/cart.candy");
|
|
11004
|
+
const search = readRel("templates/search.candy");
|
|
11005
|
+
const collection = readRel("templates/collection.candy");
|
|
11006
|
+
const checks = [
|
|
11007
|
+
{
|
|
11008
|
+
id: "ui.design_tokens",
|
|
11009
|
+
status: css.includes(":root") && (css.includes("--cz-") || css.includes("--sf-")) ? "passed" : "warning",
|
|
11010
|
+
message: css.includes(":root") ? "Semantic CSS design tokens (:root) found in assets/theme.css." : "Define semantic :root design tokens (--cz-bg, --cz-ink, --cz-primary) in assets/theme.css for cross-page visual consistency."
|
|
11011
|
+
},
|
|
11012
|
+
{
|
|
11013
|
+
id: "ui.uniform_card_aspect_ratio",
|
|
11014
|
+
status: css.includes("aspect-ratio") && css.includes("object-fit") ? "passed" : "warning",
|
|
11015
|
+
message: css.includes("aspect-ratio") && css.includes("object-fit") ? "Product cards enforce uniform aspect-ratio and object-fit: cover." : "Add aspect-ratio (e.g. 4/5) and object-fit: cover on product card images to prevent uneven grid rows."
|
|
11016
|
+
},
|
|
11017
|
+
{
|
|
11018
|
+
id: "ui.responsive_breakpoints",
|
|
11019
|
+
status: /@media\s*\(max-width:/i.test(css) ? "passed" : "warning",
|
|
11020
|
+
message: /@media\s*\(max-width:/i.test(css) ? "Responsive tablet/mobile @media breakpoints detected." : "Add @media (max-width: 1024px) and @media (max-width: 768px) rules for tablet and mobile layouts."
|
|
11021
|
+
},
|
|
11022
|
+
{
|
|
11023
|
+
id: "ui.reusable_product_card",
|
|
11024
|
+
status: productCard.trim().length > 0 ? "passed" : "failed",
|
|
11025
|
+
message: productCard.trim().length > 0 ? "Shared snippets/product-card.candy exists for consistent product grids." : "Missing snippets/product-card.candy — reuse one product card snippet across Home, Collection, and Search."
|
|
11026
|
+
},
|
|
11027
|
+
{
|
|
11028
|
+
id: "ui.empty_states",
|
|
11029
|
+
status: [cart, search, collection].every((t) => /else|empty|no\s+/i.test(t)) ? "passed" : "warning",
|
|
11030
|
+
message: "Checked Cart, Search, and Collection templates for empty/zero-result states."
|
|
11031
|
+
}
|
|
11032
|
+
];
|
|
11033
|
+
const failed = checks.filter((c) => c.status === "failed").length;
|
|
11034
|
+
const warnings = checks.filter((c) => c.status === "warning").length;
|
|
11035
|
+
return {
|
|
11036
|
+
themeDir: dir,
|
|
11037
|
+
status: failed > 0 ? "failed" : warnings > 0 ? "partial" : "passed",
|
|
11038
|
+
summary: { passed: checks.length - failed - warnings, failed, warnings },
|
|
11039
|
+
checks
|
|
11040
|
+
};
|
|
11041
|
+
}
|
|
11042
|
+
|
|
10663
11043
|
// src/cli/caartzee-cli.ts
|
|
10664
11044
|
async function runCli(rawArgs, io = {}) {
|
|
10665
11045
|
const log = io.stdout ?? console.log;
|
|
@@ -10707,8 +11087,8 @@ async function runCli(rawArgs, io = {}) {
|
|
|
10707
11087
|
case "dev":
|
|
10708
11088
|
return await handleDev(args, log, error);
|
|
10709
11089
|
case "sync-manifest": {
|
|
10710
|
-
const theme = await loadLocalTheme(
|
|
10711
|
-
writeFileSync5(
|
|
11090
|
+
const theme = await loadLocalTheme(resolve10(args[0] || process.cwd()));
|
|
11091
|
+
writeFileSync5(resolve10(args[0] || process.cwd(), "manifest.json"), JSON.stringify(theme.manifest, null, 2));
|
|
10712
11092
|
log("Exported runtime theme manifest.");
|
|
10713
11093
|
return 0;
|
|
10714
11094
|
}
|
|
@@ -10730,9 +11110,11 @@ async function runCli(rawArgs, io = {}) {
|
|
|
10730
11110
|
return await handleTestSuite(args, "commerce", log, error);
|
|
10731
11111
|
case "test-report":
|
|
10732
11112
|
return await handleTestReport(args, log, error);
|
|
11113
|
+
case "ui-audit":
|
|
11114
|
+
return await handleUiAudit(args, log, error);
|
|
10733
11115
|
case "ide":
|
|
10734
11116
|
case "ide-setup": {
|
|
10735
|
-
const targetDir = args[0] ?
|
|
11117
|
+
const targetDir = args[0] ? resolve10(args[0]) : process.cwd();
|
|
10736
11118
|
const res = installCandyIdeSupport({ workspaceDir: targetDir });
|
|
10737
11119
|
log(`
|
|
10738
11120
|
\uD83C\uDFA8 Installed Candy (.candy) IDE language support:`);
|
|
@@ -10774,6 +11156,15 @@ async function handleInit(args, log, error) {
|
|
|
10774
11156
|
throw new Error("The commerce scaffold uses TypeScript.");
|
|
10775
11157
|
if (engineIndex >= 0)
|
|
10776
11158
|
args = args.filter((_, index) => index !== engineIndex && index !== engineIndex + 1);
|
|
11159
|
+
const presetIndex = args.indexOf("--preset");
|
|
11160
|
+
const presetRaw = presetIndex < 0 ? undefined : args[presetIndex + 1];
|
|
11161
|
+
if (presetIndex >= 0) {
|
|
11162
|
+
if (!presetRaw || !CANDY_DESIGN_PRESET_IDS.includes(presetRaw)) {
|
|
11163
|
+
throw new Error(`Supported presets: ${CANDY_DESIGN_PRESET_IDS.join(", ")}`);
|
|
11164
|
+
}
|
|
11165
|
+
args = args.filter((_, index) => index !== presetIndex && index !== presetIndex + 1);
|
|
11166
|
+
}
|
|
11167
|
+
const preset = presetRaw;
|
|
10777
11168
|
const dirIndex = args.indexOf("--dir");
|
|
10778
11169
|
const dir = dirIndex < 0 ? undefined : args[dirIndex + 1];
|
|
10779
11170
|
if (dirIndex >= 0 && !dir)
|
|
@@ -10781,7 +11172,7 @@ async function handleInit(args, log, error) {
|
|
|
10781
11172
|
if (dirIndex >= 0)
|
|
10782
11173
|
args = args.filter((_, index) => index !== dirIndex && index !== dirIndex + 1);
|
|
10783
11174
|
const nameArg = args[0];
|
|
10784
|
-
const targetDir =
|
|
11175
|
+
const targetDir = resolve10(dir || args[1] || nameArg || "my-caartzee-theme");
|
|
10785
11176
|
const themeName = nameArg || "My Caartzee Theme";
|
|
10786
11177
|
log(`
|
|
10787
11178
|
\uD83D\uDCE6 Scaffolding new Caartzee theme in: ${targetDir}`);
|
|
@@ -10791,7 +11182,8 @@ async function handleInit(args, log, error) {
|
|
|
10791
11182
|
targetDir,
|
|
10792
11183
|
sdkPath: fileURLToPath3(new URL("../../", import.meta.url)),
|
|
10793
11184
|
name: themeName,
|
|
10794
|
-
engine
|
|
11185
|
+
engine,
|
|
11186
|
+
...preset ? { preset } : {}
|
|
10795
11187
|
});
|
|
10796
11188
|
log(`✨ Successfully generated theme "${result.name}" (${result.slug})!`);
|
|
10797
11189
|
log(` Created ${result.createdFiles.length} files:`);
|
|
@@ -10929,7 +11321,7 @@ async function handleDev(args, log, error) {
|
|
|
10929
11321
|
port = parseInt(args[i + 1], 10);
|
|
10930
11322
|
i++;
|
|
10931
11323
|
} else if (args[i] === "--dir" && args[i + 1]) {
|
|
10932
|
-
themeDir =
|
|
11324
|
+
themeDir = resolve10(args[i + 1]);
|
|
10933
11325
|
i++;
|
|
10934
11326
|
} else if (args[i] === "--store") {
|
|
10935
11327
|
store = args[++i];
|
|
@@ -10996,21 +11388,21 @@ Shutting down dev server...`);
|
|
|
10996
11388
|
}
|
|
10997
11389
|
}
|
|
10998
11390
|
async function handleValidate(args, log, error) {
|
|
10999
|
-
const targetDir = args[0] ?
|
|
11391
|
+
const targetDir = args[0] ? resolve10(args[0]) : process.cwd();
|
|
11000
11392
|
log(`
|
|
11001
11393
|
\uD83D\uDEE1️ Running Caartzee Theme Security & Package Validation...`);
|
|
11002
11394
|
log(` Target: ${targetDir}`);
|
|
11003
|
-
const manifestPath =
|
|
11004
|
-
if (!
|
|
11395
|
+
const manifestPath = join12(targetDir, "manifest.json");
|
|
11396
|
+
if (!existsSync12(manifestPath)) {
|
|
11005
11397
|
error(`❌ Missing manifest.json in ${targetDir}`);
|
|
11006
11398
|
return 1;
|
|
11007
11399
|
}
|
|
11008
11400
|
try {
|
|
11009
|
-
if (
|
|
11401
|
+
if (existsSync12(join12(targetDir, "src/manifest.ts")) && typeof Bun !== "undefined") {
|
|
11010
11402
|
const theme = await loadLocalTheme(targetDir);
|
|
11011
11403
|
writeFileSync5(manifestPath, JSON.stringify(theme.manifest, null, 2));
|
|
11012
11404
|
}
|
|
11013
|
-
const rawManifest = JSON.parse(
|
|
11405
|
+
const rawManifest = JSON.parse(readFileSync12(manifestPath, "utf-8"));
|
|
11014
11406
|
const manifestCheck = ThemePackageValidator.validateManifest(rawManifest);
|
|
11015
11407
|
if (!manifestCheck.success) {
|
|
11016
11408
|
error(`❌ Manifest validation failed:`);
|
|
@@ -11049,7 +11441,7 @@ async function handleValidate(args, log, error) {
|
|
|
11049
11441
|
}
|
|
11050
11442
|
}
|
|
11051
11443
|
async function handleBuild(args, log, error) {
|
|
11052
|
-
const targetDir = args[0] ?
|
|
11444
|
+
const targetDir = args[0] ? resolve10(args[0]) : process.cwd();
|
|
11053
11445
|
log(`
|
|
11054
11446
|
\uD83D\uDD28 Building Caartzee Theme Package...`);
|
|
11055
11447
|
log(` Source directory: ${targetDir}`);
|
|
@@ -11061,9 +11453,9 @@ async function handleBuild(args, log, error) {
|
|
|
11061
11453
|
}
|
|
11062
11454
|
return 1;
|
|
11063
11455
|
}
|
|
11064
|
-
const isCandy =
|
|
11065
|
-
const distDir =
|
|
11066
|
-
if (!
|
|
11456
|
+
const isCandy = existsSync12(join12(targetDir, "candy.config.json")) || existsSync12(join12(targetDir, "layout", "theme.candy")) || valResult.manifest?.engine === "candy";
|
|
11457
|
+
const distDir = join12(targetDir, "dist");
|
|
11458
|
+
if (!existsSync12(distDir)) {
|
|
11067
11459
|
mkdirSync5(distDir, { recursive: true });
|
|
11068
11460
|
}
|
|
11069
11461
|
if (isCandy) {
|
|
@@ -11076,8 +11468,8 @@ async function handleBuild(args, log, error) {
|
|
|
11076
11468
|
}
|
|
11077
11469
|
return 1;
|
|
11078
11470
|
}
|
|
11079
|
-
const bundlePath =
|
|
11080
|
-
const manifestOutPath =
|
|
11471
|
+
const bundlePath = join12(distDir, "candy-theme-bundle.json");
|
|
11472
|
+
const manifestOutPath = join12(distDir, "manifest.json");
|
|
11081
11473
|
writeFileSync5(bundlePath, JSON.stringify(bundle, null, 2), "utf-8");
|
|
11082
11474
|
writeFileSync5(manifestOutPath, JSON.stringify(bundle.manifest, null, 2), "utf-8");
|
|
11083
11475
|
log(`✓ Extracted ${Object.keys(bundle.sectionSchemas).length} section schemas`);
|
|
@@ -11087,7 +11479,7 @@ async function handleBuild(args, log, error) {
|
|
|
11087
11479
|
return 0;
|
|
11088
11480
|
}
|
|
11089
11481
|
if (valResult.manifest) {
|
|
11090
|
-
const manifestOutPath =
|
|
11482
|
+
const manifestOutPath = join12(distDir, "manifest.json");
|
|
11091
11483
|
writeFileSync5(manifestOutPath, JSON.stringify(valResult.manifest, null, 2), "utf-8");
|
|
11092
11484
|
log(`✓ Wrote validated manifest to ${manifestOutPath}
|
|
11093
11485
|
`);
|
|
@@ -11106,10 +11498,10 @@ async function handlePush(args, log, error) {
|
|
|
11106
11498
|
error(`❌ Insufficient scope. Your account lacks "theme:publish" permissions.`);
|
|
11107
11499
|
return 1;
|
|
11108
11500
|
}
|
|
11109
|
-
const targetDir = args[0] ?
|
|
11110
|
-
if (
|
|
11501
|
+
const targetDir = args[0] ? resolve10(args[0]) : process.cwd();
|
|
11502
|
+
if (existsSync12(join12(targetDir, "src/manifest.ts")) && typeof Bun !== "undefined") {
|
|
11111
11503
|
const theme = await loadLocalTheme(targetDir);
|
|
11112
|
-
writeFileSync5(
|
|
11504
|
+
writeFileSync5(join12(targetDir, "manifest.json"), JSON.stringify(theme.manifest, null, 2));
|
|
11113
11505
|
}
|
|
11114
11506
|
const valResult = await ThemePackageValidator.validatePackage(targetDir);
|
|
11115
11507
|
if (!valResult.valid) {
|
|
@@ -11131,7 +11523,7 @@ async function handlePush(args, log, error) {
|
|
|
11131
11523
|
return 0;
|
|
11132
11524
|
}
|
|
11133
11525
|
async function handleDoctor(args, log, error) {
|
|
11134
|
-
const targetDir = args[0] ?
|
|
11526
|
+
const targetDir = args[0] ? resolve10(args[0]) : process.cwd();
|
|
11135
11527
|
log(`
|
|
11136
11528
|
\uD83E\uDE7A Running Caartzee Candy Theme Doctor...`);
|
|
11137
11529
|
log(` Target: ${targetDir}
|
|
@@ -11140,8 +11532,8 @@ async function handleDoctor(args, log, error) {
|
|
|
11140
11532
|
const warnings = [];
|
|
11141
11533
|
const passed = [];
|
|
11142
11534
|
const readIfExists = (rel) => {
|
|
11143
|
-
const full =
|
|
11144
|
-
return
|
|
11535
|
+
const full = join12(targetDir, rel);
|
|
11536
|
+
return existsSync12(full) ? readFileSync12(full, "utf8") : null;
|
|
11145
11537
|
};
|
|
11146
11538
|
const configRaw = readIfExists("candy.config.json");
|
|
11147
11539
|
const manifestRaw = readIfExists("manifest.json");
|
|
@@ -11185,7 +11577,7 @@ async function handleDoctor(args, log, error) {
|
|
|
11185
11577
|
}
|
|
11186
11578
|
const templateNames = ["index.candy", "collection.candy", "list-collections.candy", "product.candy", "cart.candy", "search.candy", "wishlist.candy", "login.candy", "register.candy", "page.candy", "404.candy"];
|
|
11187
11579
|
for (const name of templateNames) {
|
|
11188
|
-
const content = readIfExists(
|
|
11580
|
+
const content = readIfExists(join12("templates", name));
|
|
11189
11581
|
if (!content)
|
|
11190
11582
|
continue;
|
|
11191
11583
|
if (usesShell && /\{%\s*layout\s+/i.test(content)) {
|
|
@@ -11195,7 +11587,7 @@ async function handleDoctor(args, log, error) {
|
|
|
11195
11587
|
issues.push(`templates/${name} emits a synthetic "-default" variant ID, which causes POST /_api/cart 422 errors.`);
|
|
11196
11588
|
}
|
|
11197
11589
|
}
|
|
11198
|
-
const productCard = readIfExists(
|
|
11590
|
+
const productCard = readIfExists(join12("snippets", "product-card.candy"));
|
|
11199
11591
|
if (productCard) {
|
|
11200
11592
|
if (/data-variant-id\s*=\s*["'][^"']*-default["']/i.test(productCard)) {
|
|
11201
11593
|
issues.push('snippets/product-card.candy emits a synthetic "-default" variant ID. Guard data-variant-id with product.has_inventory_variants.');
|
|
@@ -11203,7 +11595,7 @@ async function handleDoctor(args, log, error) {
|
|
|
11203
11595
|
passed.push("Product card variant ID contract looks safe");
|
|
11204
11596
|
}
|
|
11205
11597
|
}
|
|
11206
|
-
const headerCandy = readIfExists(
|
|
11598
|
+
const headerCandy = readIfExists(join12("sections", "header.candy"));
|
|
11207
11599
|
if (headerCandy) {
|
|
11208
11600
|
if (!headerCandy.includes("js-cart-count")) {
|
|
11209
11601
|
warnings.push("sections/header.candy is missing .js-cart-count on the cart badge (live Add to Cart count won't update).");
|
|
@@ -11216,7 +11608,7 @@ async function handleDoctor(args, log, error) {
|
|
|
11216
11608
|
passed.push("Header navigation menu (menuId + linklists) wired");
|
|
11217
11609
|
}
|
|
11218
11610
|
}
|
|
11219
|
-
const heroCandy = readIfExists(
|
|
11611
|
+
const heroCandy = readIfExists(join12("sections", "hero-banner.candy"));
|
|
11220
11612
|
if (heroCandy) {
|
|
11221
11613
|
if (!heroCandy.includes("mobile_sliders")) {
|
|
11222
11614
|
warnings.push("sections/hero-banner.candy does not read mobile_sliders (merchant Mobile Slider changes won't reflect).");
|
|
@@ -11224,8 +11616,8 @@ async function handleDoctor(args, log, error) {
|
|
|
11224
11616
|
passed.push("Hero banner mobile_sliders support present");
|
|
11225
11617
|
}
|
|
11226
11618
|
}
|
|
11227
|
-
const loginCandy = readIfExists(
|
|
11228
|
-
const registerCandy = readIfExists(
|
|
11619
|
+
const loginCandy = readIfExists(join12("templates", "login.candy"));
|
|
11620
|
+
const registerCandy = readIfExists(join12("templates", "register.candy"));
|
|
11229
11621
|
if (loginCandy) {
|
|
11230
11622
|
if (!loginCandy.includes("/_api/auth/login") || !loginCandy.includes("js-auth-form")) {
|
|
11231
11623
|
issues.push('templates/login.candy must post to /_api/auth/login with class="js-auth-form".');
|
|
@@ -11240,11 +11632,11 @@ async function handleDoctor(args, log, error) {
|
|
|
11240
11632
|
passed.push("Signup page (/signup, /register) auth contract verified");
|
|
11241
11633
|
}
|
|
11242
11634
|
}
|
|
11243
|
-
if (readIfExists(
|
|
11635
|
+
if (readIfExists(join12("assets", "theme.css")))
|
|
11244
11636
|
passed.push("assets/theme.css found");
|
|
11245
11637
|
else
|
|
11246
11638
|
warnings.push("assets/theme.css not found.");
|
|
11247
|
-
if (readIfExists(
|
|
11639
|
+
if (readIfExists(join12("assets", "theme.js")))
|
|
11248
11640
|
passed.push("assets/theme.js found");
|
|
11249
11641
|
else
|
|
11250
11642
|
warnings.push("assets/theme.js not found.");
|
|
@@ -11271,19 +11663,19 @@ async function handleDoctor(args, log, error) {
|
|
|
11271
11663
|
}
|
|
11272
11664
|
async function handleVersion(args, log, error) {
|
|
11273
11665
|
const bump = args[0]?.trim();
|
|
11274
|
-
const targetDir = args[1] ?
|
|
11666
|
+
const targetDir = args[1] ? resolve10(args[1]) : process.cwd();
|
|
11275
11667
|
if (!bump) {
|
|
11276
11668
|
error("Usage: caartzee-theme version <patch|minor|major|x.y.z> [path]");
|
|
11277
11669
|
return 1;
|
|
11278
11670
|
}
|
|
11279
|
-
const configPath =
|
|
11280
|
-
const manifestPath =
|
|
11281
|
-
if (!
|
|
11671
|
+
const configPath = join12(targetDir, "candy.config.json");
|
|
11672
|
+
const manifestPath = join12(targetDir, "manifest.json");
|
|
11673
|
+
if (!existsSync12(configPath) && !existsSync12(manifestPath)) {
|
|
11282
11674
|
error(`No candy.config.json or manifest.json found in ${targetDir}`);
|
|
11283
11675
|
return 1;
|
|
11284
11676
|
}
|
|
11285
|
-
const readJson = (p) => JSON.parse(
|
|
11286
|
-
const current =
|
|
11677
|
+
const readJson = (p) => JSON.parse(readFileSync12(p, "utf8"));
|
|
11678
|
+
const current = existsSync12(configPath) ? String(readJson(configPath).version || "1.0.0") : String(readJson(manifestPath).version || "1.0.0");
|
|
11287
11679
|
let nextVersion = bump;
|
|
11288
11680
|
if (bump === "patch" || bump === "minor" || bump === "major") {
|
|
11289
11681
|
const parts = current.split(".").map((n) => parseInt(n, 10) || 0);
|
|
@@ -11293,13 +11685,13 @@ async function handleVersion(args, log, error) {
|
|
|
11293
11685
|
error(`Invalid version "${bump}". Use patch, minor, major, or semver like 1.0.3.`);
|
|
11294
11686
|
return 1;
|
|
11295
11687
|
}
|
|
11296
|
-
if (
|
|
11688
|
+
if (existsSync12(configPath)) {
|
|
11297
11689
|
const cfg = readJson(configPath);
|
|
11298
11690
|
cfg.version = nextVersion;
|
|
11299
11691
|
writeFileSync5(configPath, JSON.stringify(cfg, null, 2) + `
|
|
11300
11692
|
`, "utf8");
|
|
11301
11693
|
}
|
|
11302
|
-
if (
|
|
11694
|
+
if (existsSync12(manifestPath)) {
|
|
11303
11695
|
const man = readJson(manifestPath);
|
|
11304
11696
|
man.version = nextVersion;
|
|
11305
11697
|
writeFileSync5(manifestPath, JSON.stringify(man, null, 2) + `
|
|
@@ -11311,7 +11703,7 @@ async function handleVersion(args, log, error) {
|
|
|
11311
11703
|
function parseTargetAndJson(args) {
|
|
11312
11704
|
const asJson = args.includes("--json");
|
|
11313
11705
|
const positional = args.filter((a) => !a.startsWith("-"));
|
|
11314
|
-
const targetDir = positional[0] ?
|
|
11706
|
+
const targetDir = positional[0] ? resolve10(positional[0]) : process.cwd();
|
|
11315
11707
|
return { targetDir, asJson };
|
|
11316
11708
|
}
|
|
11317
11709
|
async function handleTestEditor(args, log, error) {
|
|
@@ -11366,10 +11758,10 @@ ${failed === 0 ? "✅" : "❌"} Result: ${passed} passed, ${failed} failed, ${wa
|
|
|
11366
11758
|
async function handleTestReport(args, log, error) {
|
|
11367
11759
|
const { targetDir, asJson } = parseTargetAndJson(args);
|
|
11368
11760
|
const report = await runThemeReadinessAudit(targetDir);
|
|
11369
|
-
const distDir =
|
|
11370
|
-
if (!
|
|
11761
|
+
const distDir = join12(targetDir, "dist");
|
|
11762
|
+
if (!existsSync12(distDir))
|
|
11371
11763
|
mkdirSync5(distDir, { recursive: true });
|
|
11372
|
-
const outPath =
|
|
11764
|
+
const outPath = join12(distDir, "theme-readiness-report.json");
|
|
11373
11765
|
writeFileSync5(outPath, JSON.stringify(report, null, 2), "utf8");
|
|
11374
11766
|
if (asJson) {
|
|
11375
11767
|
log(JSON.stringify({ reportPath: outPath, ...report }, null, 2));
|
|
@@ -11386,10 +11778,28 @@ async function handleTestReport(args, log, error) {
|
|
|
11386
11778
|
}
|
|
11387
11779
|
return 0;
|
|
11388
11780
|
}
|
|
11781
|
+
async function handleUiAudit(args, log, error) {
|
|
11782
|
+
const { targetDir, asJson } = parseTargetAndJson(args);
|
|
11783
|
+
const report = auditCandyUiConsistency(targetDir);
|
|
11784
|
+
if (asJson) {
|
|
11785
|
+
log(JSON.stringify(report, null, 2));
|
|
11786
|
+
return report.summary.failed > 0 ? 1 : 0;
|
|
11787
|
+
}
|
|
11788
|
+
log(`
|
|
11789
|
+
\uD83C\uDFA8 Caartzee Candy UI Consistency Audit (${targetDir})`);
|
|
11790
|
+
for (const c of report.checks) {
|
|
11791
|
+
const icon = c.status === "passed" ? "✓" : c.status === "warning" ? "⚠️" : "❌";
|
|
11792
|
+
(c.status === "failed" ? error : log)(` ${icon} [${c.id}] ${c.message}`);
|
|
11793
|
+
}
|
|
11794
|
+
log(`
|
|
11795
|
+
${report.summary.failed === 0 ? "✅" : "❌"} UI Audit: ${report.summary.passed} passed, ${report.summary.failed} failed, ${report.summary.warnings} warning(s).
|
|
11796
|
+
`);
|
|
11797
|
+
return report.summary.failed > 0 ? 1 : 0;
|
|
11798
|
+
}
|
|
11389
11799
|
function printHelp(log) {
|
|
11390
11800
|
log(`
|
|
11391
11801
|
╔═══════════════════════════════════════════════════════════════╗
|
|
11392
|
-
║ CAARTZEE THEME SDK CLI (v1.2.
|
|
11802
|
+
║ CAARTZEE THEME SDK CLI (v1.2.1) ║
|
|
11393
11803
|
║ Build, test, and publish secure storefront themes locally ║
|
|
11394
11804
|
╚═══════════════════════════════════════════════════════════════╝
|
|
11395
11805
|
|
|
@@ -11398,8 +11808,9 @@ Usage:
|
|
|
11398
11808
|
npx @caartzee/theme-sdk <command> [options]
|
|
11399
11809
|
|
|
11400
11810
|
Commands:
|
|
11401
|
-
init [name]
|
|
11811
|
+
init [name] [--engine candy] [--preset minimal-luxury|streetwear-editorial|organic-wellness|modern-tech|vibrant-d2c]
|
|
11402
11812
|
dev [--port 3333] [--store DOMAIN] [--editor] Preview with full local commerce/auth & Theme Editor
|
|
11813
|
+
ui-audit [path] [--json] Audit design tokens, uniform card aspect ratios, responsive CSS & empty states
|
|
11403
11814
|
doctor [path] Audit storefront-shell, cart/variant hooks, auth forms, menus & mobile sliders
|
|
11404
11815
|
version <patch|minor|major|x.y.z> [path] Bump version across candy.config.json and manifest.json
|
|
11405
11816
|
sync-manifest [path] Export the locally authored theme manifest to JSON
|