--- description: Sync Potion (../potion) to a published Plate beta of its packages (platejs, plitejs) and the UI components (src/registry) at that beta's tag, from a Plate session. Use for "sync Potion" or 同步 Potion. argument-hint: '[version] [--packages-only | --ui-only] [--style ] [--no-add]' name: sync-potion metadata: skiller: source: .agents/rules/sync-potion.mdc --- # Sync Potion Handle $ARGUMENTS. Potion's Plate packages and UI components follow Plate's published betas. Potion may restyle a component and change its interaction once the owner calls that component ready, and a sync keeps those changes and merges in only Plate's bug fixes. This skill runs one Potion command, then checks what it wrote. ## Paths - Before any change, read the `potion` skill and its registry reference (`.agents/rules/potion/references/registry.md`) in full. ## Before you run it - The owner releases the Plate beta by hand before each sync. This skill never merges the version PR and never publishes. It syncs to npm's `beta` tag, the newest beta, unless the request names a version. - When Potion waits on a Plate fix, such as one its plan, friction log or regressions file names, check that the beta holds it: `git merge-base --is-ancestor platejs@` in Plate, after `git fetch origin tag platejs@`. When the beta lacks it, stop and tell the owner which fix it lacks. - Copy into the Potion worktree, from Potion's main checkout, the env files git ignores. The worktree needs no `bun install` first, because the command installs the packages before it syncs the UI. `--ui-only` needs `node_modules/.bin/biome` to exist already. - To reproduce a bug or prove a Plate fix in Potion before it has a beta, follow the Potion stack recipe (`.agents/rules/potion/references/stack.md`) instead. ## Command Run it in the Potion worktree: ```bash bun run sync:plate [version] ``` Arguments: - `[version]`: the Plate beta, such as `54.0.0-beta.7`. It defaults to `npm view platejs@beta version`. - `--packages-only` or `--ui-only`: sync one half. - `--style `: the registry style overlay, `radix-nova` by default. - `--no-add`: list the npm packages Potion lacks without running `bun add`. - `--local `: pack the packages from a Plate checkout into `tmp/plate-local/` instead of using a beta. Only the stack recipe's proof uses it, and nothing it writes is ever committed. ## What it does 1. Fetches the tag `platejs@` into Plate's main checkout and adds a detached Plate worktree at that tag in a temp folder, which it removes when it exits. 2. Pins `platejs` and `plitejs` in Potion's `package.json`, in `dependencies` and `overrides`, to the exact version, runs `bun install` and deletes `tmp/plate-local/`. It then runs `bun add` for each optional peer Potion lacks, such as mammoth or jszip, at the version Plate's `apps/www`, or the package's own devDependencies, uses at that tag. 3. Reads the tag's `apps/www/public/r/*.json`, applies `src/__registry__/overlays/