@cimplify/sdk 0.44.34 → 0.45.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 +21 -16
- package/dist/styles.css +1 -1
- package/package.json +5 -9
- package/dist/cli/commands/deploy.mjs +0 -717
- package/dist/cli/commands/dev.mjs +0 -479
- package/dist/cli/commands/domains.mjs +0 -769
- package/dist/cli/commands/env.mjs +0 -705
- package/dist/cli/commands/link.mjs +0 -378
- package/dist/cli/commands/login.mjs +0 -584
- package/dist/cli/commands/logout.mjs +0 -75
- package/dist/cli/commands/logs.mjs +0 -432
- package/dist/cli/commands/projects.mjs +0 -473
- package/dist/cli/commands/repo.mjs +0 -584
- package/dist/cli/commands/rollback.mjs +0 -553
- package/dist/cli/commands/status.mjs +0 -450
- package/dist/cli/commands/unlink.mjs +0 -79
- package/dist/cli/commands/whoami.mjs +0 -285
- package/dist/cli.js +0 -184
- package/dist/dispatcher.mjs +0 -360
- package/registry/booking-page.json +0 -18
- package/registry/bookings-page.json +0 -17
- package/registry/service-card.json +0 -16
- package/registry/service-grid.json +0 -16
- package/templates/storefront-bakery/.claude/skills/cimplify-storefront/SKILL.md +0 -145
- package/templates/storefront-bakery/.cursor/rules/cimplify-storefront.mdc +0 -25
- package/templates/storefront-bakery/.env.example +0 -16
- package/templates/storefront-bakery/AGENTS.md +0 -120
- package/templates/storefront-bakery/CLAUDE.md +0 -22
- package/templates/storefront-bakery/README.md +0 -73
- package/templates/storefront-bakery/__tests__/brand.test.ts +0 -4
- package/templates/storefront-bakery/__tests__/cart-flow.test.ts +0 -4
- package/templates/storefront-bakery/__tests__/contract.test.ts +0 -4
- package/templates/storefront-bakery/app/about/page.tsx +0 -38
- package/templates/storefront-bakery/app/accessibility/page.tsx +0 -11
- package/templates/storefront-bakery/app/account/addresses/page.tsx +0 -21
- package/templates/storefront-bakery/app/account/orders/page.tsx +0 -21
- package/templates/storefront-bakery/app/account/page.tsx +0 -22
- package/templates/storefront-bakery/app/account/settings/page.tsx +0 -21
- package/templates/storefront-bakery/app/cart/page.tsx +0 -9
- package/templates/storefront-bakery/app/categories/[slug]/listing-client.tsx +0 -19
- package/templates/storefront-bakery/app/categories/[slug]/page.tsx +0 -118
- package/templates/storefront-bakery/app/checkout/page.tsx +0 -17
- package/templates/storefront-bakery/app/collections/[slug]/listing-client.tsx +0 -20
- package/templates/storefront-bakery/app/collections/[slug]/page.tsx +0 -118
- package/templates/storefront-bakery/app/contact/contact-form.tsx +0 -109
- package/templates/storefront-bakery/app/contact/page.tsx +0 -54
- package/templates/storefront-bakery/app/error.tsx +0 -60
- package/templates/storefront-bakery/app/faq/page.tsx +0 -46
- package/templates/storefront-bakery/app/globals.css +0 -47
- package/templates/storefront-bakery/app/layout.tsx +0 -82
- package/templates/storefront-bakery/app/llms.txt/route.ts +0 -94
- package/templates/storefront-bakery/app/login/page.tsx +0 -17
- package/templates/storefront-bakery/app/not-found.tsx +0 -39
- package/templates/storefront-bakery/app/opensearch.xml/route.ts +0 -37
- package/templates/storefront-bakery/app/orders/[id]/page.tsx +0 -21
- package/templates/storefront-bakery/app/page.tsx +0 -97
- package/templates/storefront-bakery/app/privacy/page.tsx +0 -44
- package/templates/storefront-bakery/app/returns/page.tsx +0 -11
- package/templates/storefront-bakery/app/robots.ts +0 -18
- package/templates/storefront-bakery/app/search/page.tsx +0 -38
- package/templates/storefront-bakery/app/search/search-client.tsx +0 -7
- package/templates/storefront-bakery/app/shipping/page.tsx +0 -16
- package/templates/storefront-bakery/app/shop/page.tsx +0 -31
- package/templates/storefront-bakery/app/shop/shop-client.tsx +0 -27
- package/templates/storefront-bakery/app/signup/page.tsx +0 -17
- package/templates/storefront-bakery/app/sitemap-page/page.tsx +0 -167
- package/templates/storefront-bakery/app/sitemap.ts +0 -62
- package/templates/storefront-bakery/app/terms/page.tsx +0 -44
- package/templates/storefront-bakery/app/track-order/page.tsx +0 -24
- package/templates/storefront-bakery/app/track-order/track-order-form.tsx +0 -69
- package/templates/storefront-bakery/components/account-iframe.tsx +0 -13
- package/templates/storefront-bakery/components/cart-drawer.tsx +0 -14
- package/templates/storefront-bakery/components/cart-pill.tsx +0 -36
- package/templates/storefront-bakery/components/category-grid.tsx +0 -28
- package/templates/storefront-bakery/components/collection-strip.tsx +0 -45
- package/templates/storefront-bakery/components/footer.tsx +0 -148
- package/templates/storefront-bakery/components/header.tsx +0 -43
- package/templates/storefront-bakery/components/hero.tsx +0 -25
- package/templates/storefront-bakery/components/nav-link.tsx +0 -20
- package/templates/storefront-bakery/components/policy-page.tsx +0 -49
- package/templates/storefront-bakery/components/product-modal.tsx +0 -104
- package/templates/storefront-bakery/components/providers.tsx +0 -35
- package/templates/storefront-bakery/components/store-product-card.tsx +0 -87
- package/templates/storefront-bakery/lib/brand.ts +0 -570
- package/templates/storefront-bakery/lib/cart.ts +0 -12
- package/templates/storefront-bakery/next.config.ts +0 -42
- package/templates/storefront-bakery/package.json +0 -35
- package/templates/storefront-bakery/postcss.config.mjs +0 -7
- package/templates/storefront-bakery/tsconfig.json +0 -23
- package/templates/storefront-bakery/vitest.config.ts +0 -9
- package/templates/storefront-fashion/.claude/skills/cimplify-storefront/SKILL.md +0 -145
- package/templates/storefront-fashion/.cursor/rules/cimplify-storefront.mdc +0 -25
- package/templates/storefront-fashion/.env.example +0 -16
- package/templates/storefront-fashion/AGENTS.md +0 -126
- package/templates/storefront-fashion/CLAUDE.md +0 -22
- package/templates/storefront-fashion/README.md +0 -77
- package/templates/storefront-fashion/__tests__/brand.test.ts +0 -4
- package/templates/storefront-fashion/__tests__/cart-flow.test.ts +0 -55
- package/templates/storefront-fashion/__tests__/contract.test.ts +0 -4
- package/templates/storefront-fashion/app/about/page.tsx +0 -41
- package/templates/storefront-fashion/app/accessibility/page.tsx +0 -11
- package/templates/storefront-fashion/app/account/addresses/page.tsx +0 -21
- package/templates/storefront-fashion/app/account/orders/page.tsx +0 -21
- package/templates/storefront-fashion/app/account/page.tsx +0 -22
- package/templates/storefront-fashion/app/account/settings/page.tsx +0 -21
- package/templates/storefront-fashion/app/cart/page.tsx +0 -9
- package/templates/storefront-fashion/app/categories/[slug]/listing-client.tsx +0 -19
- package/templates/storefront-fashion/app/categories/[slug]/page.tsx +0 -130
- package/templates/storefront-fashion/app/checkout/page.tsx +0 -17
- package/templates/storefront-fashion/app/collections/[slug]/listing-client.tsx +0 -20
- package/templates/storefront-fashion/app/collections/[slug]/page.tsx +0 -130
- package/templates/storefront-fashion/app/contact/contact-form.tsx +0 -109
- package/templates/storefront-fashion/app/contact/page.tsx +0 -54
- package/templates/storefront-fashion/app/error.tsx +0 -61
- package/templates/storefront-fashion/app/faq/page.tsx +0 -46
- package/templates/storefront-fashion/app/globals.css +0 -46
- package/templates/storefront-fashion/app/layout.tsx +0 -78
- package/templates/storefront-fashion/app/llms.txt/route.ts +0 -94
- package/templates/storefront-fashion/app/login/page.tsx +0 -17
- package/templates/storefront-fashion/app/lookbook/page.tsx +0 -132
- package/templates/storefront-fashion/app/not-found.tsx +0 -39
- package/templates/storefront-fashion/app/opensearch.xml/route.ts +0 -37
- package/templates/storefront-fashion/app/orders/[id]/page.tsx +0 -24
- package/templates/storefront-fashion/app/page.tsx +0 -183
- package/templates/storefront-fashion/app/privacy/page.tsx +0 -44
- package/templates/storefront-fashion/app/products/[slug]/page.tsx +0 -165
- package/templates/storefront-fashion/app/products/[slug]/product-detail.tsx +0 -70
- package/templates/storefront-fashion/app/returns/page.tsx +0 -11
- package/templates/storefront-fashion/app/robots.ts +0 -18
- package/templates/storefront-fashion/app/search/page.tsx +0 -38
- package/templates/storefront-fashion/app/search/search-client.tsx +0 -7
- package/templates/storefront-fashion/app/shipping/page.tsx +0 -16
- package/templates/storefront-fashion/app/shop/page.tsx +0 -63
- package/templates/storefront-fashion/app/shop/shop-client.tsx +0 -32
- package/templates/storefront-fashion/app/signup/page.tsx +0 -17
- package/templates/storefront-fashion/app/sitemap-page/page.tsx +0 -167
- package/templates/storefront-fashion/app/sitemap.ts +0 -59
- package/templates/storefront-fashion/app/size-guide/page.tsx +0 -155
- package/templates/storefront-fashion/app/terms/page.tsx +0 -44
- package/templates/storefront-fashion/app/track-order/page.tsx +0 -24
- package/templates/storefront-fashion/app/track-order/track-order-form.tsx +0 -69
- package/templates/storefront-fashion/components/account-iframe.tsx +0 -13
- package/templates/storefront-fashion/components/brand-marquee.tsx +0 -27
- package/templates/storefront-fashion/components/cart-drawer.tsx +0 -14
- package/templates/storefront-fashion/components/cart-pill.tsx +0 -36
- package/templates/storefront-fashion/components/category-grid.tsx +0 -28
- package/templates/storefront-fashion/components/category-tiles.tsx +0 -104
- package/templates/storefront-fashion/components/collection-strip.tsx +0 -45
- package/templates/storefront-fashion/components/feature-hero.tsx +0 -82
- package/templates/storefront-fashion/components/footer.tsx +0 -153
- package/templates/storefront-fashion/components/header.tsx +0 -43
- package/templates/storefront-fashion/components/hero.tsx +0 -28
- package/templates/storefront-fashion/components/nav-link.tsx +0 -20
- package/templates/storefront-fashion/components/newsletter.tsx +0 -50
- package/templates/storefront-fashion/components/policy-page.tsx +0 -49
- package/templates/storefront-fashion/components/promo-banner.tsx +0 -41
- package/templates/storefront-fashion/components/providers.tsx +0 -35
- package/templates/storefront-fashion/components/section-heading.tsx +0 -37
- package/templates/storefront-fashion/components/store-product-card.tsx +0 -87
- package/templates/storefront-fashion/components/trade-in-cta.tsx +0 -54
- package/templates/storefront-fashion/components/trust-bar.tsx +0 -66
- package/templates/storefront-fashion/e2e/visual.spec.ts +0 -52
- package/templates/storefront-fashion/lib/brand.ts +0 -518
- package/templates/storefront-fashion/lib/cart.ts +0 -12
- package/templates/storefront-fashion/next.config.ts +0 -42
- package/templates/storefront-fashion/package.json +0 -38
- package/templates/storefront-fashion/playwright.config.ts +0 -48
- package/templates/storefront-fashion/postcss.config.mjs +0 -7
- package/templates/storefront-fashion/tsconfig.json +0 -23
- package/templates/storefront-fashion/vitest.config.ts +0 -9
- package/templates/storefront-grocery/.claude/skills/cimplify-storefront/SKILL.md +0 -145
- package/templates/storefront-grocery/.cursor/rules/cimplify-storefront.mdc +0 -25
- package/templates/storefront-grocery/.env.example +0 -16
- package/templates/storefront-grocery/AGENTS.md +0 -96
- package/templates/storefront-grocery/CLAUDE.md +0 -22
- package/templates/storefront-grocery/README.md +0 -73
- package/templates/storefront-grocery/__tests__/brand.test.ts +0 -4
- package/templates/storefront-grocery/__tests__/cart-flow.test.ts +0 -4
- package/templates/storefront-grocery/__tests__/contract.test.ts +0 -4
- package/templates/storefront-grocery/app/about/page.tsx +0 -38
- package/templates/storefront-grocery/app/accessibility/page.tsx +0 -11
- package/templates/storefront-grocery/app/account/addresses/page.tsx +0 -21
- package/templates/storefront-grocery/app/account/orders/page.tsx +0 -21
- package/templates/storefront-grocery/app/account/page.tsx +0 -22
- package/templates/storefront-grocery/app/account/settings/page.tsx +0 -21
- package/templates/storefront-grocery/app/cart/page.tsx +0 -9
- package/templates/storefront-grocery/app/categories/[slug]/listing-client.tsx +0 -19
- package/templates/storefront-grocery/app/categories/[slug]/page.tsx +0 -118
- package/templates/storefront-grocery/app/checkout/page.tsx +0 -17
- package/templates/storefront-grocery/app/collections/[slug]/listing-client.tsx +0 -20
- package/templates/storefront-grocery/app/collections/[slug]/page.tsx +0 -118
- package/templates/storefront-grocery/app/contact/contact-form.tsx +0 -109
- package/templates/storefront-grocery/app/contact/page.tsx +0 -54
- package/templates/storefront-grocery/app/error.tsx +0 -60
- package/templates/storefront-grocery/app/faq/page.tsx +0 -46
- package/templates/storefront-grocery/app/globals.css +0 -45
- package/templates/storefront-grocery/app/layout.tsx +0 -77
- package/templates/storefront-grocery/app/llms.txt/route.ts +0 -94
- package/templates/storefront-grocery/app/login/page.tsx +0 -17
- package/templates/storefront-grocery/app/not-found.tsx +0 -39
- package/templates/storefront-grocery/app/opensearch.xml/route.ts +0 -37
- package/templates/storefront-grocery/app/orders/[id]/page.tsx +0 -21
- package/templates/storefront-grocery/app/page.tsx +0 -97
- package/templates/storefront-grocery/app/privacy/page.tsx +0 -44
- package/templates/storefront-grocery/app/returns/page.tsx +0 -11
- package/templates/storefront-grocery/app/robots.ts +0 -18
- package/templates/storefront-grocery/app/search/page.tsx +0 -38
- package/templates/storefront-grocery/app/search/search-client.tsx +0 -7
- package/templates/storefront-grocery/app/shipping/page.tsx +0 -16
- package/templates/storefront-grocery/app/shop/page.tsx +0 -31
- package/templates/storefront-grocery/app/shop/shop-client.tsx +0 -27
- package/templates/storefront-grocery/app/signup/page.tsx +0 -17
- package/templates/storefront-grocery/app/sitemap-page/page.tsx +0 -167
- package/templates/storefront-grocery/app/sitemap.ts +0 -62
- package/templates/storefront-grocery/app/terms/page.tsx +0 -44
- package/templates/storefront-grocery/app/track-order/page.tsx +0 -24
- package/templates/storefront-grocery/app/track-order/track-order-form.tsx +0 -69
- package/templates/storefront-grocery/components/account-iframe.tsx +0 -13
- package/templates/storefront-grocery/components/cart-drawer.tsx +0 -14
- package/templates/storefront-grocery/components/cart-pill.tsx +0 -36
- package/templates/storefront-grocery/components/category-grid.tsx +0 -28
- package/templates/storefront-grocery/components/collection-strip.tsx +0 -45
- package/templates/storefront-grocery/components/footer.tsx +0 -148
- package/templates/storefront-grocery/components/header.tsx +0 -43
- package/templates/storefront-grocery/components/hero.tsx +0 -25
- package/templates/storefront-grocery/components/nav-link.tsx +0 -20
- package/templates/storefront-grocery/components/policy-page.tsx +0 -49
- package/templates/storefront-grocery/components/product-modal.tsx +0 -104
- package/templates/storefront-grocery/components/providers.tsx +0 -35
- package/templates/storefront-grocery/components/store-product-card.tsx +0 -87
- package/templates/storefront-grocery/lib/brand.ts +0 -375
- package/templates/storefront-grocery/lib/cart.ts +0 -12
- package/templates/storefront-grocery/next.config.ts +0 -42
- package/templates/storefront-grocery/package.json +0 -35
- package/templates/storefront-grocery/postcss.config.mjs +0 -7
- package/templates/storefront-grocery/tsconfig.json +0 -23
- package/templates/storefront-grocery/vitest.config.ts +0 -9
- package/templates/storefront-restaurant/.claude/skills/cimplify-storefront/SKILL.md +0 -145
- package/templates/storefront-restaurant/.cursor/rules/cimplify-storefront.mdc +0 -25
- package/templates/storefront-restaurant/.env.example +0 -16
- package/templates/storefront-restaurant/AGENTS.md +0 -102
- package/templates/storefront-restaurant/CLAUDE.md +0 -22
- package/templates/storefront-restaurant/README.md +0 -73
- package/templates/storefront-restaurant/__tests__/brand.test.ts +0 -4
- package/templates/storefront-restaurant/__tests__/cart-flow.test.ts +0 -4
- package/templates/storefront-restaurant/__tests__/contract.test.ts +0 -4
- package/templates/storefront-restaurant/app/about/page.tsx +0 -38
- package/templates/storefront-restaurant/app/accessibility/page.tsx +0 -11
- package/templates/storefront-restaurant/app/account/addresses/page.tsx +0 -21
- package/templates/storefront-restaurant/app/account/orders/page.tsx +0 -21
- package/templates/storefront-restaurant/app/account/page.tsx +0 -22
- package/templates/storefront-restaurant/app/account/settings/page.tsx +0 -21
- package/templates/storefront-restaurant/app/cart/page.tsx +0 -9
- package/templates/storefront-restaurant/app/categories/[slug]/listing-client.tsx +0 -19
- package/templates/storefront-restaurant/app/categories/[slug]/page.tsx +0 -118
- package/templates/storefront-restaurant/app/checkout/page.tsx +0 -17
- package/templates/storefront-restaurant/app/collections/[slug]/listing-client.tsx +0 -20
- package/templates/storefront-restaurant/app/collections/[slug]/page.tsx +0 -118
- package/templates/storefront-restaurant/app/contact/contact-form.tsx +0 -109
- package/templates/storefront-restaurant/app/contact/page.tsx +0 -54
- package/templates/storefront-restaurant/app/error.tsx +0 -60
- package/templates/storefront-restaurant/app/faq/page.tsx +0 -46
- package/templates/storefront-restaurant/app/globals.css +0 -44
- package/templates/storefront-restaurant/app/layout.tsx +0 -82
- package/templates/storefront-restaurant/app/llms.txt/route.ts +0 -94
- package/templates/storefront-restaurant/app/login/page.tsx +0 -17
- package/templates/storefront-restaurant/app/not-found.tsx +0 -39
- package/templates/storefront-restaurant/app/opensearch.xml/route.ts +0 -37
- package/templates/storefront-restaurant/app/orders/[id]/page.tsx +0 -21
- package/templates/storefront-restaurant/app/page.tsx +0 -97
- package/templates/storefront-restaurant/app/privacy/page.tsx +0 -44
- package/templates/storefront-restaurant/app/reservations/page.tsx +0 -66
- package/templates/storefront-restaurant/app/reservations/reservations-client.tsx +0 -234
- package/templates/storefront-restaurant/app/returns/page.tsx +0 -11
- package/templates/storefront-restaurant/app/robots.ts +0 -18
- package/templates/storefront-restaurant/app/search/page.tsx +0 -38
- package/templates/storefront-restaurant/app/search/search-client.tsx +0 -7
- package/templates/storefront-restaurant/app/shipping/page.tsx +0 -16
- package/templates/storefront-restaurant/app/shop/page.tsx +0 -31
- package/templates/storefront-restaurant/app/shop/shop-client.tsx +0 -27
- package/templates/storefront-restaurant/app/signup/page.tsx +0 -17
- package/templates/storefront-restaurant/app/sitemap-page/page.tsx +0 -167
- package/templates/storefront-restaurant/app/sitemap.ts +0 -62
- package/templates/storefront-restaurant/app/terms/page.tsx +0 -44
- package/templates/storefront-restaurant/app/track-order/page.tsx +0 -24
- package/templates/storefront-restaurant/app/track-order/track-order-form.tsx +0 -69
- package/templates/storefront-restaurant/components/account-iframe.tsx +0 -13
- package/templates/storefront-restaurant/components/cart-drawer.tsx +0 -14
- package/templates/storefront-restaurant/components/cart-pill.tsx +0 -36
- package/templates/storefront-restaurant/components/category-grid.tsx +0 -28
- package/templates/storefront-restaurant/components/collection-strip.tsx +0 -45
- package/templates/storefront-restaurant/components/footer.tsx +0 -148
- package/templates/storefront-restaurant/components/header.tsx +0 -43
- package/templates/storefront-restaurant/components/hero.tsx +0 -25
- package/templates/storefront-restaurant/components/nav-link.tsx +0 -20
- package/templates/storefront-restaurant/components/policy-page.tsx +0 -49
- package/templates/storefront-restaurant/components/product-modal.tsx +0 -104
- package/templates/storefront-restaurant/components/providers.tsx +0 -35
- package/templates/storefront-restaurant/components/store-product-card.tsx +0 -87
- package/templates/storefront-restaurant/lib/brand.ts +0 -377
- package/templates/storefront-restaurant/lib/cart.ts +0 -12
- package/templates/storefront-restaurant/next.config.ts +0 -42
- package/templates/storefront-restaurant/package.json +0 -35
- package/templates/storefront-restaurant/postcss.config.mjs +0 -7
- package/templates/storefront-restaurant/tsconfig.json +0 -23
- package/templates/storefront-restaurant/vitest.config.ts +0 -9
- package/templates/storefront-retail/.claude/skills/cimplify-storefront/SKILL.md +0 -145
- package/templates/storefront-retail/.cursor/rules/cimplify-storefront.mdc +0 -25
- package/templates/storefront-retail/.env.example +0 -16
- package/templates/storefront-retail/AGENTS.md +0 -117
- package/templates/storefront-retail/CLAUDE.md +0 -22
- package/templates/storefront-retail/README.md +0 -77
- package/templates/storefront-retail/__tests__/brand.test.ts +0 -4
- package/templates/storefront-retail/__tests__/cart-flow.test.ts +0 -4
- package/templates/storefront-retail/__tests__/contract.test.ts +0 -4
- package/templates/storefront-retail/app/about/page.tsx +0 -41
- package/templates/storefront-retail/app/accessibility/page.tsx +0 -11
- package/templates/storefront-retail/app/account/addresses/page.tsx +0 -21
- package/templates/storefront-retail/app/account/orders/page.tsx +0 -21
- package/templates/storefront-retail/app/account/page.tsx +0 -22
- package/templates/storefront-retail/app/account/settings/page.tsx +0 -21
- package/templates/storefront-retail/app/cart/page.tsx +0 -9
- package/templates/storefront-retail/app/categories/[slug]/listing-client.tsx +0 -19
- package/templates/storefront-retail/app/categories/[slug]/page.tsx +0 -130
- package/templates/storefront-retail/app/checkout/page.tsx +0 -17
- package/templates/storefront-retail/app/collections/[slug]/listing-client.tsx +0 -20
- package/templates/storefront-retail/app/collections/[slug]/page.tsx +0 -130
- package/templates/storefront-retail/app/contact/contact-form.tsx +0 -109
- package/templates/storefront-retail/app/contact/page.tsx +0 -54
- package/templates/storefront-retail/app/error.tsx +0 -61
- package/templates/storefront-retail/app/faq/page.tsx +0 -46
- package/templates/storefront-retail/app/globals.css +0 -47
- package/templates/storefront-retail/app/layout.tsx +0 -77
- package/templates/storefront-retail/app/llms.txt/route.ts +0 -94
- package/templates/storefront-retail/app/login/page.tsx +0 -17
- package/templates/storefront-retail/app/not-found.tsx +0 -39
- package/templates/storefront-retail/app/opensearch.xml/route.ts +0 -37
- package/templates/storefront-retail/app/orders/[id]/page.tsx +0 -24
- package/templates/storefront-retail/app/page.tsx +0 -182
- package/templates/storefront-retail/app/privacy/page.tsx +0 -44
- package/templates/storefront-retail/app/products/[slug]/page.tsx +0 -165
- package/templates/storefront-retail/app/products/[slug]/product-detail.tsx +0 -70
- package/templates/storefront-retail/app/returns/page.tsx +0 -11
- package/templates/storefront-retail/app/robots.ts +0 -18
- package/templates/storefront-retail/app/search/page.tsx +0 -38
- package/templates/storefront-retail/app/search/search-client.tsx +0 -7
- package/templates/storefront-retail/app/shipping/page.tsx +0 -16
- package/templates/storefront-retail/app/shop/page.tsx +0 -63
- package/templates/storefront-retail/app/shop/shop-client.tsx +0 -32
- package/templates/storefront-retail/app/signup/page.tsx +0 -17
- package/templates/storefront-retail/app/sitemap-page/page.tsx +0 -167
- package/templates/storefront-retail/app/sitemap.ts +0 -59
- package/templates/storefront-retail/app/terms/page.tsx +0 -44
- package/templates/storefront-retail/app/track-order/page.tsx +0 -24
- package/templates/storefront-retail/app/track-order/track-order-form.tsx +0 -69
- package/templates/storefront-retail/components/account-iframe.tsx +0 -13
- package/templates/storefront-retail/components/brand-marquee.tsx +0 -27
- package/templates/storefront-retail/components/cart-drawer.tsx +0 -14
- package/templates/storefront-retail/components/cart-pill.tsx +0 -36
- package/templates/storefront-retail/components/category-grid.tsx +0 -28
- package/templates/storefront-retail/components/category-tiles.tsx +0 -104
- package/templates/storefront-retail/components/collection-strip.tsx +0 -45
- package/templates/storefront-retail/components/feature-hero.tsx +0 -84
- package/templates/storefront-retail/components/footer.tsx +0 -153
- package/templates/storefront-retail/components/header.tsx +0 -45
- package/templates/storefront-retail/components/hero.tsx +0 -28
- package/templates/storefront-retail/components/nav-link.tsx +0 -20
- package/templates/storefront-retail/components/newsletter.tsx +0 -50
- package/templates/storefront-retail/components/policy-page.tsx +0 -49
- package/templates/storefront-retail/components/promo-banner.tsx +0 -41
- package/templates/storefront-retail/components/providers.tsx +0 -35
- package/templates/storefront-retail/components/section-heading.tsx +0 -37
- package/templates/storefront-retail/components/store-product-card.tsx +0 -87
- package/templates/storefront-retail/components/trade-in-cta.tsx +0 -54
- package/templates/storefront-retail/components/trust-bar.tsx +0 -66
- package/templates/storefront-retail/lib/brand.ts +0 -664
- package/templates/storefront-retail/lib/cart.ts +0 -12
- package/templates/storefront-retail/next.config.ts +0 -42
- package/templates/storefront-retail/package.json +0 -35
- package/templates/storefront-retail/postcss.config.mjs +0 -7
- package/templates/storefront-retail/tsconfig.json +0 -23
- package/templates/storefront-retail/vitest.config.ts +0 -9
- package/templates/storefront-services/.claude/skills/cimplify-storefront/SKILL.md +0 -145
- package/templates/storefront-services/.cursor/rules/cimplify-storefront.mdc +0 -25
- package/templates/storefront-services/.env.example +0 -16
- package/templates/storefront-services/AGENTS.md +0 -101
- package/templates/storefront-services/CLAUDE.md +0 -22
- package/templates/storefront-services/README.md +0 -73
- package/templates/storefront-services/__tests__/brand.test.ts +0 -4
- package/templates/storefront-services/__tests__/cart-flow.test.ts +0 -4
- package/templates/storefront-services/__tests__/contract.test.ts +0 -4
- package/templates/storefront-services/app/about/page.tsx +0 -38
- package/templates/storefront-services/app/accessibility/page.tsx +0 -11
- package/templates/storefront-services/app/account/addresses/page.tsx +0 -21
- package/templates/storefront-services/app/account/orders/page.tsx +0 -21
- package/templates/storefront-services/app/account/page.tsx +0 -22
- package/templates/storefront-services/app/account/settings/page.tsx +0 -21
- package/templates/storefront-services/app/book/book-client.tsx +0 -195
- package/templates/storefront-services/app/book/page.tsx +0 -65
- package/templates/storefront-services/app/cart/page.tsx +0 -9
- package/templates/storefront-services/app/categories/[slug]/listing-client.tsx +0 -19
- package/templates/storefront-services/app/categories/[slug]/page.tsx +0 -118
- package/templates/storefront-services/app/checkout/page.tsx +0 -17
- package/templates/storefront-services/app/collections/[slug]/listing-client.tsx +0 -20
- package/templates/storefront-services/app/collections/[slug]/page.tsx +0 -118
- package/templates/storefront-services/app/contact/contact-form.tsx +0 -109
- package/templates/storefront-services/app/contact/page.tsx +0 -54
- package/templates/storefront-services/app/error.tsx +0 -60
- package/templates/storefront-services/app/faq/page.tsx +0 -46
- package/templates/storefront-services/app/globals.css +0 -45
- package/templates/storefront-services/app/layout.tsx +0 -82
- package/templates/storefront-services/app/llms.txt/route.ts +0 -94
- package/templates/storefront-services/app/login/page.tsx +0 -17
- package/templates/storefront-services/app/not-found.tsx +0 -39
- package/templates/storefront-services/app/opensearch.xml/route.ts +0 -37
- package/templates/storefront-services/app/orders/[id]/page.tsx +0 -21
- package/templates/storefront-services/app/page.tsx +0 -97
- package/templates/storefront-services/app/privacy/page.tsx +0 -44
- package/templates/storefront-services/app/returns/page.tsx +0 -11
- package/templates/storefront-services/app/robots.ts +0 -18
- package/templates/storefront-services/app/search/page.tsx +0 -38
- package/templates/storefront-services/app/search/search-client.tsx +0 -7
- package/templates/storefront-services/app/shipping/page.tsx +0 -16
- package/templates/storefront-services/app/shop/page.tsx +0 -31
- package/templates/storefront-services/app/shop/shop-client.tsx +0 -27
- package/templates/storefront-services/app/signup/page.tsx +0 -17
- package/templates/storefront-services/app/sitemap-page/page.tsx +0 -167
- package/templates/storefront-services/app/sitemap.ts +0 -62
- package/templates/storefront-services/app/terms/page.tsx +0 -44
- package/templates/storefront-services/app/track-order/page.tsx +0 -24
- package/templates/storefront-services/app/track-order/track-order-form.tsx +0 -69
- package/templates/storefront-services/components/account-iframe.tsx +0 -13
- package/templates/storefront-services/components/cart-drawer.tsx +0 -14
- package/templates/storefront-services/components/cart-pill.tsx +0 -36
- package/templates/storefront-services/components/category-grid.tsx +0 -28
- package/templates/storefront-services/components/collection-strip.tsx +0 -45
- package/templates/storefront-services/components/footer.tsx +0 -148
- package/templates/storefront-services/components/header.tsx +0 -43
- package/templates/storefront-services/components/hero.tsx +0 -25
- package/templates/storefront-services/components/nav-link.tsx +0 -20
- package/templates/storefront-services/components/policy-page.tsx +0 -49
- package/templates/storefront-services/components/product-modal.tsx +0 -104
- package/templates/storefront-services/components/providers.tsx +0 -35
- package/templates/storefront-services/components/store-product-card.tsx +0 -87
- package/templates/storefront-services/lib/brand.ts +0 -396
- package/templates/storefront-services/lib/cart.ts +0 -12
- package/templates/storefront-services/next.config.ts +0 -42
- package/templates/storefront-services/package.json +0 -35
- package/templates/storefront-services/postcss.config.mjs +0 -7
- package/templates/storefront-services/tsconfig.json +0 -23
- package/templates/storefront-services/vitest.config.ts +0 -9
|
@@ -1,769 +0,0 @@
|
|
|
1
|
-
import { promises } from 'fs';
|
|
2
|
-
import os from 'os';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import readline from 'readline';
|
|
5
|
-
|
|
6
|
-
// src/cli/errors.ts
|
|
7
|
-
var CLI_ERROR_CODE = {
|
|
8
|
-
NOT_LOGGED_IN: "NOT_LOGGED_IN",
|
|
9
|
-
NOT_LINKED: "NOT_LINKED",
|
|
10
|
-
NETWORK_ERROR: "NETWORK_ERROR",
|
|
11
|
-
AUTH_FAILED: "AUTH_FAILED",
|
|
12
|
-
PROJECT_NOT_FOUND: "PROJECT_NOT_FOUND",
|
|
13
|
-
INVALID_INPUT: "INVALID_INPUT",
|
|
14
|
-
ALREADY_LINKED: "ALREADY_LINKED",
|
|
15
|
-
SERVER_ERROR: "SERVER_ERROR",
|
|
16
|
-
ABORTED: "ABORTED",
|
|
17
|
-
/** Operation needs interactive confirmation and the shell is non-interactive. */
|
|
18
|
-
INTERACTIVE_REQUIRED: "INTERACTIVE_REQUIRED"
|
|
19
|
-
};
|
|
20
|
-
var EXIT_CODE = {
|
|
21
|
-
ABORTED: 3,
|
|
22
|
-
NOT_LINKED: 4,
|
|
23
|
-
ALREADY_LINKED: 5,
|
|
24
|
-
GIT_ERROR: 6,
|
|
25
|
-
INTERACTIVE_REQUIRED: 7,
|
|
26
|
-
PROJECT_NOT_FOUND: 8,
|
|
27
|
-
NETWORK_ERROR: 10,
|
|
28
|
-
SERVER_ERROR: 11,
|
|
29
|
-
TIMEOUT: 12,
|
|
30
|
-
NOT_LOGGED_IN: 20,
|
|
31
|
-
AUTH_FAILED: 21,
|
|
32
|
-
UNAUTHORIZED: 22,
|
|
33
|
-
INVALID_INPUT: 30
|
|
34
|
-
};
|
|
35
|
-
var EXIT_CODE_FOR = {
|
|
36
|
-
NOT_LOGGED_IN: EXIT_CODE.NOT_LOGGED_IN,
|
|
37
|
-
NOT_LINKED: EXIT_CODE.NOT_LINKED,
|
|
38
|
-
NETWORK_ERROR: EXIT_CODE.NETWORK_ERROR,
|
|
39
|
-
AUTH_FAILED: EXIT_CODE.AUTH_FAILED,
|
|
40
|
-
PROJECT_NOT_FOUND: EXIT_CODE.PROJECT_NOT_FOUND,
|
|
41
|
-
GIT_ERROR: EXIT_CODE.GIT_ERROR,
|
|
42
|
-
INVALID_INPUT: EXIT_CODE.INVALID_INPUT,
|
|
43
|
-
ALREADY_LINKED: EXIT_CODE.ALREADY_LINKED,
|
|
44
|
-
SERVER_ERROR: EXIT_CODE.SERVER_ERROR,
|
|
45
|
-
ABORTED: EXIT_CODE.ABORTED,
|
|
46
|
-
UNAUTHORIZED: EXIT_CODE.UNAUTHORIZED,
|
|
47
|
-
TIMEOUT: EXIT_CODE.TIMEOUT,
|
|
48
|
-
INTERACTIVE_REQUIRED: EXIT_CODE.INTERACTIVE_REQUIRED
|
|
49
|
-
};
|
|
50
|
-
var CliError = class extends Error {
|
|
51
|
-
constructor(code, message, options = {}) {
|
|
52
|
-
super(message);
|
|
53
|
-
this.name = "CliError";
|
|
54
|
-
this.code = code;
|
|
55
|
-
this.exitCode = options.exitCode ?? EXIT_CODE_FOR[code];
|
|
56
|
-
this.remediation = options.remediation;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// src/cli/api-client.ts
|
|
61
|
-
var DEFAULT_API_BASE_URL = "https://api.cimplify.io";
|
|
62
|
-
var ENV_API_BASE_URL = "CIMPLIFY_API_URL";
|
|
63
|
-
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
64
|
-
var HEADER_AUTHORIZATION = "Authorization";
|
|
65
|
-
var HEADER_CONTENT_TYPE = "Content-Type";
|
|
66
|
-
var HEADER_ACCEPT = "Accept";
|
|
67
|
-
var HEADER_USER_AGENT = "User-Agent";
|
|
68
|
-
var BEARER_PREFIX = "Bearer ";
|
|
69
|
-
var CONTENT_TYPE_JSON = "application/json";
|
|
70
|
-
var USER_AGENT = "cimplify-cli";
|
|
71
|
-
var METHOD_GET = "GET";
|
|
72
|
-
var METHOD_POST = "POST";
|
|
73
|
-
var METHOD_PUT = "PUT";
|
|
74
|
-
var METHOD_DELETE = "DELETE";
|
|
75
|
-
var STATUS_UNAUTHORIZED = 401;
|
|
76
|
-
var STATUS_FORBIDDEN = 403;
|
|
77
|
-
var STATUS_NOT_FOUND = 404;
|
|
78
|
-
var STATUS_CONFLICT = 409;
|
|
79
|
-
var STATUS_BAD_REQUEST_MIN = 400;
|
|
80
|
-
var STATUS_SERVER_ERROR_MIN = 500;
|
|
81
|
-
var ApiClient = class _ApiClient {
|
|
82
|
-
constructor(baseUrl, apiKey) {
|
|
83
|
-
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
84
|
-
this.apiKey = apiKey;
|
|
85
|
-
}
|
|
86
|
-
static fromAuth(auth) {
|
|
87
|
-
return new _ApiClient(auth.apiBaseUrl, auth.apiKey);
|
|
88
|
-
}
|
|
89
|
-
static unauthenticated(baseUrl = resolveBaseUrl()) {
|
|
90
|
-
return new _ApiClient(baseUrl, "");
|
|
91
|
-
}
|
|
92
|
-
static withKey(apiKey, baseUrl = resolveBaseUrl()) {
|
|
93
|
-
return new _ApiClient(baseUrl, apiKey);
|
|
94
|
-
}
|
|
95
|
-
get(pathname, options) {
|
|
96
|
-
return this.request(METHOD_GET, pathname, void 0, options);
|
|
97
|
-
}
|
|
98
|
-
post(pathname, body, options) {
|
|
99
|
-
return this.request(METHOD_POST, pathname, body, options);
|
|
100
|
-
}
|
|
101
|
-
put(pathname, body, options) {
|
|
102
|
-
return this.request(METHOD_PUT, pathname, body, options);
|
|
103
|
-
}
|
|
104
|
-
delete(pathname, options) {
|
|
105
|
-
return this.request(METHOD_DELETE, pathname, void 0, options);
|
|
106
|
-
}
|
|
107
|
-
async request(method, pathname, body, options) {
|
|
108
|
-
const url = this.buildUrl(pathname, options?.query);
|
|
109
|
-
const headers = {
|
|
110
|
-
[HEADER_ACCEPT]: CONTENT_TYPE_JSON,
|
|
111
|
-
[HEADER_USER_AGENT]: USER_AGENT
|
|
112
|
-
};
|
|
113
|
-
if (this.apiKey) {
|
|
114
|
-
headers[HEADER_AUTHORIZATION] = `${BEARER_PREFIX}${this.apiKey}`;
|
|
115
|
-
}
|
|
116
|
-
let payload;
|
|
117
|
-
if (body !== void 0) {
|
|
118
|
-
headers[HEADER_CONTENT_TYPE] = CONTENT_TYPE_JSON;
|
|
119
|
-
payload = JSON.stringify(body);
|
|
120
|
-
}
|
|
121
|
-
const controller = new AbortController();
|
|
122
|
-
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
123
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
124
|
-
let response;
|
|
125
|
-
try {
|
|
126
|
-
response = await fetch(url, {
|
|
127
|
-
method,
|
|
128
|
-
headers,
|
|
129
|
-
body: payload,
|
|
130
|
-
signal: controller.signal
|
|
131
|
-
});
|
|
132
|
-
} catch (err) {
|
|
133
|
-
clearTimeout(timer);
|
|
134
|
-
throw toNetworkError(err);
|
|
135
|
-
}
|
|
136
|
-
clearTimeout(timer);
|
|
137
|
-
return parseResponse(response);
|
|
138
|
-
}
|
|
139
|
-
buildUrl(pathname, query) {
|
|
140
|
-
const base = pathname.startsWith("/") ? pathname : `/${pathname}`;
|
|
141
|
-
const url = new URL(`${this.baseUrl}${base}`);
|
|
142
|
-
if (query) {
|
|
143
|
-
for (const [k, v] of Object.entries(query)) {
|
|
144
|
-
if (v === void 0 || v === null) continue;
|
|
145
|
-
url.searchParams.set(k, String(v));
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return url.toString();
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
function resolveBaseUrl(override) {
|
|
152
|
-
const fromEnv = process.env[ENV_API_BASE_URL];
|
|
153
|
-
return fromEnv && fromEnv.length > 0 ? fromEnv : DEFAULT_API_BASE_URL;
|
|
154
|
-
}
|
|
155
|
-
async function parseResponse(response) {
|
|
156
|
-
const text = await response.text();
|
|
157
|
-
let body = void 0;
|
|
158
|
-
if (text.length > 0) {
|
|
159
|
-
try {
|
|
160
|
-
body = JSON.parse(text);
|
|
161
|
-
} catch {
|
|
162
|
-
throw new CliError(
|
|
163
|
-
CLI_ERROR_CODE.SERVER_ERROR,
|
|
164
|
-
`Server returned non-JSON response (status ${response.status}): ${truncate(text)}`
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
if (response.ok) {
|
|
169
|
-
if (body && typeof body === "object" && "data" in body) {
|
|
170
|
-
return body.data;
|
|
171
|
-
}
|
|
172
|
-
return body;
|
|
173
|
-
}
|
|
174
|
-
const code = mapStatusToCode(response.status);
|
|
175
|
-
const message = extractErrorMessage(body, response.status);
|
|
176
|
-
throw new CliError(code, message);
|
|
177
|
-
}
|
|
178
|
-
function mapStatusToCode(status) {
|
|
179
|
-
if (status === STATUS_UNAUTHORIZED) return CLI_ERROR_CODE.AUTH_FAILED;
|
|
180
|
-
if (status === STATUS_FORBIDDEN) return CLI_ERROR_CODE.AUTH_FAILED;
|
|
181
|
-
if (status === STATUS_NOT_FOUND) return CLI_ERROR_CODE.PROJECT_NOT_FOUND;
|
|
182
|
-
if (status === STATUS_CONFLICT) return CLI_ERROR_CODE.ALREADY_LINKED;
|
|
183
|
-
if (status >= STATUS_SERVER_ERROR_MIN) return CLI_ERROR_CODE.SERVER_ERROR;
|
|
184
|
-
if (status >= STATUS_BAD_REQUEST_MIN) return CLI_ERROR_CODE.INVALID_INPUT;
|
|
185
|
-
return CLI_ERROR_CODE.SERVER_ERROR;
|
|
186
|
-
}
|
|
187
|
-
function extractErrorMessage(body, status) {
|
|
188
|
-
if (body && typeof body === "object") {
|
|
189
|
-
const envelope = body;
|
|
190
|
-
if (envelope.error && typeof envelope.error.error_message === "string") {
|
|
191
|
-
return envelope.error.error_code ? `${envelope.error.error_code}: ${envelope.error.error_message}` : envelope.error.error_message;
|
|
192
|
-
}
|
|
193
|
-
if (typeof envelope.message === "string") return envelope.message;
|
|
194
|
-
}
|
|
195
|
-
return `HTTP ${status}`;
|
|
196
|
-
}
|
|
197
|
-
function toNetworkError(err) {
|
|
198
|
-
if (err instanceof DOMException && err.name === "AbortError") {
|
|
199
|
-
return new CliError(CLI_ERROR_CODE.NETWORK_ERROR, "Request timed out.");
|
|
200
|
-
}
|
|
201
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
202
|
-
return new CliError(CLI_ERROR_CODE.NETWORK_ERROR, `Network error: ${message}`);
|
|
203
|
-
}
|
|
204
|
-
function truncate(value, max = 200) {
|
|
205
|
-
return value.length > max ? `${value.slice(0, max)}\u2026` : value;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// src/cli/args.ts
|
|
209
|
-
function parseArgs(argv) {
|
|
210
|
-
const positional = [];
|
|
211
|
-
const flags = /* @__PURE__ */ new Map();
|
|
212
|
-
for (let i = 0; i < argv.length; i++) {
|
|
213
|
-
const arg = argv[i];
|
|
214
|
-
if (!arg.startsWith("--")) {
|
|
215
|
-
positional.push(arg);
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
|
-
const eq = arg.indexOf("=");
|
|
219
|
-
if (eq !== -1) {
|
|
220
|
-
flags.set(arg.slice(2, eq), arg.slice(eq + 1));
|
|
221
|
-
continue;
|
|
222
|
-
}
|
|
223
|
-
const name = arg.slice(2);
|
|
224
|
-
const next = argv[i + 1];
|
|
225
|
-
if (next !== void 0 && !next.startsWith("--")) {
|
|
226
|
-
flags.set(name, next);
|
|
227
|
-
i++;
|
|
228
|
-
} else {
|
|
229
|
-
flags.set(name, true);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
return { positional, flags };
|
|
233
|
-
}
|
|
234
|
-
function flagString(args, name) {
|
|
235
|
-
const v = args.flags.get(name);
|
|
236
|
-
return typeof v === "string" ? v : void 0;
|
|
237
|
-
}
|
|
238
|
-
function flagBool(args, name) {
|
|
239
|
-
return args.flags.has(name);
|
|
240
|
-
}
|
|
241
|
-
var AUTH_FILE_NAME = "auth.json";
|
|
242
|
-
var PROJECT_FILE_NAME = "project.json";
|
|
243
|
-
var PROJECT_DIR_NAME = ".cimplify";
|
|
244
|
-
var ENV_XDG_CONFIG_HOME = "XDG_CONFIG_HOME";
|
|
245
|
-
var APP_CONFIG_DIR_NAME = "cimplify";
|
|
246
|
-
var HOME_CONFIG_DIR_NAME = ".config";
|
|
247
|
-
var ENCODING_UTF8 = "utf8";
|
|
248
|
-
function authConfigDir() {
|
|
249
|
-
const xdg = process.env[ENV_XDG_CONFIG_HOME];
|
|
250
|
-
return xdg ? path.join(xdg, APP_CONFIG_DIR_NAME) : path.join(os.homedir(), HOME_CONFIG_DIR_NAME, APP_CONFIG_DIR_NAME);
|
|
251
|
-
}
|
|
252
|
-
function authConfigPath() {
|
|
253
|
-
return path.join(authConfigDir(), AUTH_FILE_NAME);
|
|
254
|
-
}
|
|
255
|
-
function projectConfigDir(cwd = process.cwd()) {
|
|
256
|
-
return path.join(cwd, PROJECT_DIR_NAME);
|
|
257
|
-
}
|
|
258
|
-
function projectConfigPath(cwd = process.cwd()) {
|
|
259
|
-
return path.join(projectConfigDir(cwd), PROJECT_FILE_NAME);
|
|
260
|
-
}
|
|
261
|
-
async function readJsonFile(filePath) {
|
|
262
|
-
try {
|
|
263
|
-
const raw = await promises.readFile(filePath, ENCODING_UTF8);
|
|
264
|
-
return JSON.parse(raw);
|
|
265
|
-
} catch (err) {
|
|
266
|
-
if (err.code === "ENOENT") return null;
|
|
267
|
-
throw err;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
async function readAuth() {
|
|
271
|
-
const data = await readJsonFile(authConfigPath());
|
|
272
|
-
if (!data) {
|
|
273
|
-
throw new CliError(
|
|
274
|
-
CLI_ERROR_CODE.NOT_LOGGED_IN,
|
|
275
|
-
"Not logged in. Run `cimplify login` first."
|
|
276
|
-
);
|
|
277
|
-
}
|
|
278
|
-
return data;
|
|
279
|
-
}
|
|
280
|
-
async function readProjectLink(cwd = process.cwd()) {
|
|
281
|
-
const data = await readJsonFile(projectConfigPath(cwd));
|
|
282
|
-
if (!data) {
|
|
283
|
-
throw new CliError(
|
|
284
|
-
CLI_ERROR_CODE.NOT_LINKED,
|
|
285
|
-
"No project linked. Run `cimplify link <project-id>` first."
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
return data;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// src/cli/output.ts
|
|
292
|
-
var RESET = "\x1B[0m";
|
|
293
|
-
var BOLD_OPEN = "\x1B[1m";
|
|
294
|
-
var DIM_OPEN = "\x1B[2m";
|
|
295
|
-
var GREEN_OPEN = "\x1B[32m";
|
|
296
|
-
var PREFIX_SUCCESS = "\u2713";
|
|
297
|
-
var ENV_JSON = "CIMPLIFY_JSON";
|
|
298
|
-
var ENV_YES = "CIMPLIFY_YES";
|
|
299
|
-
function envFlag(name) {
|
|
300
|
-
const v = process.env[name];
|
|
301
|
-
return v === "1" || v === "true";
|
|
302
|
-
}
|
|
303
|
-
function isJsonMode() {
|
|
304
|
-
return envFlag(ENV_JSON);
|
|
305
|
-
}
|
|
306
|
-
function isAutoYes() {
|
|
307
|
-
return envFlag(ENV_YES);
|
|
308
|
-
}
|
|
309
|
-
function isInteractive() {
|
|
310
|
-
return Boolean(process.stdout.isTTY) && Boolean(process.stdin.isTTY);
|
|
311
|
-
}
|
|
312
|
-
function wrap(open, value) {
|
|
313
|
-
return `${open}${value}${RESET}`;
|
|
314
|
-
}
|
|
315
|
-
function bold(value) {
|
|
316
|
-
return isJsonMode() ? value : wrap(BOLD_OPEN, value);
|
|
317
|
-
}
|
|
318
|
-
function dim(value) {
|
|
319
|
-
return isJsonMode() ? value : wrap(DIM_OPEN, value);
|
|
320
|
-
}
|
|
321
|
-
function green(value) {
|
|
322
|
-
return isJsonMode() ? value : wrap(GREEN_OPEN, value);
|
|
323
|
-
}
|
|
324
|
-
function success(message) {
|
|
325
|
-
if (isJsonMode()) return;
|
|
326
|
-
console.log(`${green(PREFIX_SUCCESS)} ${message}`);
|
|
327
|
-
}
|
|
328
|
-
function info(message) {
|
|
329
|
-
if (isJsonMode()) return;
|
|
330
|
-
console.log(message);
|
|
331
|
-
}
|
|
332
|
-
var ENV_EMITTED = "__CIMPLIFY_RESULT_EMITTED";
|
|
333
|
-
function result(data) {
|
|
334
|
-
if (!isJsonMode()) return;
|
|
335
|
-
if (process.env[ENV_EMITTED] === "1") return;
|
|
336
|
-
process.env[ENV_EMITTED] = "1";
|
|
337
|
-
process.stdout.write(`${JSON.stringify({ ok: true, data })}
|
|
338
|
-
`);
|
|
339
|
-
}
|
|
340
|
-
async function promptLine(question) {
|
|
341
|
-
if (!isInteractive()) {
|
|
342
|
-
throw new CliError(
|
|
343
|
-
CLI_ERROR_CODE.INTERACTIVE_REQUIRED,
|
|
344
|
-
"this operation needs interactive input but stdin is not a TTY",
|
|
345
|
-
{ remediation: "run interactively, or supply the value via a flag" }
|
|
346
|
-
);
|
|
347
|
-
}
|
|
348
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
349
|
-
try {
|
|
350
|
-
return await new Promise((resolve) => {
|
|
351
|
-
rl.question(question, (answer) => resolve(answer));
|
|
352
|
-
});
|
|
353
|
-
} finally {
|
|
354
|
-
rl.close();
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
async function promptYesNo(question, defaultNo = true) {
|
|
358
|
-
if (isAutoYes()) return true;
|
|
359
|
-
if (!isInteractive()) {
|
|
360
|
-
throw new CliError(
|
|
361
|
-
CLI_ERROR_CODE.INTERACTIVE_REQUIRED,
|
|
362
|
-
`this operation needs confirmation: ${question}`,
|
|
363
|
-
{ remediation: "re-run with --yes to accept, or run interactively" }
|
|
364
|
-
);
|
|
365
|
-
}
|
|
366
|
-
const suffix = defaultNo ? " [y/N] " : " [Y/n] ";
|
|
367
|
-
const answer = (await promptLine(`${question}${suffix}`)).trim().toLowerCase();
|
|
368
|
-
if (answer === "") return !defaultNo;
|
|
369
|
-
return answer === "y" || answer === "yes";
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
// src/cli/types.ts
|
|
373
|
-
var ENV_SCOPE = {
|
|
374
|
-
DEVELOPMENT: "development",
|
|
375
|
-
PREVIEW: "preview",
|
|
376
|
-
STAGING: "staging",
|
|
377
|
-
PRODUCTION: "production"
|
|
378
|
-
};
|
|
379
|
-
var DOMAIN_TYPE = {
|
|
380
|
-
CUSTOM: "custom",
|
|
381
|
-
CIMPLIFY: "cimplify"
|
|
382
|
-
};
|
|
383
|
-
var REPO_PROVIDER = {
|
|
384
|
-
FREESTYLE: "freestyle",
|
|
385
|
-
GITHUB: "github",
|
|
386
|
-
GITEA: "gitea",
|
|
387
|
-
EXTERNAL: "external"
|
|
388
|
-
};
|
|
389
|
-
new Set(Object.values(REPO_PROVIDER));
|
|
390
|
-
|
|
391
|
-
// src/cli/commands/domains.ts
|
|
392
|
-
var SUB_LS = "ls";
|
|
393
|
-
var SUB_LIST = "list";
|
|
394
|
-
var SUB_ADD = "add";
|
|
395
|
-
var SUB_VERIFY = "verify";
|
|
396
|
-
var SUB_RM = "rm";
|
|
397
|
-
var SUB_REMOVE = "remove";
|
|
398
|
-
var SUB_ATTACH = "attach";
|
|
399
|
-
var SUB_DETACH = "detach";
|
|
400
|
-
var SUB_PRIMARY = "primary";
|
|
401
|
-
var FLAG_TYPE = "type";
|
|
402
|
-
var FLAG_YES = "yes";
|
|
403
|
-
var FLAG_ENV = "env";
|
|
404
|
-
var FLAG_PRIMARY = "primary";
|
|
405
|
-
var FLAG_ATTACHED = "attached";
|
|
406
|
-
var ENV_SCOPE_VALUES = new Set(Object.values(ENV_SCOPE));
|
|
407
|
-
function resolveEnvScope(value, fallback = ENV_SCOPE.PRODUCTION) {
|
|
408
|
-
if (value === void 0) return fallback;
|
|
409
|
-
if (!ENV_SCOPE_VALUES.has(value)) {
|
|
410
|
-
throw new CliError(
|
|
411
|
-
CLI_ERROR_CODE.INVALID_INPUT,
|
|
412
|
-
`Invalid env "${value}". Choose: ${[...ENV_SCOPE_VALUES].join(", ")}.`
|
|
413
|
-
);
|
|
414
|
-
}
|
|
415
|
-
return value;
|
|
416
|
-
}
|
|
417
|
-
function projectDomainsEndpoint(businessId, projectId) {
|
|
418
|
-
return `/v1/businesses/${encodeURIComponent(businessId)}/projects/${encodeURIComponent(projectId)}/domains`;
|
|
419
|
-
}
|
|
420
|
-
function projectDomainItemEndpoint(businessId, projectId, attachmentId) {
|
|
421
|
-
return `${projectDomainsEndpoint(businessId, projectId)}/${encodeURIComponent(attachmentId)}`;
|
|
422
|
-
}
|
|
423
|
-
function projectDomainPrimaryEndpoint(businessId, projectId, attachmentId) {
|
|
424
|
-
return `${projectDomainItemEndpoint(businessId, projectId, attachmentId)}/primary`;
|
|
425
|
-
}
|
|
426
|
-
var COL_GAP = " ";
|
|
427
|
-
var COL_DOMAIN = "DOMAIN";
|
|
428
|
-
var COL_TYPE = "TYPE";
|
|
429
|
-
var COL_VERIFIED = "VERIFIED";
|
|
430
|
-
var COL_PRIMARY = "PRIMARY";
|
|
431
|
-
var COL_CREATED = "CREATED";
|
|
432
|
-
var DNS_COL_TYPE = "Type";
|
|
433
|
-
var DNS_COL_NAME = "Name";
|
|
434
|
-
var DNS_COL_VALUE = "Value";
|
|
435
|
-
var VALID_DOMAIN_TYPES = new Set(Object.values(DOMAIN_TYPE));
|
|
436
|
-
function domainsEndpoint(businessId) {
|
|
437
|
-
return `/v1/businesses/${encodeURIComponent(businessId)}/domains`;
|
|
438
|
-
}
|
|
439
|
-
function domainItemEndpoint(businessId, id) {
|
|
440
|
-
return `${domainsEndpoint(businessId)}/${encodeURIComponent(id)}`;
|
|
441
|
-
}
|
|
442
|
-
function domainVerifyEndpoint(businessId, id) {
|
|
443
|
-
return `${domainItemEndpoint(businessId, id)}/verify`;
|
|
444
|
-
}
|
|
445
|
-
function dnsRecordsEndpoint(domain) {
|
|
446
|
-
return `/v1/hosting/domains/${encodeURIComponent(domain)}/dns-records`;
|
|
447
|
-
}
|
|
448
|
-
function resolveDomainType(value) {
|
|
449
|
-
if (value === void 0) return DOMAIN_TYPE.CUSTOM;
|
|
450
|
-
if (!VALID_DOMAIN_TYPES.has(value)) {
|
|
451
|
-
throw new CliError(
|
|
452
|
-
CLI_ERROR_CODE.INVALID_INPUT,
|
|
453
|
-
`Invalid domain type "${value}". Choose: ${[...VALID_DOMAIN_TYPES].join(", ")}.`
|
|
454
|
-
);
|
|
455
|
-
}
|
|
456
|
-
return value;
|
|
457
|
-
}
|
|
458
|
-
async function run(argv) {
|
|
459
|
-
const args = parseArgs(argv);
|
|
460
|
-
const sub = args.positional[0];
|
|
461
|
-
if (!sub) {
|
|
462
|
-
throw new CliError(
|
|
463
|
-
CLI_ERROR_CODE.INVALID_INPUT,
|
|
464
|
-
`Usage: cimplify domains <${SUB_LS}|${SUB_ADD}|${SUB_VERIFY}|${SUB_RM}|${SUB_ATTACH}|${SUB_DETACH}|${SUB_PRIMARY}>`
|
|
465
|
-
);
|
|
466
|
-
}
|
|
467
|
-
const auth = await readAuth();
|
|
468
|
-
const client = ApiClient.fromAuth(auth);
|
|
469
|
-
if (sub === SUB_LS || sub === SUB_LIST) {
|
|
470
|
-
if (flagBool(args, FLAG_ATTACHED)) {
|
|
471
|
-
await listAttachedForCurrentProject(client, auth.businessId);
|
|
472
|
-
} else {
|
|
473
|
-
await listDomains(client, auth.businessId);
|
|
474
|
-
}
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
if (sub === SUB_ADD) {
|
|
478
|
-
await addDomain(client, auth.businessId, args);
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
if (sub === SUB_VERIFY) {
|
|
482
|
-
await verifyDomain(client, auth.businessId, args);
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
if (sub === SUB_RM || sub === SUB_REMOVE) {
|
|
486
|
-
await removeDomain(client, auth.businessId, args);
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
|
-
if (sub === SUB_ATTACH) {
|
|
490
|
-
await attachDomain(client, auth.businessId, args);
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
if (sub === SUB_DETACH) {
|
|
494
|
-
await detachDomain(client, auth.businessId, args);
|
|
495
|
-
return;
|
|
496
|
-
}
|
|
497
|
-
if (sub === SUB_PRIMARY) {
|
|
498
|
-
await setPrimaryAttachment(client, auth.businessId, args);
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
throw new CliError(CLI_ERROR_CODE.INVALID_INPUT, `Unknown domains subcommand "${sub}"`);
|
|
502
|
-
}
|
|
503
|
-
async function listDomains(client, businessId) {
|
|
504
|
-
const domains = await client.get(domainsEndpoint(businessId));
|
|
505
|
-
if (domains.length === 0) {
|
|
506
|
-
info(dim("No domains. Add one: cimplify domains add <domain>"));
|
|
507
|
-
result({ domains: [] });
|
|
508
|
-
return;
|
|
509
|
-
}
|
|
510
|
-
const domainWidth = Math.max(COL_DOMAIN.length, ...domains.map((d) => d.domain.length));
|
|
511
|
-
const typeWidth = Math.max(COL_TYPE.length, ...domains.map((d) => String(d.domain_type).length));
|
|
512
|
-
const verifiedWidth = COL_VERIFIED.length;
|
|
513
|
-
const primaryWidth = COL_PRIMARY.length;
|
|
514
|
-
info(
|
|
515
|
-
bold(
|
|
516
|
-
[
|
|
517
|
-
COL_DOMAIN.padEnd(domainWidth),
|
|
518
|
-
COL_TYPE.padEnd(typeWidth),
|
|
519
|
-
COL_VERIFIED.padEnd(verifiedWidth),
|
|
520
|
-
COL_PRIMARY.padEnd(primaryWidth),
|
|
521
|
-
COL_CREATED
|
|
522
|
-
].join(COL_GAP)
|
|
523
|
-
)
|
|
524
|
-
);
|
|
525
|
-
for (const d of domains) {
|
|
526
|
-
info(
|
|
527
|
-
[
|
|
528
|
-
d.domain.padEnd(domainWidth),
|
|
529
|
-
String(d.domain_type).padEnd(typeWidth),
|
|
530
|
-
(d.is_verified ? "yes" : "no").padEnd(verifiedWidth),
|
|
531
|
-
(d.is_primary ? "yes" : "no").padEnd(primaryWidth),
|
|
532
|
-
d.created_at ?? ""
|
|
533
|
-
].join(COL_GAP)
|
|
534
|
-
);
|
|
535
|
-
}
|
|
536
|
-
result({
|
|
537
|
-
domains: domains.map((d) => ({
|
|
538
|
-
id: d.id,
|
|
539
|
-
domain: d.domain,
|
|
540
|
-
domain_type: d.domain_type,
|
|
541
|
-
is_verified: d.is_verified,
|
|
542
|
-
is_primary: d.is_primary,
|
|
543
|
-
created_at: d.created_at ?? null
|
|
544
|
-
}))
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
async function addDomain(client, businessId, args) {
|
|
548
|
-
const domain = args.positional[1];
|
|
549
|
-
if (!domain) {
|
|
550
|
-
throw new CliError(
|
|
551
|
-
CLI_ERROR_CODE.INVALID_INPUT,
|
|
552
|
-
`Usage: cimplify domains add <domain> [--type=custom|cimplify]`
|
|
553
|
-
);
|
|
554
|
-
}
|
|
555
|
-
const domainType = resolveDomainType(flagString(args, FLAG_TYPE));
|
|
556
|
-
const body = { domain, domain_type: domainType };
|
|
557
|
-
const created = await client.post(domainsEndpoint(businessId), body);
|
|
558
|
-
success(`Added ${created.domain} (${created.domain_type})`);
|
|
559
|
-
let dnsRecords = null;
|
|
560
|
-
if (domainType === DOMAIN_TYPE.CUSTOM) {
|
|
561
|
-
try {
|
|
562
|
-
const dns = await client.get(dnsRecordsEndpoint(domain));
|
|
563
|
-
dnsRecords = Array.isArray(dns) ? dns : dns.records;
|
|
564
|
-
printDnsRecords(domain, dnsRecords);
|
|
565
|
-
} catch (err) {
|
|
566
|
-
info(dim(`(Could not fetch DNS records: ${err instanceof Error ? err.message : String(err)})`));
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
result({
|
|
570
|
-
domain: {
|
|
571
|
-
id: created.id,
|
|
572
|
-
domain: created.domain,
|
|
573
|
-
domain_type: created.domain_type,
|
|
574
|
-
is_verified: created.is_verified
|
|
575
|
-
},
|
|
576
|
-
dns_records: dnsRecords
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
function printDnsRecords(domain, records) {
|
|
580
|
-
if (!records || records.length === 0) {
|
|
581
|
-
info(dim("No DNS records returned."));
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
const typeWidth = Math.max(DNS_COL_TYPE.length, ...records.map((r) => r.type.length));
|
|
585
|
-
const nameWidth = Math.max(DNS_COL_NAME.length, ...records.map((r) => r.name.length));
|
|
586
|
-
const valueWidth = Math.max(DNS_COL_VALUE.length, ...records.map((r) => r.value.length));
|
|
587
|
-
info("");
|
|
588
|
-
info("Add the following DNS records:");
|
|
589
|
-
info("");
|
|
590
|
-
info(
|
|
591
|
-
` ${bold(DNS_COL_TYPE.padEnd(typeWidth))} ${bold(DNS_COL_NAME.padEnd(nameWidth))} ${bold(DNS_COL_VALUE)}`
|
|
592
|
-
);
|
|
593
|
-
info(
|
|
594
|
-
` ${"\u2500".repeat(typeWidth)} ${"\u2500".repeat(nameWidth)} ${"\u2500".repeat(Math.min(valueWidth, 40))}`
|
|
595
|
-
);
|
|
596
|
-
for (const r of records) {
|
|
597
|
-
info(` ${r.type.padEnd(typeWidth)} ${r.name.padEnd(nameWidth)} ${r.value}`);
|
|
598
|
-
}
|
|
599
|
-
info("");
|
|
600
|
-
info(`Then run: ${bold(`cimplify domains verify ${domain}`)}`);
|
|
601
|
-
}
|
|
602
|
-
async function verifyDomain(client, businessId, args) {
|
|
603
|
-
const domain = args.positional[1];
|
|
604
|
-
if (!domain) {
|
|
605
|
-
throw new CliError(
|
|
606
|
-
CLI_ERROR_CODE.INVALID_INPUT,
|
|
607
|
-
`Usage: cimplify domains verify <domain>`
|
|
608
|
-
);
|
|
609
|
-
}
|
|
610
|
-
const target = await findDomain(client, businessId, domain);
|
|
611
|
-
const verified = await client.post(domainVerifyEndpoint(businessId, target.id));
|
|
612
|
-
if (verified.is_verified) {
|
|
613
|
-
success(`Verified ${verified.domain}`);
|
|
614
|
-
} else {
|
|
615
|
-
info(dim(`Not yet verified \u2014 DNS may still be propagating. Try again in a few minutes.`));
|
|
616
|
-
}
|
|
617
|
-
result({ domain: verified.domain, verified: verified.is_verified });
|
|
618
|
-
}
|
|
619
|
-
async function removeDomain(client, businessId, args) {
|
|
620
|
-
const domain = args.positional[1];
|
|
621
|
-
if (!domain) {
|
|
622
|
-
throw new CliError(
|
|
623
|
-
CLI_ERROR_CODE.INVALID_INPUT,
|
|
624
|
-
`Usage: cimplify domains rm <domain> [--yes]`
|
|
625
|
-
);
|
|
626
|
-
}
|
|
627
|
-
const target = await findDomain(client, businessId, domain);
|
|
628
|
-
if (!flagBool(args, FLAG_YES)) {
|
|
629
|
-
const confirmed = await promptYesNo(`Remove ${domain}?`, true);
|
|
630
|
-
if (!confirmed) {
|
|
631
|
-
throw new CliError(CLI_ERROR_CODE.ABORTED, "Aborted by user.");
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
await client.delete(domainItemEndpoint(businessId, target.id));
|
|
635
|
-
success(`Removed ${domain}`);
|
|
636
|
-
result({ removed: true, domain });
|
|
637
|
-
}
|
|
638
|
-
async function findDomain(client, businessId, domain) {
|
|
639
|
-
const domains = await client.get(domainsEndpoint(businessId));
|
|
640
|
-
const match = domains.find((d) => d.domain === domain);
|
|
641
|
-
if (!match) {
|
|
642
|
-
throw new CliError(
|
|
643
|
-
CLI_ERROR_CODE.PROJECT_NOT_FOUND,
|
|
644
|
-
`Domain "${domain}" not found. List domains: cimplify domains ls`
|
|
645
|
-
);
|
|
646
|
-
}
|
|
647
|
-
return match;
|
|
648
|
-
}
|
|
649
|
-
async function attachDomain(client, businessId, args) {
|
|
650
|
-
const domain = args.positional[1];
|
|
651
|
-
if (!domain) {
|
|
652
|
-
throw new CliError(
|
|
653
|
-
CLI_ERROR_CODE.INVALID_INPUT,
|
|
654
|
-
`Usage: cimplify domains ${SUB_ATTACH} <domain> [--env=preview|production] [--primary]`
|
|
655
|
-
);
|
|
656
|
-
}
|
|
657
|
-
const link = await readProjectLink();
|
|
658
|
-
const target = await findDomain(client, businessId, domain);
|
|
659
|
-
if (!target.is_verified) {
|
|
660
|
-
throw new CliError(
|
|
661
|
-
CLI_ERROR_CODE.INVALID_INPUT,
|
|
662
|
-
`Domain "${domain}" is not verified. Run: cimplify domains verify ${domain}`
|
|
663
|
-
);
|
|
664
|
-
}
|
|
665
|
-
const envScope = resolveEnvScope(flagString(args, FLAG_ENV));
|
|
666
|
-
const isPrimary = flagBool(args, FLAG_PRIMARY);
|
|
667
|
-
const body = {
|
|
668
|
-
business_domain_id: target.id,
|
|
669
|
-
env_scope: envScope,
|
|
670
|
-
is_primary: isPrimary
|
|
671
|
-
};
|
|
672
|
-
await client.post(
|
|
673
|
-
projectDomainsEndpoint(businessId, link.projectId),
|
|
674
|
-
body
|
|
675
|
-
);
|
|
676
|
-
success(`Attached ${domain} to project for ${envScope}${isPrimary ? " (primary)" : ""}`);
|
|
677
|
-
info(dim("Next deploy will bind this domain. Run: cimplify deploy"));
|
|
678
|
-
result({ attached: true, domain, env: envScope, primary: isPrimary });
|
|
679
|
-
}
|
|
680
|
-
async function detachDomain(client, businessId, args) {
|
|
681
|
-
const domain = args.positional[1];
|
|
682
|
-
if (!domain) {
|
|
683
|
-
throw new CliError(
|
|
684
|
-
CLI_ERROR_CODE.INVALID_INPUT,
|
|
685
|
-
`Usage: cimplify domains ${SUB_DETACH} <domain> [--env=preview|production] [--yes]`
|
|
686
|
-
);
|
|
687
|
-
}
|
|
688
|
-
const link = await readProjectLink();
|
|
689
|
-
const envScope = resolveEnvScope(flagString(args, FLAG_ENV));
|
|
690
|
-
const attachment = await findAttachmentForCurrentProject(client, businessId, link.projectId, domain, envScope);
|
|
691
|
-
if (!flagBool(args, FLAG_YES)) {
|
|
692
|
-
const confirmed = await promptYesNo(`Detach ${domain} from this project (${envScope})?`, true);
|
|
693
|
-
if (!confirmed) {
|
|
694
|
-
throw new CliError(CLI_ERROR_CODE.ABORTED, "Aborted by user.");
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
await client.delete(projectDomainItemEndpoint(businessId, link.projectId, attachment.id));
|
|
698
|
-
success(`Detached ${domain} (${envScope})`);
|
|
699
|
-
info(dim("Next deploy will not bind this domain. Existing deployments continue serving until redeploy."));
|
|
700
|
-
result({ detached: true, domain, env: envScope });
|
|
701
|
-
}
|
|
702
|
-
async function setPrimaryAttachment(client, businessId, args) {
|
|
703
|
-
const domain = args.positional[1];
|
|
704
|
-
if (!domain) {
|
|
705
|
-
throw new CliError(
|
|
706
|
-
CLI_ERROR_CODE.INVALID_INPUT,
|
|
707
|
-
`Usage: cimplify domains ${SUB_PRIMARY} <domain> [--env=preview|production]`
|
|
708
|
-
);
|
|
709
|
-
}
|
|
710
|
-
const link = await readProjectLink();
|
|
711
|
-
const envScope = resolveEnvScope(flagString(args, FLAG_ENV));
|
|
712
|
-
const attachment = await findAttachmentForCurrentProject(client, businessId, link.projectId, domain, envScope);
|
|
713
|
-
await client.post(
|
|
714
|
-
projectDomainPrimaryEndpoint(businessId, link.projectId, attachment.id)
|
|
715
|
-
);
|
|
716
|
-
success(`Set ${domain} as primary for ${envScope}`);
|
|
717
|
-
result({ primary: true, domain, env: envScope });
|
|
718
|
-
}
|
|
719
|
-
async function listAttachedForCurrentProject(client, businessId) {
|
|
720
|
-
const link = await readProjectLink();
|
|
721
|
-
const attachments = await client.get(
|
|
722
|
-
projectDomainsEndpoint(businessId, link.projectId)
|
|
723
|
-
);
|
|
724
|
-
if (attachments.length === 0) {
|
|
725
|
-
info(dim("No domains attached to this project. Attach one: cimplify domains attach <domain>"));
|
|
726
|
-
result({ attached: [] });
|
|
727
|
-
return;
|
|
728
|
-
}
|
|
729
|
-
const domains = await client.get(domainsEndpoint(businessId));
|
|
730
|
-
const domainById = new Map(domains.map((d) => [d.id, d]));
|
|
731
|
-
info(bold(["DOMAIN", "ENV", "PRIMARY", "ATTACHED"].join(COL_GAP)));
|
|
732
|
-
for (const a of attachments) {
|
|
733
|
-
const bd = domainById.get(a.business_domain_id);
|
|
734
|
-
info(
|
|
735
|
-
[
|
|
736
|
-
bd?.domain ?? `<unknown:${a.business_domain_id}>`,
|
|
737
|
-
String(a.env_scope),
|
|
738
|
-
a.is_primary ? "yes" : "no",
|
|
739
|
-
a.attached_at
|
|
740
|
-
].join(COL_GAP)
|
|
741
|
-
);
|
|
742
|
-
}
|
|
743
|
-
result({
|
|
744
|
-
attached: attachments.map((a) => ({
|
|
745
|
-
attachment_id: a.id,
|
|
746
|
-
business_domain_id: a.business_domain_id,
|
|
747
|
-
domain: domainById.get(a.business_domain_id)?.domain ?? null,
|
|
748
|
-
env: a.env_scope,
|
|
749
|
-
primary: a.is_primary,
|
|
750
|
-
attached_at: a.attached_at
|
|
751
|
-
}))
|
|
752
|
-
});
|
|
753
|
-
}
|
|
754
|
-
async function findAttachmentForCurrentProject(client, businessId, projectId, domain, envScope) {
|
|
755
|
-
const target = await findDomain(client, businessId, domain);
|
|
756
|
-
const attachments = await client.get(projectDomainsEndpoint(businessId, projectId));
|
|
757
|
-
const match = attachments.find(
|
|
758
|
-
(a) => a.business_domain_id === target.id && a.env_scope === envScope
|
|
759
|
-
);
|
|
760
|
-
if (!match) {
|
|
761
|
-
throw new CliError(
|
|
762
|
-
CLI_ERROR_CODE.PROJECT_NOT_FOUND,
|
|
763
|
-
`${domain} is not attached to this project for env "${envScope}". List attached: cimplify domains ls --attached`
|
|
764
|
-
);
|
|
765
|
-
}
|
|
766
|
-
return match;
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
export { run as default, printDnsRecords };
|