浏览代码

chore(memory): capitalize BDR-005 + LRN-004 from animation lib auto-install

BDR-005: motion as default animation library; plugin-advisor stays
read-only (orchestrators own install).

LRN-004: framer-motion was rebranded `motion` in Nov 2024 — single
package for React/Svelte/vanilla, separate `motion-v` for Vue. React
Native still needs react-native-reanimated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bastien 2 周之前
父节点
当前提交
946203f802
共有 3 个文件被更改,包括 33 次插入0 次删除
  1. 18 0
      .claude/memory/decisions.md
  2. 1 0
      .claude/memory/journal.md
  3. 14 0
      .claude/memory/learnings.md

+ 18 - 0
.claude/memory/decisions.md

@@ -26,6 +26,7 @@ rules:
 | BDR-002 | 2026-04-23 | Move tasks/ + introduce memory + audits under .claude/ | accepted |
 | BDR-003 | 2026-04-23 | Gitignore wildcard + negations pattern for .claude/ | accepted |
 | BDR-004 | 2026-04-27 | Adopt auto permission mode as default | accepted |
+| BDR-005 | 2026-04-27 | `motion` as default animation library; advisor stays read-only | accepted |
 
 ---
 
@@ -77,3 +78,20 @@ rules:
   - `dontAsk` — full denylist, breaks anything not pre-approved. Suited to CI, not interactive work.
 - **Caveats**: requires Claude Code v2.1.83+, plan ≠ Pro (Max/Team/Enterprise/API only), Sonnet 4.6 / Opus 4.6 / Opus 4.7, Anthropic API provider. On entering auto mode, blanket allow rules (`Bash(*)`, `Bash(python*)`, package-manager run, `Agent`) are dropped and restored on exit.
 - **Reference**: commit `1421578`.
+
+## BDR-005 — `motion` as default animation library; advisor stays read-only
+
+- **Date**: 2026-04-27
+- **Status**: accepted
+- **Decision**: when a project's stack supports it, the framework installs `motion` (or `motion-v` for Vue 3 / Nuxt) as the default animation library. Install is **automatic** in `/init-project` STEP 5e (post-scaffold) and **opt-in** in `/onboard` STEP 2.5 (existing projects). `plugin-advisor` only **detects and reports** the status — it never runs `npm install` itself. Detection logic lives in `lib/animation-lib-check.sh` (sourced by all three layers).
+- **Why**: framer-motion was rebranded `motion` in November 2024 (single package supporting React `motion/react`, Svelte, vanilla JS; `motion-v` is the parallel package for Vue). Baking the new name in now avoids legacy-import sprawl across new projects. The split init-vs-onboard behavior follows the trust gradient: at init, the user has just validated the entire scaffold so silent install is fine; at onboard, we are touching an existing `package.json`, which is invasive without explicit consent. Plugin-advisor was kept read-only to preserve its "Never modify files" contract (PHASE 4 already mutates plugin state with confirmation; piling npm installs on top would blur its responsibility).
+- **Alternatives rejected**:
+  - Pin `framer-motion` (legacy name) — rejected: the package is in maintenance mode, every new project would inherit the old import path.
+  - Auto-install during `/onboard` without asking — rejected: silently adds a runtime dep + ~50 KB gzip to a project the user did not ask to modify.
+  - Make `plugin-advisor` install missing libs — rejected: violates its read-only spec and breaks separation of concerns (advisor advises; orchestrators mutate).
+  - React-only scope — rejected: Vue/Svelte teams should also benefit; `motion-v` makes the Vue case clean.
+- **Eligibility rules** (helper output):
+  - `eligible|motion`: React, Next.js, Remix, Astro+React, Svelte/SvelteKit
+  - `eligible|motion-v`: Vue 3, Nuxt
+  - `no|-`: backend, CLI, embedded, Flutter, static HTML, **React Native** (use `react-native-reanimated`), Astro without UI integration, no `package.json`
+- **Reference**: helper at `lib/animation-lib-check.sh`; integration in `skills/init-project/SKILL.md` STEP 5e, `skills/onboard/SKILL.md` STEP 2.5, `agents/plugin-advisor.md` PHASE 1/2/3, `lib/design-gate.md`.

