diff --git a/.changeset/assist-field-group-reset.md b/.changeset/assist-field-group-reset.md index 2310eb1f5a..01c8f8f206 100644 --- a/.changeset/assist-field-group-reset.md +++ b/.changeset/assist-field-group-reset.md @@ -1,5 +1,5 @@ --- -'@sanity/assist': patch +"@sanity/assist": patch --- Keep the document's selected field group from resetting while editing AI Assist instructions. The instruction inspector no longer overwrites the host document pane's `path` param, so working with AI Assist inputs preserves the active field group tab. diff --git a/AGENTS.md b/AGENTS.md index f35e377718..c297d4d88a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -436,6 +436,16 @@ pnpm add lodash-es pnpm add lodash ``` +**Catalog shared dependencies** + +When a dependency is used by more than one package (two or more), manage its version in the pnpm [catalog](https://pnpm.io/catalogs) instead of repeating a literal range in each `package.json`: + +1. Add the dependency and its version range to the default `catalog:` in `pnpm-workspace.yaml`. +2. Reference it from each `package.json` as `"dep-name": "catalog:"`. +3. Shared studio peers (`react`, `react-dom`, `sanity`, `styled-components`) use the named `peer` catalog (`catalog:peer`) — see above. For other cases where one package must stay on a different major than the rest, add a named catalog and reference it with `catalog:`. + +Leave niche one-off peers and `workspace:` protocol deps as they are. `pnpm add` runs with `catalogMode: prefer` (set in `pnpm-workspace.yaml`), so adding a dependency that already exists in a catalog reuses the catalog version automatically. pnpm has no built-in "used N times" enforcement, so apply this rule whenever you add or move shared dependencies. + ### Formatting We use [oxfmt](https://oxc.rs/docs/formatter.html): diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index e39be83a74..769a4f312d 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -83,6 +83,8 @@ catalogs: sanity: ^5 || ^6.0.0-0 styled-components: ^6.1 +# When running `pnpm add`, reuse a dependency's catalog version automatically if +# it already exists in a catalog, so shared deps stay aligned on a single version. catalogMode: prefer dedupeDirectDeps: true