Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
1994900
refactor(monorepo): split @decocms/start into a bun workspace monorep…
tlgimenes Jul 7, 2026
f7c53e6
refactor(monorepo): rename @decocms/live -> @decocms/blocks (per CEO …
tlgimenes Jul 7, 2026
5b3739b
refactor(monorepo): rename @decocms/admin -> @decocms/blocks-admin, @…
tlgimenes Jul 7, 2026
b38a35f
fix(test): disambiguate @decocms/blocks's vitest path from blocks-adm…
tlgimenes Jul 7, 2026
4ab52e4
ci(release): pause v7 push trigger until npm create-package rights ar…
tlgimenes Jul 7, 2026
94eedd1
refactor(monorepo): rename @decocms/next -> @decocms/nextjs for expli…
tlgimenes Jul 7, 2026
f05159c
ci(release): restore v7 push trigger now that npm auth actually works
tlgimenes Jul 7, 2026
e767ee6
ci(release): switch to npm Trusted Publishing (OIDC) instead of a sto…
tlgimenes Jul 7, 2026
cfa4ea0
fix(packages): add repository field required for npm provenance verif…
tlgimenes Jul 7, 2026
e020ccd
fix(blocks): raise @opentelemetry/semantic-conventions floor to ^1.41.1
tlgimenes Jul 7, 2026
36c0cfb
feat(blocks): split cms/client from the cms barrel for browser-safe i…
tlgimenes Jul 7, 2026
5d7f2d5
fix(tanstack): use cms/client in DecoPageRenderer; docs for the cms b…
tlgimenes Jul 7, 2026
db69fef
fix(blocks): break circular import between sdk/otel.ts and sdk/observ…
tlgimenes Jul 7, 2026
37e4c1c
docs: design for merging @decocms/apps into the blocks monorepo
tlgimenes Jul 7, 2026
f5936e2
docs: resolve open decision - UI components move to blocks/hooks
tlgimenes Jul 7, 2026
8d4a5b0
docs: implementation plan for merging @decocms/apps into the blocks m…
tlgimenes Jul 7, 2026
5ee6036
feat(scripts): add apps-start import-rewrite tool for the monorepo merge
tlgimenes Jul 7, 2026
0104e03
docs(apps-migration): confirm @decocms/start/apps -> @decocms/blocks-…
tlgimenes Jul 7, 2026
e7a1496
feat(apps-commerce): migrate commerce/ + registry.ts from apps-start
tlgimenes Jul 7, 2026
31c7ad4
docs(apps-migration): redesign registry.ts as types-only, per-platfor…
tlgimenes Jul 8, 2026
8c2f746
fix(apps-commerce): remove static APP_REGISTRY, keep only shared regi…
tlgimenes Jul 8, 2026
ecdb6e3
feat(blocks): add JsonLd/Image/Picture to hooks (moved from apps-star…
tlgimenes Jul 8, 2026
a564ed9
feat(blocks): port date matcher from apps-start
tlgimenes Jul 8, 2026
e0289d1
docs(apps-migration): skip site matcher (no multi-tenant concept exists)
tlgimenes Jul 8, 2026
34bee02
feat(blocks): add flags subpath (moved from apps-start website/flags)
tlgimenes Jul 8, 2026
625551a
fix(blocks): export ./flags/types subpath
tlgimenes Jul 8, 2026
e814ed0
feat(apps-website): migrate website/ from apps-start (matchers/flags …
tlgimenes Jul 8, 2026
0190788
chore: exempt apps-*/manifest.gen.ts from the blanket *.gen.ts gitignore
tlgimenes Jul 8, 2026
88c2512
docs(apps-migration): backfill registry.ts steps into Tasks 7/8/12/13
tlgimenes Jul 8, 2026
7cfbf1d
feat(apps-vtex): migrate vtex/ from apps-start; export createInvokeFn…
tlgimenes Jul 8, 2026
2df7e3c
fix(blocks-cli): update generate-invoke.ts for @decocms/apps-vtex's f…
tlgimenes Jul 8, 2026
c7604df
feat(apps-shopify): migrate shopify/ from apps-start
tlgimenes Jul 8, 2026
d0b2555
chore: exempt shopify's storefront.graphql.gen.ts from the blanket *.…
tlgimenes Jul 8, 2026
f66c63c
fix(apps-shopify): commit storefront.graphql.gen.ts missed by blanket…
tlgimenes Jul 8, 2026
0d6b507
feat(apps-magento): migrate magento/ from apps-start
tlgimenes Jul 8, 2026
e194803
chore: update bun.lock for @decocms/apps-magento
tlgimenes Jul 8, 2026
c2178dc
feat(apps-algolia): migrate algolia/ from apps-start
tlgimenes Jul 8, 2026
5703393
chore: update bun.lock for @decocms/apps-algolia
tlgimenes Jul 8, 2026
646bd94
feat(apps-salesforce): migrate salesforce/ from apps-start
tlgimenes Jul 8, 2026
72c6c54
chore: update bun.lock for @decocms/apps-salesforce
tlgimenes Jul 8, 2026
2923b84
feat(apps-resend): migrate resend/ from apps-start
tlgimenes Jul 8, 2026
ed82636
chore: update bun.lock for @decocms/apps-resend
tlgimenes Jul 8, 2026
493d1fd
feat(apps-blog): migrate blog/ from apps-start
tlgimenes Jul 8, 2026
d2d0485
fix(apps-salesforce): declare @tanstack/react-start peer dependency; …
tlgimenes Jul 8, 2026
f1dfaa3
fix(blocks-cli): update generate-schema.ts's app-loader scan for the …
tlgimenes Jul 8, 2026
f1a41af
chore: sync bun.lock with apps-salesforce's peerDependencies fix
tlgimenes Jul 8, 2026
3805f2f
fix(publish): add explicit files allowlist to packages shipping a man…
tlgimenes Jul 8, 2026
e93125e
fix(tanstack): add apps-vtex to the SSR noExternal forcing list
tlgimenes Jul 8, 2026
5bd6fc2
fix(tanstack): fix createServerFn crash under a real npm install (not…
tlgimenes Jul 8, 2026
e333dde
fix(matchers): wire Multi/Negate matcher fields to #/root/matchers ref
tlgimenes Jul 8, 2026
6c18cef
perf(blocks-cli): async, non-blocking file reads in generateBlocks
tlgimenes Jul 8, 2026
62b9a9f
fix(schema): recover widget aliases (Color, etc.) that resolve to any
tlgimenes Jul 8, 2026
050d3d1
feat(observability): unify metrics with deco-cx/deco semconv contract
tlgimenes Jul 8, 2026
ec1b630
feat(sdk): default outbound User-Agent + sticky A/B multivariate flags
tlgimenes Jul 8, 2026
1f3177d
fix(nextjs): admin route handlers crash with 'createContext is not a …
tlgimenes Jul 8, 2026
9a6b297
fix(blocks-cli): exclude test/spec/stories/gen files from codegen scans
tlgimenes Jul 8, 2026
1a321d6
fix(blocks-cli): repo-relative schema definition IDs, not absolute fi…
tlgimenes Jul 8, 2026
bf4c1a1
docs: nextjs glue-tier + faststore-fila migration plan
tlgimenes Jul 8, 2026
97695d5
fix(blocks-admin): drop import.meta syntax so CJS consumers (ts-jest)…
tlgimenes Jul 8, 2026
a519e6e
fix(blocks): drop last import.meta occurrence in env.ts
tlgimenes Jul 8, 2026
2edf4e0
feat(blocks-cli): generate-sections --registry emits a lazy section-i…
tlgimenes Jul 8, 2026
be84843
feat(nextjs): createNextSetup — one-call Next.js site bootstrap
tlgimenes Jul 8, 2026
d393fe0
fix(nextjs): clear createNextSetup memo on rejected bootstrap
tlgimenes Jul 8, 2026
21a6f94
feat(nextjs): createDecoRouteHandlers catch-all admin dispatcher
tlgimenes Jul 8, 2026
8419f94
fix(nextjs): restore POST-only gating on createDecoRouteHandlers' inv…
tlgimenes Jul 8, 2026
fd19501
feat(nextjs): withDeco next.config wrapper (Studio rewrites + transpi…
tlgimenes Jul 8, 2026
fed6996
feat(nextjs): migrate nextjs-smoke to withDeco/createDecoRouteHandler…
tlgimenes Jul 8, 2026
9256fef
fix(nextjs): README route import depth + pin POST /live/_meta 405
tlgimenes Jul 8, 2026
3443077
fix(blocks-cli): registry doc comment contained **/ which truncated t…
tlgimenes Jul 8, 2026
0507d37
ci: pin release npm to 11.x — npm 12.0.0 ships a broken sigstore/prov…
tlgimenes Jul 8, 2026
a9a4e1d
docs: plan — generator defaults move into .deco/
tlgimenes Jul 9, 2026
36ebf2a
feat(blocks-cli): generator outputs default into .deco/ (framework ar…
tlgimenes Jul 9, 2026
90d641b
docs(skills): generated-artifact paths moved to .deco/
tlgimenes Jul 9, 2026
ca6f926
test(blocks-cli): 30s timeouts on subprocess-driven generator tests
tlgimenes Jul 9, 2026
827128d
fix(blocks-cli): floor tsx at ^4.22.5 — 4.22.0-4.22.4 breaks tsImport…
tlgimenes Jul 9, 2026
336b91e
docs(blocks-cli): record the empirical reason invoke.gen.ts stays in …
tlgimenes Jul 9, 2026
c4a2b62
test(blocks-admin): pin the decofile-reload auth gate's fail-closed side
tlgimenes Jul 9, 2026
8add5ed
fix(blocks-cli): scaffolder emitted pre-split @decocms/start and @dec…
tlgimenes Jul 9, 2026
e6df2c0
fix(blocks-cli): codegen exclusion predicate misses bare names and ap…
tlgimenes Jul 9, 2026
a122937
fix(blocks-cli): gate generate-schema.ts's CLI arg parsing behind isM…
tlgimenes Jul 9, 2026
30ef08e
fix(blocks-cli): normalize generate-sections.ts output hygiene
tlgimenes Jul 9, 2026
080f378
fix(blocks-cli): fix dead condition that skipped the RenderSection im…
tlgimenes Jul 9, 2026
9f738f4
docs(blocks-cli): document two implicit same-run coordination points
tlgimenes Jul 9, 2026
b67bb9a
fix(blocks-cli): stop mapping legacy Shopify hooks imports to a nonex…
tlgimenes Jul 9, 2026
4d1d1c1
test(nextjs): cover createNextSetup's untested option paths
tlgimenes Jul 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
44 changes: 22 additions & 22 deletions .agents/skills/deco-migrate-script/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: deco-migrate-script
description: Automated migration script that converts Deco storefronts from Fresh/Preact/Deno to TanStack Start/React/Cloudflare Workers. Runs 8 phases (analyze, scaffold, transform, cleanup, report, verify, bootstrap, compile). Use when running the migration script, debugging its output, extending it with new transforms, or understanding what it does. Located at scripts/migrate.ts in @decocms/start.
description: Automated migration script that converts Deco storefronts from Fresh/Preact/Deno to TanStack Start/React/Cloudflare Workers. Runs 8 phases (analyze, scaffold, transform, cleanup, report, verify, bootstrap, compile). Use when running the migration script, debugging its output, extending it with new transforms, or understanding what it does. Located at packages/blocks-cli/scripts/migrate.ts in @decocms/blocks-cli.
globs:
- "scripts/migrate.ts"
- "scripts/migrate/**/*"
- "packages/blocks-cli/scripts/migrate.ts"
- "packages/blocks-cli/scripts/migrate/**/*"
---

# Deco Migration Script
Expand All @@ -13,11 +13,11 @@ Automated TypeScript script that converts a Deco storefront from Fresh/Preact/De
## Quick Start

```bash
# From the NEW site root (already has @decocms/start installed):
npx tsx node_modules/@decocms/start/scripts/migrate.ts --source /path/to/old-site
# From the NEW site root (already has @decocms/blocks-cli linked/installed):
npx tsx node_modules/@decocms/blocks-cli/scripts/migrate.ts --source /path/to/old-site

# Dry run first:
npx tsx node_modules/@decocms/start/scripts/migrate.ts --source /path/to/old-site --dry-run --verbose
npx tsx node_modules/@decocms/blocks-cli/scripts/migrate.ts --source /path/to/old-site --dry-run --verbose
```

### Options
Expand Down Expand Up @@ -64,8 +64,8 @@ When the file is absent the baked-in casaevideo defaults apply, so existing migr
## Architecture

```
scripts/migrate.ts ← Entry point, runs all phases
scripts/migrate/
packages/blocks-cli/scripts/migrate.ts ← Entry point, runs all phases
packages/blocks-cli/scripts/migrate/
├── types.ts ← MigrationContext, FileRecord, DetectedPattern
├── colors.ts ← Terminal output formatting
├── phase-analyze.ts ← Phase 1: scan source, detect patterns
Expand Down Expand Up @@ -160,9 +160,9 @@ Applies 6 transforms in sequence to every source file:
preact/hooks → react
preact/compat → react
preact → react
@preact/signals → @decocms/start/sdk/signal
@deco/deco/hooks → @decocms/start/sdk/useScript
@deco/deco/blocks→ @decocms/start/types
@preact/signals → @decocms/blocks/sdk/signal
@deco/deco/hooks → @decocms/blocks/sdk/useScript
@deco/deco/blocks→ @decocms/blocks/types
apps/commerce/* → @decocms/apps/commerce/*
apps/website/* → ~/components/ui/* or @decocms/apps/*
site/* → ~/*
Expand Down Expand Up @@ -250,7 +250,7 @@ bg-black bg-opacity-20 → bg-black/20
**Deletes root files:**
- `deno.json`, `fresh.gen.ts`, `main.ts`, `dev.ts`, `tailwind.config.ts`, `runtime.ts`, `constants.ts`

**Deletes SDK files** (now in @decocms/start or @decocms/apps):
**Deletes SDK files** (now in @decocms/blocks or @decocms/apps):
- `sdk/clx.ts`, `sdk/useId.ts`, `sdk/useOffer.ts`, `sdk/useVariantPossiblities.ts`, `sdk/usePlatform.tsx`

**Moves:**
Expand All @@ -264,7 +264,7 @@ Generates `MIGRATION_REPORT.md` with:
- Manual review items with severity
- Always-check section (FormEmail, Slider, Theme, DaisyUI, Tailwind)
- Known issues (z-index stacking, opacity modifiers)
- Framework findings (patterns to consolidate into @decocms/start)
- Framework findings (patterns to consolidate into @decocms/blocks)
- Next steps

### Phase 6: Verify
Expand Down Expand Up @@ -294,8 +294,8 @@ Generates `MIGRATION_REPORT.md` with:

Runs automatically after all phases (skipped in `--dry-run`):
1. `bun install`
2. `bunx tsx node_modules/@decocms/start/scripts/generate-blocks.ts`
3. `bunx tsx node_modules/@decocms/start/scripts/generate-invoke.ts` — emits `src/server/invoke.gen.ts` (top-level `createServerFn` declarations for every VTEX action, plus the `forwardResponseCookies()` Set-Cookie bridge). Without this step the site falls back to the `/deco/invoke/...` proxy and the cart breaks at `/checkout` after addItemToCart. See `.cursor/skills/deco-server-functions-invoke/troubleshooting.md` ("Cart 'forgets' items between requests") for the failure mode.
2. `bunx tsx node_modules/@decocms/blocks-cli/scripts/generate-blocks.ts`
3. `bunx tsx node_modules/@decocms/blocks-cli/scripts/generate-invoke.ts` — emits `src/server/invoke.gen.ts` (top-level `createServerFn` declarations for every VTEX action, plus the `forwardResponseCookies()` Set-Cookie bridge). Without this step the site falls back to the `/deco/invoke/...` proxy and the cart breaks at `/checkout` after addItemToCart. See `.cursor/skills/deco-server-functions-invoke/troubleshooting.md` ("Cart 'forgets' items between requests") for the failure mode.
4. `bunx tsr generate`

### Phase 8: Compile
Expand Down Expand Up @@ -374,7 +374,7 @@ Platform affects: commerce type imports, loader registration, setup.ts template,

### Adding a New Transform

1. Create `scripts/migrate/transforms/my-transform.ts`:
1. Create `packages/blocks-cli/scripts/migrate/transforms/my-transform.ts`:

```typescript
import type { TransformResult } from "../types";
Expand Down Expand Up @@ -407,7 +407,7 @@ const transforms = [imports, jsx, freshApis, deadCode, denoIsms, tailwind, myTra

### Adding a New Template

1. Create `scripts/migrate/templates/my-file.ts`:
1. Create `packages/blocks-cli/scripts/migrate/templates/my-file.ts`:

```typescript
import type { MigrationContext } from "../types";
Expand Down Expand Up @@ -495,13 +495,13 @@ script leaves behind on existing-but-pre-framework-helpers sites:

```bash
# Read-only audit (default)
npx -p @decocms/start deco-post-cleanup
npx -p @decocms/blocks-cli deco-post-cleanup

# Auto-fix the safe rules (dead-lib-shims, dead-runtime-shim, local-widgets-types)
npx -p @decocms/start deco-post-cleanup --fix
npx -p @decocms/blocks-cli deco-post-cleanup --fix

# CI gate: auto-fix safe rules, exit 2 if any warnings remain
npx -p @decocms/start deco-post-cleanup --fix --strict
npx -p @decocms/blocks-cli deco-post-cleanup --fix --strict
```

The audit covers 7 rules (delete dead lib shims, drop obsolete inline
Expand All @@ -522,5 +522,5 @@ detection logic mirrors the canonical checklist at
shim files have valid TypeScript signatures. The audit's pattern
matches surface what compilation cannot.

Source: `scripts/migrate-post-cleanup.ts` + `scripts/migrate/post-cleanup/`.
Tests: `scripts/migrate/post-cleanup/runner.test.ts`.
Source: `packages/blocks-cli/scripts/migrate-post-cleanup.ts` + `packages/blocks-cli/scripts/migrate/post-cleanup/`.
Tests: `packages/blocks-cli/scripts/migrate/post-cleanup/runner.test.ts`.
32 changes: 32 additions & 0 deletions .agents/skills/deco-next-package-migration/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: deco-next-package-migration
description: Migrates a Next.js App Router site off the abandoned @decocms/start@5.x /next, /core, /node export tiers onto the current @decocms/blocks, @decocms/blocks-admin, and @decocms/nextjs packages. Use when a site's package.json pins @decocms/start to a 5.x-next prerelease, or imports from @decocms/start/next, @decocms/start/core, or @decocms/start/node.
---

# Deco Next.js Package Migration

Moves a Next.js site off the reverted `@decocms/start@5.x` framework-agnostic-entrypoints tiers onto the current package split. Proven on faststore-fila, a production Next.js 15 App Router VTEX FastStore storefront with a pre-existing `.deco/blocks/*.json` legacy content snapshot.

## When this applies

- `package.json` has `"@decocms/start": "5.x-next.*"` or similar prerelease pin
- Code imports from `@decocms/start/next`, `@decocms/start/core`, or `@decocms/start/node`
- The site has its own `src/sdk/deco/`-style wrapper layer (or equivalent) around the framework, rather than using the framework's route/page helpers directly

## Import mapping

See `references/import-mapping.md` for the full table. Summary: `@decocms/start/core`'s CMS functions (`setBlocks`, `registerSectionLoaders`, etc.) move to `@decocms/blocks/cms` under the *same names* — these did not change across the package split, only the import path. `@decocms/start/next`'s `createDecoAdminRouteHandlers`/`loadCmsPage` have no direct equivalent — `@decocms/nextjs` splits the admin protocol into one function per concern (`metaGET`, `decofileGET`/`decofilePOST`, `invokePOST`, `renderGET`/`renderPOST`) instead of one dispatcher, and page-level CMS resolution goes through `@decocms/blocks/cms`'s `resolveDecoPage` + `extractSeoFromSections` directly (or `@decocms/nextjs`'s generic `createDecoPage` helper, if the site doesn't need custom SEO-merging/curated-block-override logic). `@decocms/start/node`'s `loadAllDecofileBlocks` has no equivalent — if the site loads a directory of pre-existing legacy block JSON files (not build-time-generated ones), use `@decocms/blocks/cms/loadDecofileDirectory` (new).

## Steps

1. **Dependencies**: remove the old `@decocms/start` pin, add `@decocms/blocks`, `@decocms/blocks-admin`, and (if the site uses Next.js pages/route handlers directly rather than its own wrapper) `@decocms/nextjs`. During development before anything is published, use `bun link` against a local `deco-start` checkout — see `docs/fast-deploy.md`'s general local-dev-linking pattern, or this migration's own Task 2 for the exact commands.
2. **Section registration**: swap `@decocms/start/core`'s `registerSection`/`registerSectionsSync` imports for `@decocms/blocks/cms` — same names, no other changes needed.
3. **CMS setup/resolution**: rewrite the site's setup wrapper against `@decocms/blocks/cms`'s `setBlocks`/`setResolveErrorHandler`/`registerLayoutSections`/`registerSectionLoaders` (same names) plus `resolveDecoPage`/`extractSeoFromSections` (replacing `loadCmsPage`) and, if needed, `loadDecofileDirectory` (replacing `loadAllDecofileBlocks`). See `templates/setup-ts.md` for a full worked example derived from the faststore-fila migration. Keep the wrapper's own exported function names and return shapes unchanged wherever possible — this is what let faststore-fila's page files avoid any changes at all.
4. **Admin routes**: `@decocms/nextjs` exports one function per admin concern rather than one dispatcher — rewrite the site's admin-route wrapper as thin per-concern re-exports. See `templates/admin-routes.md`. Any route the old dispatcher served that has no `@decocms/blocks-admin`/`@decocms/nextjs` equivalent (live-editing dev tunnel: file-watch SSE, JSON-Patch file mutation) should be deleted or replaced with a simple non-daemon stub (e.g. a readiness check reading `loadBlocks()`'s size directly) — these were deliberately scoped out of the current package split, not omitted by oversight.
5. **Validate end-to-end against a real dev server**, not just unit tests — specifically the site's actual `.deco/blocks`-derived content (a real page path, not a synthetic fixture), since the on-disk block format and its resolution are exactly the surface most likely to have a real, only-visible-at-runtime discrepancy (see this migration's own Task 6).

## Gotchas

- `resolveDecoPage`'s return shape (`DecoPageResult`) is `{name, path, params, blockKey, resolvedSections, deferredSections, seoSection}` — note `seoSection` is a *resolved section*, not a plain `{title, description}` object. Call `extractSeoFromSections([result.seoSection].filter(Boolean))` to get a plain SEO object.
- `findPageByPath` matches on each page block's `.path` field, not on the blocks map's key — so a `loadDecofileDirectory`-style loader can assign any unique key per file without needing to reverse-engineer the original admin's exact key-naming convention.
- Next.js App Router route folder naming is asymmetric between `_` and `.` prefixes, and it's easy to get backwards: `_`-prefixed folders (e.g. `_healthcheck`) must be URL-encoded as `%5Ffoldername`, because Next treats a literal `_folder` as a private folder and excludes it from routing. Dot-prefixed folders (e.g. `.decofile`) must do the **opposite** — keep the literal dot. The URL-encoded form (`%2E…`) is NOT decoded by Next App Router (verified against Next 16.2.6 / Turbopack) — it resolves to the catchall route instead of the intended handler. This is a Next.js routing constraint, unrelated to the deco-start package split, and was already handled in whatever site is being migrated (verify it still is, post-migration).
Loading
Loading