Skip to content

v8 N-04: the deco CLI (schema, content, check, serve) - #604

Closed
tlgimenes wants to merge 14 commits into
v8-03-legacy-secretsfrom
v8-04-cli
Closed

tlgimenes wants to merge 14 commits into
v8-03-legacy-secretsfrom
v8-04-cli

Conversation

@tlgimenes

@tlgimenes tlgimenes commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Adds the next-major deco CLI as @decocms/blocks/cli and the package's deco bin, on top of N-01 (protocol) and N-02 (core), with no copies of their code.

  • deco schema: reads .deco/index.ts with the app's own typescript (peer, loaded only when the command runs) and writes .deco/schema.gen.json (deco-meta@1, legacy alias table). --watch follows monorepo packages.
  • deco content: .deco/blocks/*.json → .deco/blocks.gen.ts ({ revision, blocks, aliases }), using the protocol's file-name rule and computeContentRevision.
  • deco check: validates saved blocks against the schema (Ajv + a walk that dispatches on __resolveType), checks names, routes and redirects (same trie as matchRoute), ciphertext format, and warns about variants after an always rule.
  • deco serve: the protocol's createContentHandler and createAssetHandler over its fs storage. The CLI only adds the Node HTTP layer (loopback by default, Host check, origin allow-list, Chrome local-network preflight) and regenerates blocks.gen.ts after every save.

Deviations from the docs (to settle in the docs-conformance review): saved-block files with % in their names are inlined instead of imported (Vite/esbuild/Node disagree on % in import paths); --app-url defaults to http://localhost:5173; SVG uploads are refused.

Tests: protocol conformance against a real deco serve (56 passed, 10 not applicable); schema golden against storefront-tanstack's meta.gen.json (section forms and loader definitions match exactly; intentional differences listed in schema/golden.test.ts); 947 v8 + protocol tests pass; tsc clean. Pre-existing failures on the base (nextjs draftShell, tanstack workerEntry, biome debt) are untouched.

Diff vs v8-02-core: 31 files, +6,633 / −7 (≈4,060 source, 2,580 test).


Part of the v8 stack (spec: docs PR deco-sites/docs-tanstack#4). Draft until the docs-conformance review.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig


Summary by cubic

Adds the next-major deco CLI as @decocms/blocks/cli with the package's deco bin, built on the protocol (N-01) and core (N-02) with no copies of their code, plus the secret built-in block and the @decocms/blocks/secrets encryptor. Tests: the protocol's conformance suite runs against a real deco serve (56 passed, 10 not applicable), a golden test checks the generated schema against storefront-tanstack's meta.gen.json, and 947 v8 + protocol tests pass; pre-existing base failures are untouched.

Commands

  • deco schema reads .deco/index.ts with the app's own typescript peer — loaded via import() only when the command runs, so neither the CLI nor the compiler reaches an app bundle — and writes .deco/schema.gen.json in the deco-meta@1 format with the legacy alias table. --watch follows workspace packages the block map imports.
  • deco content turns .deco/blocks/*.json into .deco/blocks.gen.ts ({ revision, blocks, aliases }), using the protocol's file-name rule and computeContentRevision.
  • deco check validates saved blocks against the schema: props via Ajv and a walk that dispatches on __resolveType (names, references, routes and redirects through the same trie as matchRoute, ciphertext format), plus warnings for variants after an always rule.
  • deco serve runs the protocol's createContentHandler and createAssetHandler over its fs storage; the CLI only adds the Node HTTP layer (loopback by default, Host check, origin allow-list with Chrome local-network preflight) and regenerates blocks.gen.ts after every save.

Deviations from the docs (draft until the docs-conformance review)

  • Saved-block files with % in their names are inlined instead of imported.
  • --app-url defaults to http://localhost:5173.
  • SVG uploads are refused.

Written for commit aef8f30. Summary will update on new commits.

Review in cubic

Stack: v8 ← 01 ← 02 ← 03 ← 04 ← 05 ← 08 ← 09

tlgimenes and others added 14 commits October 3, 2026 11:52
…r CLI

First piece of the `deco` CLI (N-04), under packages/blocks/src/v8/cli:

- root.ts: the .deco/ walk-up and --root, with the documented
  "no .deco/ found from …; run inside your app or pass --root" error.
- keys.ts: the content protocol's file-name rule (encode on write,
  decode exactly once on read, spelling tie-break, unsavable names).
  A local port of blocks-cli's blocks-dedupe until N-01 ships
  @decocms/blocks/protocol/keys.
- builtins.ts: the ten built-in names and the legacy alias table
  (website/pages/Page.tsx → page, the multivariate kinds, always,
  never, date, redirect, secret).
- content.ts: `deco content` writes .deco/blocks.gen.ts, one JSON
  import per file (inlined when the file name isn't a portable import
  path), exporting { revision, blocks, aliases }. The revision is a
  SHA-256 of the whole map in canonical JSON. It never reads the block
  map.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
`deco schema` reads the default export of .deco/index.ts(x) with
ts-morph and writes .deco/schema.gen.json in the site editor's format,
the shape of today's meta.gen.json: manifest.blocks by group,
schema.definitions keyed by padded base64, schema.root unions, plus
`format: "deco-meta@1"` and the alias table.

The type-to-schema engine is ported from blocks-cli's
generate-schema.ts (JSDoc tags, widget aliases, unions, intersections,
the v7 opaque Section), with the next-major rules:

- groups come from the function: JSX or a render descriptor →
  sections, boolean → matchers, returns its own props → pages (if it
  extends Route) or content, anything else → loaders;
- an object field takes a plain value or any block whose awaited
  return type is assignable to it (weak, all-optional types need the
  same named type), so a matcher never fits `sections` and simple
  types stay plain inputs;
- ReactNode/ReactNode[] are section pickers, Lazy<T> is a lazy block
  around T, Secret is a write-only secret block, a literal @options
  list is an enum;
- the ten built-ins are always present and a block map key replaces
  one; legacy names get definitions and manifest entries (the legacy
  multivariate kinds monomorphized, the nested legacy redirect);
- a `path` field on a type that doesn't extend Route is an error, and
  a schema with errors is not written.

typescript is a peer dependency; ts-morph is loaded only when the
command runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
`deco check` reads .deco/schema.gen.json and .deco/blocks as they are,
writes nothing, and exits 1 on any error (warnings don't fail). It
walks each saved block and dispatches on __resolveType, validating one
block's props at a time with Ajv against a copy of the schema in which
every field also accepts a block, so nested blocks are checked on their
own instead of surfacing as anyOf noise. It checks:

- props against the block type's schema: required, enums, limits,
  types and fields the code doesn't declare;
- every __resolveType names a block type, built-in, alias or an
  existing saved block (with reference cycles reported);
- typed references: a block or saved block fits a field only if its
  function's return type does (the schema's per-field list);
- Lazy<T> fields hold a lazy block and lazy blocks sit only there;
  multivariate values are lazy-wrapped (plain under legacy names) and
  checked against the field they vary, rules are matchers, and a
  variant after an always rule is a warning;
- no saved block takes the name of a block type, built-in or alias;
- no two routes (or two redirects) match the same URL, by the same
  segment trie matchRoute builds;
- secret blocks hold a well-formed v1 ciphertext (no key needed).

Errors print per file as plain lines ("sections[2].title: required").
secretViolations() is the content protocol's secret guard.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
`deco serve` serves the working tree to the site editor over the
content protocol (JSON-RPC 2.0 at /rpc: describe, schema.get,
blocks.list, blocks.apply) and takes uploads at PUT /assets/<name>.

- Security: binds 127.0.0.1 (a warning for any other --host), a random
  bearer token per run (or --token / DECO_SERVE_TOKEN) on every
  request but preflights, only the site editor's origins plus
  --allow-origin, Chrome's local-network preflight, a Host check
  against DNS rebinding, JSON-only bodies on /rpc, 8 MiB request cap.
- describe reports the root and asset folder relative to the
  repository root, the limits, the dev app as preview origin and the
  contents of .deco/secrets.pub.
- blocks.apply validates everything first (names, shapes, sizes, the
  secret guard), honors ifMatch (null = create-only), lets set win
  over delete, writes JSON.stringify(entry, null, 2) + "\n" through
  temp files and renames, deletes losing spellings, and regenerates
  .deco/blocks.gen.ts when a file is added or removed (after every
  save on Next.js). Versions are git blob hashes.
- Uploads: image, video, font or PDF types into public/assets (or
  --assets), never overwriting (a taken name gets a short suffix);
  refused with --read-only, where describe.assets is null.

The JSON-RPC core and the fs storage are minimal local versions of
N-01's @decocms/blocks/protocol/server and /storage/fs, behind the
same (Request) => Response and storage shapes; TODOs mark the swap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
`deco` is @decocms/blocks' single bin: bin/deco.js loads the CLI's
TypeScript sources directly under Bun and through tsx under plain
Node. `deco schema|content|check|serve` parse the flags in the CLI
reference; --watch on schema and content regenerates on change, and
every command walks up to .deco/ or takes --root. The same commands
are importable from @decocms/blocks/cli.

The runtime never imports the cli subpath (a test walks src/ to keep
it that way), so the CLI, ts-morph and the TypeScript compiler never
reach an app bundle. The v7 generators in @decocms/blocks-cli are
untouched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Generates the schema for storefront-tanstack's sections and loaders
through the block map a next-major port would have, and compares it
with the meta.gen.json the v7 generator committed: same keys, groups
and namespaces, and every section form and flat loader definition
equal after normalizing the documented intentional differences (the
plain-value branch on block-ref fields, gallery descriptions, files
without a default export, v7's synthesized commerce wrappers and apps
group). The block-ref lists match v7's name-based matching exactly.

Skipped unless DECO_SCHEMA_GOLDEN_SITE (or ../storefront-tanstack)
holds a checkout with dependencies installed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
ts-morph pulled its own bundled TypeScript (~12 MB) into every app as a hard
dependency, and the declared typescript peer was never loaded. The schema
engine now runs on a thin view over the compiler API (schema/tsProgram.ts)
that keeps the ts-morph method names the v7 port was written against, and
loads the app's typescript with import() only when deco schema runs.

Output is byte-identical to the ts-morph engine on the fixture store and on
the storefront-tanstack golden block map.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
testing.ts (fixture projects and a test-only sealSecret) lived in src/ and
would have shipped, since the package had no files list. It moves to
src/v8/cli/__tests__/fixture.ts, and package.json's files now publishes bin/
and src/ without *.test.ts(x) and __tests__/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
…ys what it inlines

- The saved-block maps have no prototype, so a block named constructor or
  toString is an ordinary entry. A file whose name the file-name rule rejects
  (__proto__.json, con.json, ...) is an error diagnostic instead of vanishing.
- Files with % in the name stay inlined, now as a documented departure from
  "one import per file": Vite and esbuild read a % in an import specifier as
  a literal character and Node decodes it, so no spelling names the same file
  everywhere. deco content says how many it inlined and that hand edits to
  them need a rerun (or --watch); deco serve regenerates after every save.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
… and variants

Schema:
- Secret and Lazy<T> are structural wherever the type appears, so Secret[]
  is a list of secret blocks and Lazy<T>[] a list of lazy ones (they came out
  as plain strings and empty objects).
- Only the Lazy alias makes a lazy field. A method like
  onLoad?: () => Promise<void> is skipped, as the spec says, instead of
  becoming a lazy field with a string value.
- Under the short name multivariate each variant's value is a lazy block, in
  the built-in's own form and in the page's sections union; the legacy names
  keep plain values.

Check:
- A plain value in a Secret or Lazy<T> list item is reported like one in a
  field, and a saved reference that isn't a secret in a Secret field is
  tagged for the secret guard, so blocks.apply refuses both.
- Names are looked up with Object.hasOwn: a __resolveType of constructor or
  toString is an unknown block type, and a saved block named toString isn't
  "the name of an alias".
- date, date-time and uri values are validated (widget formats such as
  image-uri still accept any string); maxLength counts code points, as Ajv
  does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
…k sniffing

- Every save regenerates .deco/blocks.gen.ts, so editing an existing block
  gives a new revision (it only did on added/removed files, or on Next.js).
  writeIfChanged keeps an unchanged module untouched.
- No framework detection in the CLI: isNextApp is gone, and the dev app
  defaults to http://localhost:5173 instead of parsing vite.config.*. A
  framework binding that knows its dev port passes appUrl to startServer.
- Uploads must have an extension that matches their declared content type
  (an .html sent as image/png is refused), and SVG is refused: the dev app
  serves uploads from its own origin.
- An empty --token or DECO_SERVE_TOKEN is refused at startup instead of
  401-ing every request.
- Snapshot maps have no prototype and every name lookup is Object.hasOwn, so
  blocks named constructor or toString save, list and delete normally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
…-safe command lookup

- generateSchema reports the sources it read outside the root and outside
  node_modules (workspace packages the block map imports), and --watch
  watches their folders too, so editing one regenerates the schema.
- deco constructor / --toString are unknown, not crashes: commands and flags
  are looked up with Object.hasOwn.
- deco content --watch doesn't print the inlined-files hint, since it keeps
  them current.
- The bin test runs deco schema under plain Node with the typescript peer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
…d-ins

The CLI was built before N-01 (@decocms/blocks/protocol) and N-02 (the v8
core) landed, with local copies of what they own. Each is now the real one:

- the file-name rule: protocol keys (isBlockFileName, checkBlockName,
  resolveSpellings) replace cli/keys.ts
- deco serve: createContentHandler + createAssetHandler over the protocol's
  fs storage replace serve/handler.ts and serve/storage.ts; server.ts keeps
  only the Node HTTP layer (Host, Origin/CORS, local-network preflight) and
  regenerates .deco/blocks.gen.ts after each commit. The protocol's
  conformance suite now runs against deco serve (writable and read-only).
- the content revision: the protocol's computeContentRevision (deco content
  is now async)
- built-in names: the core's RESERVED_NAMES
- route conflicts for deco check: findRouteConflicts in the core's
  matchRoute.ts, on the same trie insertion matchRoute uses
- secrets: deco check validates ciphertext with the protocol's
  isWellFormedCiphertext; the CLI's own parser, its secret-guard export and
  its test-only sealing are gone (tests encrypt with encryptToCiphertext)
- SCHEMA_FORMAT comes from the protocol; findRepositoryRoot/relativePosix
  are gone (the fs storage's describe reports root and assets dir)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Keep one legacy alias table. The CLI's table (written into the schema and
the content module) and the runtime's alias bridge had each grown their own;
the runtime now owns the full list and the CLI re-exports it. Plain-variant
wrapping follows every legacy name for multivariate, so the image, message
and page variant flags resolve the same as the section one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
@tlgimenes
tlgimenes changed the base branch from v8-02-core to v8-03-legacy-secrets October 3, 2026 15:01
tlgimenes added a commit that referenced this pull request Oct 12, 2026
The whole v8 stack as **one squash commit** onto main. Merging it
publishes **8.1.0 on npm `latest`** for the 8 v8 packages, so `npm
install @decocms/blocks` gives v8. v7 keeps releasing from the `7.x`
branch.

**Draft until release day.** Don't mark it ready or merge it outside the
runbook below; the product owner names this PR when approving the merge.
Nothing has been merged, tagged or published yet.

## What's in it

The tree of this branch is exactly the top of the v8 stack, #669
(`v8-19-port-main-fixes` at `bbb4e36e`): `git diff bbb4e36
v8-release-squash` is empty. The branch is two commits on main's head
`0d125f10` (`blocks-v7.78.0`): the squash of the stack (`e151895d`), and
`ab3d3864`, which brings its tree up to #669's latest head without
rewriting history. Squash and merge folds both into one commit.

- **@decocms/blocks is one package:** the content protocol, the core SDK
(`createCMS`, resolver, lazy, built-ins, `matchRoute`, drafts), the
`deco` CLI (schema, content, check, serve), OTLP telemetry, analytics,
instrumented fetch and hosted mode (CDN releases, CDN drafts, site token
telemetry). Published as per-file tsc output, with no bundler.
- **The commerce apps are thin clients:** apps-shopify, apps-vtex (with
retry and a circuit breaker), apps-wake, apps-magento, apps-algolia,
apps-resend and apps-sfmc-personalization.
- **What v7's framework packages did is now site code.** TanStack Start
and Next.js sites follow the guides, and the `deco-v7-to-v8-migration`
skill moves a v7 site over.
- **The v7-only packages leave main:** tanstack, nextjs, blocks-admin,
blocks-cli, eitri, apps-commerce, apps-blog, apps-website,
apps-salesforce and apps-nuvemshop. They keep releasing from `7.x` on
`latest`, since they have no 8.x.
- **Fixes main gained after the branch point are ported** (#669):
apps-vtex sends `sc` on every orderForm call; the schema keeps
`_`-prefixed props, gives a string `const` a `default`, keeps a hidden
prop with a default in `required`, and turns recursive types into
`$ref`s; `matchRoute` drops a redirect to the path it matches and
matches query-scoped redirect sources (`/calcados?map=c,ft`) as #647
does on v7: the request's query string must equal the source's exactly,
and a scoped source wins over a path-only one (docs:
deco-sites/docs-tanstack#9). apps-nuvemshop stays v7-only.
- **Release config:** the `7.x` entry in `.releaserc.json` now has
`"channel": "latest-7"`. Without it the channel defaults to the branch
name `7.x`, which npm refuses as a dist-tag. `release.yml` triggers on
main again (#670 pauses it for the cut).

- **Skills:** the skills check from #621 is ported (`skills:check`,
`skills:readme`, `skills-check.yml`, `.agents/skill-template`, the
`.claude/skills` symlink), and it passes: one skill,
`deco-v7-to-v8-migration`, now an index of 9.9 KB with its gotchas split
into subject files.

**Leaves main with it:** main's v7 skills (`apps-vtex`,
`apps-nuvemshop`, `deco-caching`, `deco-cms-route-config`,
`deco-server-functions-invoke`, `deco-storefront-egress-guardrails`,
`deco-migrate-script`, `run-migration`) and v7 docs. They describe
packages that leave main, so they stay on `7.x`.

### Folded PRs

Each one gets closed with a pointer here after the merge.

| PR | What |
|---|---|
| #602 | N-01: content protocol |
| #603 | N-02: core SDK (createCMS, resolver, lazy, built-ins,
matchRoute, drafts) |
| #605 | N-03: secret built-in and the legacy v7 alias bridge |
| #604 | N-04: the deco CLI (schema, content, check, serve) |
| #606 | N-05: telemetry (OTLP), analytics, instrumented fetch, hosted
and KV loaders |
| #607 | N-08: TanStack binding and the descriptor-guide example |
| #608 | N-09: Next.js example rebuilt from the guide |
| #609 | N-10a: Shopify thin client |
| #610 | N-10b: VTEX thin client with retry and circuit breaker |
| #611 | N-10c: apps-blog and apps-website are v7-only |
| #612 | N-10d: Wake and Magento thin clients |
| #613 | N-10e: Algolia, Resend and Marketing Cloud Personalization
clients |
| #614 | N-11: v7 to v8 migration tool |
| #615 | N-12: docs-conformance gate |
| #616 | N-13: v7 leaves the v8 line (one package, thin clients,
migration is a skill) |
| #617 | N-14: per-file tsc output (TypeScript 7, no bundler) |
| #618 | N-15: preview a forced variant through the draft pointer |
| #619 | N-16: drafts are the fast-preview pointer |
| #634 | N-17: hosted mode (CDN releases, CDN drafts, site token
telemetry) |
| #668 | colour `deco check` output |
| #669 | N-19: port the v7-line fixes from main (including #647's
query-scoped redirects), the skills check from #621, the `latest-7`
channel and main's CHANGELOG entries |

## Release mechanics

The version comes from semantic-release (`.releaserc.json`, angular
preset, one shared tag `blocks-v${version}` for every package). Three
facts decide it, and each was reproduced with semantic-release 25.0.5
dry runs in a local sandbox (no tokens, nothing pushed):

- **A seed tag is required.** Without one, this `feat:` squash computes
**7.79.0** on `latest`. A major marker would compute 8.0.0, which npm
refuses (E403) because a deprecated 8.0.0 already exists.
- **The seed goes on #670's merge commit**, not on today's head. With
the lightweight tag `blocks-v8.0.0` there, this squash computes
**8.1.0**, channel `latest`, and publishes `blocks apps-algolia
apps-magento apps-resend apps-sfmc-personalization apps-shopify
apps-vtex apps-wake` with `--tag latest`. On today's head the tag would
also sit in `7.x`'s history, and every 7.x release would fail with
`EINVALIDMAINTENANCEMERGE`.
- **#670 pauses main's release trigger** between the seed and this
merge. Otherwise any v7 `fix:` merged to main in that window would ship
as **8.0.1** on `latest`.

**v7 after the cut:** `7.x` is cut from today's main, plus four commits:
the release config; the migrator fix that keeps newly migrated sites on
7.x (it also refuses an 8.x answer from npm); and v7 install docs that
ask for `@decocms/blocks@latest-7`, since a plain `@decocms/blocks` next
to `@decocms/tanstack` would install two copies of it. @decocms/blocks
and the six apps that also ship in v8 publish on the dist-tag
**`latest-7`**. npm refuses `v7` and `7.x` as dist-tags, because they
read as version ranges. The ten v7-only packages keep `latest`. The
first 7.x release is **7.78.1**.

**The squash commit message is this PR's title and body** (repo setting:
PR title + PR body). This body therefore contains no major-version
marker and no CI-skip token; keep it that way when editing.

**Publishing** goes through npm Trusted Publishing (OIDC) from
`release.yml`, with no stored token. **apps-sfmc-personalization has
never been published by the workflow**, only by hand, so check its
trusted publisher on npmjs.com before merging. If that check is skipped
and its publish fails, the tag already exists and a re-run releases
nothing; see "If it goes wrong".

## Merge-day runbook

Run it in one sitting, with merges to main frozen. Each step has a
check; stop at the first one that fails.

| # | Step | Command | Check | Rollback |
|---|---|---|---|---|
| 0 | Before the day: trusted publishers for all 18 packages
(`decocms/blocks`, `release.yml`, no environment); the PO names #670 and
this PR | npmjs.com → package → Settings → Trusted publishing | every
package lists `release.yml` | — |
| 1 | Freeze merges to main | announce | `git describe --exact-match
--tags origin/main` prints the latest `blocks-v7.*` (today
`blocks-v7.78.0`) | unfreeze |
| 2 | Cut `7.x` at main's head (fast-forward from `762d99c7`) |
`M0=$(git rev-parse origin/main); git merge-base --is-ancestor
origin/7.x $M0 && git push origin $M0:refs/heads/7.x` | no Release run
starts (that commit's workflow triggers only on main) | nothing to undo
|
| 3 | Merge #670 (pause) as a squash, title unchanged | GitHub | no
Release run; `M1=$(git rev-parse origin/main)` | revert as `chore:`,
after step 5's rollback |
| 4 | M1 is main-only | `! git merge-base --is-ancestor $M1 origin/7.x`
| exits 0 | — |
| 5 | Push the seed | `git tag blocks-v8.0.0 $M1 && git push origin
refs/tags/blocks-v8.0.0` | `git ls-remote --tags origin blocks-v8.0.0`
shows `$M1`. Optional: Actions → Release → Run on main, dry run, logs
`Found git tag blocks-v8.0.0` | `git push origin
:refs/tags/blocks-v8.0.0` |
| 6 | Turn on 7.x: push the four prepared commits | `git push origin
<prepared 7.x head>:refs/heads/7.x` | Release run on 7.x publishes
**7.78.1**: `npm view @decocms/blocks dist-tags` shows `latest-7:
7.78.1`, `latest: 7.78.0`; `npm view @decocms/blocks-cli dist-tags`
shows `latest: 7.78.1`. Expected side effect: the run first adds 7.78.0
to the `latest-7` channel (a git note and a bot comment on #655),
publishing nothing | a failed run publishes nothing; fix on 7.x |
| 7 | Retarget the open v7 PRs to `7.x`; protect `7.x` like main (a
ruleset with the deletion, force-push and pull-request rules) | `gh pr
edit <n> --base 7.x` | none of them targets main | — |
| 8 | Bring this branch onto main without changing its tree | `git merge
-s ours --no-edit origin/main && git diff --quiet bbb4e36 HEAD && git
push` | the PR diff restores `release.yml`'s `main` trigger; without `-s
ours`, git silently keeps #670's pause | — |
| 9 | Final dry run on this exact tree | semantic-release `--dry-run` in
a local sandbox (a `file://` copy of the repo with #670's merge, the
seed and this tree squashed on top; no tokens) | `next=8.1.0
channel=null`, `--tag latest`, the 8 packages, and the real
`blocks-v8.0.0` on GitHub equals #670's merge commit (the sandbox adds
its own seed, so it checks the real one separately) | stop |
| 10 | Mark ready; an engineering-deco member who did not push step 8
approves (the ruleset dismisses earlier approvals on push and requires
approval of the last push); resolve every review thread; **Squash and
merge** (not merge or rebase) with the title `feat: Deco CMS v8 — one
squash of the v8 stack` | `gh pr ready <this PR>` | Release run: tag
`blocks-v8.1.0`, 8 × `npm publish --tag latest`, GitHub release Latest |
see below |
| 11 | Verify npm | `for p in blocks
apps-{algolia,magento,resend,sfmc-personalization,shopify,vtex,wake}; do
npm view @decocms/$p dist-tags; done` | `latest: 8.1.0` for all 8;
v7-only packages still have `latest: 7.78.1` | see below |
| 12 | Unfreeze; close the folded PRs | `gh pr close <n> --comment
"Folded into #<this PR>, released as 8.1.0"` | — | — |
| 13 | Bump Studio's pins to `8.1.0` exactly; docs and the serve command
go back to plain `@decocms/blocks`; move `next` to 8.1.0; reword 8.0.0's
deprecation | see the runbook | — | — |
| 14 | Communicate | — | — | — |

**If it goes wrong:**

- **Wrong version in step 9:** don't merge. Re-check the seed (`git
ls-remote --tags origin blocks-v8.0.0` must equal #670's merge commit)
and this body (no marker).
- **Wrong version published in step 10** (7.79.0, 8.0.1, 9.0.0…):
  1. Stop all merges.
2. Point `latest` back for each of the 8 packages: `npm dist-tag add
@decocms/<pkg>@7.78.1 latest`.
3. Deprecate the bad version: `npm deprecate @decocms/<pkg>@<bad>
"Published by mistake; use 7.78.1 or 8.1.0+"`.
4. Don't unpublish, and don't `git revert` on main: a revert is itself a
`revert:` commit and would release.
5. Pause main again (#670's change as a new `chore:` PR) before fixing
forward.
- **One package failed to publish** (for example
apps-sfmc-personalization without a trusted publisher): the tag exists,
so a re-run releases nothing. Fix the trust, then publish that one
package by hand from the tag: `git checkout blocks-v8.1.0 &&
VERSION=8.1.0 node scripts/sync-versions.mjs && bun install && bun run
build && cd packages/<pkg> && npm publish --access public --tag latest`.
That copy has no provenance.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Ships Deco CMS v8 as one squash commit onto main. Merging publishes
8.1.0 on npm `latest` for the eight v8 packages, and v7 keeps releasing
from the `7.x` branch. The PR stays a draft until release day and merges
only through the runbook in the body.

**What changes**
- `@decocms/blocks` becomes one package: content protocol, core SDK
(`createCMS`, resolver, lazy, built-ins, `matchRoute`, drafts), `deco`
CLI, telemetry, analytics, instrumented fetch and hosted mode —
published as per-file tsc output with no bundler.
- The commerce apps become thin clients: apps-shopify, apps-vtex (retry,
circuit breaker), apps-wake, apps-magento, apps-algolia, apps-resend and
apps-sfmc-personalization.
- v7's framework packages become site code; sites follow the
TanStack/Next.js guides, and the `deco-v7-to-v8-migration` skill moves a
v7 site over.
- The v7-only packages (tanstack, nextjs, blocks-admin, blocks-cli,
eitri, apps-commerce, apps-blog, apps-website, apps-salesforce,
apps-nuvemshop) leave main and keep releasing from `7.x`; their agent
skills are dropped from the tree, and the skills-check gate stays on
main.
- Ports the v7-line fixes from main: apps-vtex sends `sc` on every
orderForm call, the schema keeps `_`-prefixed props and turns recursive
types into `$ref`s, and `matchRoute` drops a redirect to the path it
matches, including the query-scoped redirect sources.

**Migration and release**
- Releases 8.1.0 on `latest`: the `blocks-v8.0.0` seed tag sits on the
merge commit that pauses main's release trigger, and the squashed commit
message carries no version marker — anything else publishes a wrong
version.
- The `7.x` branch is cut from main with the config for the `latest-7`
dist-tag on `@decocms/blocks` and the six shared apps; the v7-only
packages keep `latest`.
- Sites move with `deco-v7-to-v8-migration`: a one-time script rewrites
content (block map with legacy aliases, vendored app loaders, secret
re-encryption, import report) and then lists the manual steps it can't
do.

<sup>Written for commit ab3d386.
Summary will update on new commits.</sup>

<a href="https://cubic.dev/pr/decocms/blocks/pull/671?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/decocms/blocks/671?returnTo=https%3A%2F%2Fgithub.com%2Fdecocms%2Fblocks%2Fpull%2F671&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@tlgimenes

Copy link
Copy Markdown
Contributor Author

Released in 8.1.0 via #671 (one squash of the v8 stack).

@tlgimenes tlgimenes closed this Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant