@devalok/shilp-sutra 0.40.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,73 @@
1
+ <!-- Source: packages/core/docs/recipes/upgrading.md — do not edit directly. Regenerate with `node scripts/build-skill.mjs`. -->
2
+
3
+ # Upgrading shilp-sutra safely
4
+
5
+ A version bump is **not** safe-by-default. Breaking changes in this design system are often type-level (prop types narrowed, symbols moved between barrels) and only surface at `tsc`/build time — never assume a bump is low-risk before doing the checks below.
6
+
7
+ > **Hard rule for AI agents:** On ANY version bump, do not report the upgrade as safe before you have read the COMPLETE changelog **and** `MIGRATION.md` for the target version, grepped the consumer codebase for moved/renamed/narrowed symbols, and run `typecheck` + `build`. Breaking entries are frequently ordered LAST in the changelog (changesets orders by file, not severity) — skimming the top and relaxing is the #1 failure mode.
8
+
9
+ ## Step 1 — read the full breaking surface
10
+
11
+ 1. Open the target version's section in `node_modules/@devalok/shilp-sutra/CHANGELOG.md` (or the GitHub release). **Read all of it**, not just the top.
12
+ 2. Open `node_modules/@devalok/shilp-sutra/MIGRATION.md` and read every section from your current version up to the target.
13
+ 3. Scan for these signals — each is a potential break:
14
+ - `feat!` / `BREAKING` headers
15
+ - "removed", "moved", "renamed", "narrowed", "no longer exported"
16
+ - any prop **type** change (a narrowing — new type accepts less than the old — fails `tsc` for values that compiled before)
17
+ - peer-dependency changes (a symbol now imported from a per-component subpath instead of the barrel)
18
+
19
+ ## Step 2 — find affected call sites in your code
20
+
21
+ **Fastest path — read the machine-readable manifest:**
22
+
23
+ ```bash
24
+ # Lists every break per version as structured data (moves, narrowings, removals)
25
+ cat node_modules/@devalok/shilp-sutra/BREAKING.json
26
+ ```
27
+
28
+ Or programmatically:
29
+
30
+ ```js
31
+ import manifest from '@devalok/shilp-sutra/BREAKING.json'
32
+ // manifest.versions["0.40.0"].moved → [{ symbol, from, to, peer, eslintRule }, …]
33
+ // manifest.versions["0.40.0"].narrowed → [{ prop, components, from, to, fix }, …]
34
+ ```
35
+
36
+ Schema: `@devalok/shilp-sutra/BREAKING.schema.json`. AI agents should prefer this over prose-parsing CHANGELOG.
37
+
38
+ **Or grep manually:**
39
+
40
+ ```bash
41
+ # Symbols moved out of barrels (0.40.0 peer-cliff cleanup example):
42
+ grep -rn "from '@devalok/shilp-sutra/ui'" src/ | grep -E "Toaster|toast|InputOTP"
43
+ grep -rn "from '@devalok/shilp-sutra/composed'" src/ | grep -E "DatePicker|EmojiPicker|FilePreview|MarkdownViewer|RichTextEditor|RichChatInput"
44
+ grep -rn "from '@devalok/shilp-sutra/ai'" src/ | grep -E "BlockRenderer|ErrorBlock|TextBlock"
45
+
46
+ # Type narrowings — find icon sources annotated as the wide React.ReactNode:
47
+ grep -rn "React.ReactNode" src/ | grep -i "icon"
48
+ ```
49
+
50
+ ## Step 3 — let the ESLint plugin do the mechanical work
51
+
52
+ ```bash
53
+ pnpm add -D @devalok/eslint-plugin-shilp-sutra
54
+ # one-shot codemod: repoints moved barrel imports + flags deprecated APIs
55
+ pnpm eslint --fix --config node_modules/@devalok/eslint-plugin-shilp-sutra/migration src/
56
+ ```
57
+
58
+ The `prefer-per-component-import` rule autofixes barrel→subpath moves and splits multi-symbol lines correctly. It cannot retype your own annotations — narrowings (Step 4) are still manual.
59
+
60
+ ## Step 4 — typecheck + build BEFORE deploy
61
+
62
+ ```bash
63
+ pnpm typecheck && pnpm build
64
+ ```
65
+
66
+ This is the gate that catches type narrowings the changelog may have under-described. Two real examples from 0.40.0:
67
+
68
+ - **Barrel peer-cliff cleanup (breaking):** `import { Toaster } from '@devalok/shilp-sutra/ui'` → `import { Toaster } from '@devalok/shilp-sutra/ui/toaster'`. 12 symbol families. Full table in `MIGRATION.md → v0.40.0`.
69
+ - **Icon API narrowing:** the unified `IconInput` type excludes `string`/`number`/iterables that `React.ReactNode` allowed. If you stored icons in a `Record<string, React.ReactNode>` map or `icon?: React.ReactNode` field and passed them to a migrated component (`CommandItem.icon`, `ActivityItem.icon`, `Chat.Message.Avatar`), retype the source to `React.ReactElement`.
70
+
71
+ ## Step 5 — only now is the bump "safe"
72
+
73
+ Report the upgrade as complete only after Steps 1-4 pass. If anything in the changelog was ambiguous, prefer a per-prop `expectTypeOf` probe over assuming "non-breaking".