+ 1 - 0
.claude/memory/journal.md

@@ -27,3 +27,4 @@ rules:
 - Settings: switched `permissions.defaultMode` from `"default"` to `"auto"` and dropped `disableAutoMode: "disable"` (BDR-004); reorganised top-level keys and added `effortLevel: "xhigh"`; removed stale root `TODO.md` (already migrated to `.claude/tasks/TODO.md`).
 - Learning: Claude Code `disable*` settings use the sentinel string `"disable"`, not a boolean (LRN-003).
 - 3 atomic commits (`f7f033f..1421578`) via `/commit-change`.
+- Animation lib autoflow added: new helper `lib/animation-lib-check.sh` + STEP 5e in `/init-project` (auto-install) + STEP 2.5 in `/onboard` (opt-in) + read-only detection in `plugin-advisor` PHASE 1/2/3 + signal in `lib/design-gate.md` + scaffolder note. `motion` chosen over legacy `framer-motion` (BDR-005, LRN-004).

+ 14 - 0
.claude/memory/learnings.md

@@ -23,6 +23,7 @@ rules:
 | LRN-001 | 2026-04-22 | `rtk` shape-compression breaks pipes | any pipeline chaining `rtk curl/cat/read` into `jq`, `python -c`, `awk` |
 | LRN-002 | 2026-04-23 | Moving report-file paths requires grepping bash READS, not just WRITES | any refactor that moves a generated file used by a dispatcher |
 | LRN-003 | 2026-04-27 | Claude Code `disable*` settings use sentinel string `"disable"`, not boolean | any change to `permissions.defaultMode` or related blocker keys |
+| LRN-004 | 2026-04-27 | `framer-motion` was rebranded `motion` in Nov 2024 — different packages per framework | any new project recommending an animation lib; auditing legacy imports |
 
 ---
 
@@ -53,3 +54,16 @@ rules:
   - Same logic for `bypassPermissions` mode and `disableBypassPermissionsMode`.
   - Don't trust the doc's naming — read the value semantics. Sentinel strings beat booleans here because the harness can distinguish "unset" from "explicitly off" (admin policy).
 - **Reference**: commit `1421578`, doc `https://code.claude.com/docs/en/settings`.
+
+## LRN-004 — `framer-motion` rebranded `motion` (Nov 2024) — different packages per framework
+
+- **Date**: 2026-04-27
+- **Pattern**: `framer-motion` was renamed `motion` in November 2024. The rename is not just cosmetic: it bundles React (`motion/react`), Svelte, and vanilla-JS support under a single npm package, while Vue gets its own parallel package `motion-v`. The legacy package `framer-motion` still installs and works but is in maintenance mode — recommending it in a new framework default would lock projects into legacy import paths from day one. Detection of "is animation already covered" must therefore include both names plus the broader anim ecosystem (`gsap`, `lottie-react`, `react-spring`, `popmotion`, `@formkit/auto-animate`) to avoid double-installs.
+- **Context**: building animation-lib auto-install in `/init-project` and `/onboard`. Initial user phrasing was "framer-motion" (the old name they remembered). Picking the package name without verifying the rename would have shipped legacy imports in every new scaffold.
+- **Future application**:
+  - For React / Next.js / Remix / Astro+React / Svelte: `motion` (`import { motion } from 'motion/react'`).
+  - For Vue 3 / Nuxt: `motion-v` (separate package, separate API).
+  - For React Native: do NOT recommend `motion` — use `react-native-reanimated` (motion targets the DOM).
+  - When auditing existing projects, check both `framer-motion` and `motion` keys in `package.json` deps; treat either as "animation already covered".
+  - Before adopting any "industry default" lib in a framework, verify the canonical package name is current — naming churn (rebrand, scope change `@org/lib`, fork) is common in JS land.
+- **Reference**: helper `lib/animation-lib-check.sh`, BDR-005.