@nifrajs/cli 5.1.0 → 5.3.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.
Files changed (230) hide show
  1. package/CHANGELOG.md +3313 -0
  2. package/README.md +3 -0
  3. package/dist/agent-files.d.ts +19 -11
  4. package/dist/agent-files.d.ts.map +1 -1
  5. package/dist/agent-files.js +26 -18
  6. package/dist/agent-files.js.map +1 -1
  7. package/dist/assure-hydration.d.ts.map +1 -1
  8. package/dist/assure-hydration.js +7 -2
  9. package/dist/assure-hydration.js.map +1 -1
  10. package/dist/assure.d.ts.map +1 -1
  11. package/dist/assure.js +14 -1
  12. package/dist/assure.js.map +1 -1
  13. package/dist/capabilities-tool.d.ts.map +1 -1
  14. package/dist/capabilities-tool.js +131 -45
  15. package/dist/capabilities-tool.js.map +1 -1
  16. package/dist/check-diagnostics.d.ts +5 -0
  17. package/dist/check-diagnostics.d.ts.map +1 -1
  18. package/dist/check-diagnostics.js +5 -0
  19. package/dist/check-diagnostics.js.map +1 -1
  20. package/dist/check-scan.d.ts +9 -3
  21. package/dist/check-scan.d.ts.map +1 -1
  22. package/dist/check-scan.js +61 -21
  23. package/dist/check-scan.js.map +1 -1
  24. package/dist/check.d.ts.map +1 -1
  25. package/dist/check.js +55 -15
  26. package/dist/check.js.map +1 -1
  27. package/dist/cli.d.ts.map +1 -1
  28. package/dist/cli.js +37 -18
  29. package/dist/cli.js.map +1 -1
  30. package/dist/command-catalog.d.ts.map +1 -1
  31. package/dist/command-catalog.js +9 -5
  32. package/dist/command-catalog.js.map +1 -1
  33. package/dist/db-tool.d.ts.map +1 -1
  34. package/dist/db-tool.js +2 -1
  35. package/dist/db-tool.js.map +1 -1
  36. package/dist/dev-bun-config.d.ts +6 -3
  37. package/dist/dev-bun-config.d.ts.map +1 -1
  38. package/dist/dev-bun-config.js +13 -10
  39. package/dist/dev-bun-config.js.map +1 -1
  40. package/dist/dev-feed-tool.d.ts +3 -2
  41. package/dist/dev-feed-tool.d.ts.map +1 -1
  42. package/dist/dev-feed-tool.js +26 -5
  43. package/dist/dev-feed-tool.js.map +1 -1
  44. package/dist/doctor.d.ts +15 -1
  45. package/dist/doctor.d.ts.map +1 -1
  46. package/dist/doctor.js +79 -61
  47. package/dist/doctor.js.map +1 -1
  48. package/dist/env-file.d.ts.map +1 -1
  49. package/dist/env-file.js +41 -8
  50. package/dist/env-file.js.map +1 -1
  51. package/dist/i18n-check.d.ts +11 -1
  52. package/dist/i18n-check.d.ts.map +1 -1
  53. package/dist/i18n-check.js +170 -17
  54. package/dist/i18n-check.js.map +1 -1
  55. package/dist/init-agents.d.ts +46 -6
  56. package/dist/init-agents.d.ts.map +1 -1
  57. package/dist/init-agents.js +193 -31
  58. package/dist/init-agents.js.map +1 -1
  59. package/dist/internal/project-specifiers.d.ts.map +1 -1
  60. package/dist/internal/project-specifiers.js +9 -1
  61. package/dist/internal/project-specifiers.js.map +1 -1
  62. package/dist/internal/source-facts.d.ts +22 -0
  63. package/dist/internal/source-facts.d.ts.map +1 -1
  64. package/dist/internal/source-facts.js +322 -0
  65. package/dist/internal/source-facts.js.map +1 -1
  66. package/dist/internal/workspace-packages.d.ts +22 -0
  67. package/dist/internal/workspace-packages.d.ts.map +1 -0
  68. package/dist/internal/workspace-packages.js +215 -0
  69. package/dist/internal/workspace-packages.js.map +1 -0
  70. package/dist/load.d.ts +7 -2
  71. package/dist/load.d.ts.map +1 -1
  72. package/dist/load.js +11 -2
  73. package/dist/load.js.map +1 -1
  74. package/dist/lock-links.d.ts +42 -0
  75. package/dist/lock-links.d.ts.map +1 -0
  76. package/dist/lock-links.js +144 -0
  77. package/dist/lock-links.js.map +1 -0
  78. package/dist/mcp-exec.d.ts +1 -0
  79. package/dist/mcp-exec.d.ts.map +1 -1
  80. package/dist/mcp-exec.js +16 -5
  81. package/dist/mcp-exec.js.map +1 -1
  82. package/dist/mcp-http.js +1 -1
  83. package/dist/mcp-io.d.ts +23 -3
  84. package/dist/mcp-io.d.ts.map +1 -1
  85. package/dist/mcp-io.js +59 -12
  86. package/dist/mcp-io.js.map +1 -1
  87. package/dist/mcp-isolate.d.ts.map +1 -1
  88. package/dist/mcp-isolate.js +2 -1
  89. package/dist/mcp-isolate.js.map +1 -1
  90. package/dist/mcp-root.d.ts +6 -4
  91. package/dist/mcp-root.d.ts.map +1 -1
  92. package/dist/mcp-root.js +12 -8
  93. package/dist/mcp-root.js.map +1 -1
  94. package/dist/migrate-layout.d.ts +2 -1
  95. package/dist/migrate-layout.d.ts.map +1 -1
  96. package/dist/migrate-layout.js +435 -29
  97. package/dist/migrate-layout.js.map +1 -1
  98. package/dist/project-site.d.ts +7 -0
  99. package/dist/project-site.d.ts.map +1 -0
  100. package/dist/project-site.js +19 -0
  101. package/dist/project-site.js.map +1 -0
  102. package/dist/recipes/4.0.0.d.ts.map +1 -1
  103. package/dist/recipes/4.0.0.js +2 -0
  104. package/dist/recipes/4.0.0.js.map +1 -1
  105. package/dist/recipes/5.1.0.d.ts +9 -0
  106. package/dist/recipes/5.1.0.d.ts.map +1 -0
  107. package/dist/recipes/5.1.0.js +22 -0
  108. package/dist/recipes/5.1.0.js.map +1 -0
  109. package/dist/recipes/5.2.0.d.ts +10 -0
  110. package/dist/recipes/5.2.0.d.ts.map +1 -0
  111. package/dist/recipes/5.2.0.js +32 -0
  112. package/dist/recipes/5.2.0.js.map +1 -0
  113. package/dist/recipes/5.3.0.d.ts +11 -0
  114. package/dist/recipes/5.3.0.d.ts.map +1 -0
  115. package/dist/recipes/5.3.0.js +35 -0
  116. package/dist/recipes/5.3.0.js.map +1 -0
  117. package/dist/recipes/index.d.ts +3 -0
  118. package/dist/recipes/index.d.ts.map +1 -1
  119. package/dist/recipes/index.js +9 -0
  120. package/dist/recipes/index.js.map +1 -1
  121. package/dist/review.d.ts.map +1 -1
  122. package/dist/review.js +4 -0
  123. package/dist/review.js.map +1 -1
  124. package/dist/rule-explain.d.ts +26 -0
  125. package/dist/rule-explain.d.ts.map +1 -0
  126. package/dist/rule-explain.js +49 -0
  127. package/dist/rule-explain.js.map +1 -0
  128. package/dist/rules/codes.d.ts +4 -0
  129. package/dist/rules/codes.d.ts.map +1 -1
  130. package/dist/rules/codes.js +4 -0
  131. package/dist/rules/codes.js.map +1 -1
  132. package/dist/rules/contract-visibility.d.ts.map +1 -1
  133. package/dist/rules/contract-visibility.js +93 -21
  134. package/dist/rules/contract-visibility.js.map +1 -1
  135. package/dist/rules/explanations.d.ts +14 -0
  136. package/dist/rules/explanations.d.ts.map +1 -0
  137. package/dist/rules/explanations.js +326 -0
  138. package/dist/rules/explanations.js.map +1 -0
  139. package/dist/rules/legacy.d.ts.map +1 -1
  140. package/dist/rules/legacy.js +24 -1
  141. package/dist/rules/legacy.js.map +1 -1
  142. package/dist/rules/merge-auth.d.ts +12 -0
  143. package/dist/rules/merge-auth.d.ts.map +1 -0
  144. package/dist/rules/merge-auth.js +52 -0
  145. package/dist/rules/merge-auth.js.map +1 -0
  146. package/dist/rules/pages.d.ts +51 -0
  147. package/dist/rules/pages.d.ts.map +1 -1
  148. package/dist/rules/pages.js +293 -2
  149. package/dist/rules/pages.js.map +1 -1
  150. package/dist/rules/route-statement.d.ts +10 -0
  151. package/dist/rules/route-statement.d.ts.map +1 -0
  152. package/dist/rules/route-statement.js +150 -0
  153. package/dist/rules/route-statement.js.map +1 -0
  154. package/dist/rules/routes.d.ts +3 -2
  155. package/dist/rules/routes.d.ts.map +1 -1
  156. package/dist/rules/routes.js +4 -3
  157. package/dist/rules/routes.js.map +1 -1
  158. package/dist/rules/zones.d.ts.map +1 -1
  159. package/dist/rules/zones.js +3 -2
  160. package/dist/rules/zones.js.map +1 -1
  161. package/dist/typecheck-coverage.d.ts +11 -0
  162. package/dist/typecheck-coverage.d.ts.map +1 -1
  163. package/dist/typecheck-coverage.js +50 -7
  164. package/dist/typecheck-coverage.js.map +1 -1
  165. package/dist/upgrade.d.ts +80 -11
  166. package/dist/upgrade.d.ts.map +1 -1
  167. package/dist/upgrade.js +332 -65
  168. package/dist/upgrade.js.map +1 -1
  169. package/dist/verification-plan.d.ts.map +1 -1
  170. package/dist/verification-plan.js +2 -0
  171. package/dist/verification-plan.js.map +1 -1
  172. package/dist/version-drift.d.ts.map +1 -1
  173. package/dist/version-drift.js +12 -1
  174. package/dist/version-drift.js.map +1 -1
  175. package/dist/web-app-options.d.ts +1 -1
  176. package/dist/web-app-options.d.ts.map +1 -1
  177. package/dist/web-app-options.js.map +1 -1
  178. package/docs/examples.json +19 -1
  179. package/docs/llms-full.txt +716 -138
  180. package/docs/types.json +516 -74
  181. package/package.json +13 -12
  182. package/src/agent-files.ts +27 -17
  183. package/src/assure-hydration.ts +8 -1
  184. package/src/assure.ts +11 -1
  185. package/src/capabilities-tool.ts +159 -50
  186. package/src/check-diagnostics.ts +10 -0
  187. package/src/check-scan.ts +64 -19
  188. package/src/check.ts +75 -15
  189. package/src/cli.ts +38 -17
  190. package/src/command-catalog.ts +16 -8
  191. package/src/db-tool.ts +2 -0
  192. package/src/dev-bun-config.ts +13 -9
  193. package/src/dev-feed-tool.ts +40 -6
  194. package/src/doctor.ts +102 -66
  195. package/src/env-file.ts +42 -7
  196. package/src/i18n-check.ts +254 -18
  197. package/src/init-agents.ts +221 -41
  198. package/src/internal/project-specifiers.ts +9 -1
  199. package/src/internal/source-facts.ts +397 -0
  200. package/src/internal/workspace-packages.ts +218 -0
  201. package/src/load.ts +19 -3
  202. package/src/lock-links.ts +173 -0
  203. package/src/mcp-exec.ts +18 -4
  204. package/src/mcp-http.ts +1 -1
  205. package/src/mcp-io.ts +72 -12
  206. package/src/mcp-isolate.ts +2 -0
  207. package/src/mcp-root.ts +14 -8
  208. package/src/migrate-layout.ts +496 -31
  209. package/src/project-site.ts +18 -0
  210. package/src/recipes/4.0.0.ts +2 -0
  211. package/src/recipes/5.1.0.ts +23 -0
  212. package/src/recipes/5.2.0.ts +33 -0
  213. package/src/recipes/5.3.0.ts +36 -0
  214. package/src/recipes/index.ts +9 -0
  215. package/src/review.ts +4 -0
  216. package/src/rule-explain.ts +75 -0
  217. package/src/rules/codes.ts +4 -0
  218. package/src/rules/contract-visibility.ts +118 -20
  219. package/src/rules/explanations.ts +339 -0
  220. package/src/rules/legacy.ts +24 -1
  221. package/src/rules/merge-auth.ts +55 -0
  222. package/src/rules/pages.ts +381 -2
  223. package/src/rules/route-statement.ts +170 -0
  224. package/src/rules/routes.ts +4 -3
  225. package/src/rules/zones.ts +3 -2
  226. package/src/typecheck-coverage.ts +51 -6
  227. package/src/upgrade.ts +430 -70
  228. package/src/verification-plan.ts +6 -0
  229. package/src/version-drift.ts +15 -0
  230. package/src/web-app-options.ts +9 -1
package/dist/upgrade.js CHANGED
@@ -12,7 +12,9 @@
12
12
  * 2. **dependency moves** - replace removed packages with their supported successor without
13
13
  * reserializing package.json or leaving duplicate dependency keys.
14
14
  * 3. **import moves** - rewrite exact import specifiers to their updated module paths.
15
- * 4. **verify** - reuse the existing `nifra check` gate; no new verification surface.
15
+ * 4. **verify** - reuse the existing `nifra check` gate; no new verification surface. It reads the
16
+ * installed packages, so while the edited pins are not installed yet it is skipped with the
17
+ * install command to run first: a check then would judge the release being left.
16
18
  *
17
19
  * Upgrading across several releases runs every recipe between the installed version (the lowest
18
20
  * fixed-group version the workspace declares) and the target, oldest first, then pins the target. A
@@ -26,11 +28,12 @@
26
28
  * transforms are a future addition - a recipe that needs one is the signal to add the engine, not before.
27
29
  */
28
30
  import { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, statSync, writeFileSync, } from "node:fs";
29
- import { dirname, join, relative, sep } from "node:path";
31
+ import { dirname, join, relative, resolve, sep } from "node:path";
30
32
  import { fileURLToPath } from "node:url";
31
33
  import { Glob } from "bun";
32
34
  import { collectHookReport, diffHookReports, HOOKS_BEFORE_UPGRADE_FILE, parseHookReport, renderHookDiff, } from "./hooks-report.js";
33
- import { PIN_SITES } from "./init-agents.js";
35
+ import { ancestorPins, declaresCli, PIN_SITES } from "./init-agents.js";
36
+ import { BUN_LOCK, describeChange, linkLockUpdate, pruneLinkLocks, staleLinkLocks, } from "./lock-links.js";
34
37
  import { getRecipe, listRecipeVersions } from "./recipes/index.js";
35
38
  import { markerTarget } from "./rules/comment-markers.js";
36
39
  const DEP_FIELDS = [
@@ -39,19 +42,25 @@ const DEP_FIELDS = [
39
42
  "peerDependencies",
40
43
  "optionalDependencies",
41
44
  ];
45
+ const PEER_FIELD = "peerDependencies";
42
46
  // Only a bare semver spec is rewritten. Anything else - workspace:*, link:/file:, npm: aliases, git
43
47
  // urls, "*", "latest", or a multi-part range - is intentionally left untouched (skipped, not guessed).
44
48
  const SEMVER_SPEC = /^([\^~]|>=|<=|>|<|=)?\s*(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
49
+ const UPPER_BOUND = /^\s*<=?/;
50
+ // A strict bound kept on the target would exclude it: `>5.2.0` → `>5.3.0` refuses 5.3.0.
51
+ const INCLUSIVE_OPERATOR = { ">": ">=", "<": "<=" };
45
52
  /**
46
- * Rewrite a dependency version spec to `toVersion`, preserving the range operator (`^`, `~`, …), or
47
- * dropping it when `exact`. Returns null when the spec is not a plain semver spec (→ skip it) or
48
- * already equals the target.
53
+ * Rewrite a dependency version spec to `toVersion`, preserving the range operator (`^`, `~`, …;
54
+ * a strict `>` or `<` becomes `>=` or `<=`, so the result admits the target), or dropping it when
55
+ * `exact`. Returns null when the spec is not a plain semver spec (→ skip it) or already equals the
56
+ * target.
49
57
  */
50
58
  export function rewriteVersionSpec(spec, toVersion, exact = false) {
51
59
  const match = SEMVER_SPEC.exec(spec.trim());
52
60
  if (!match)
53
61
  return null;
54
- const operator = exact ? "" : (match[1] ?? "");
62
+ const written = match[1] ?? "";
63
+ const operator = exact ? "" : (INCLUSIVE_OPERATOR[written] ?? written);
55
64
  const next = `${operator}${toVersion}`;
56
65
  return next === spec ? null : next;
57
66
  }
@@ -122,6 +131,45 @@ export function compareSemverSpec(a, b) {
122
131
  }
123
132
  return 0;
124
133
  }
134
+ /**
135
+ * Whether a plain semver spec's range admits `version`, as npm reads it: `^` and `~` stop before the
136
+ * next breaking release, and a prerelease satisfies only a spec naming a prerelease of its own core.
137
+ * False for any other spec.
138
+ */
139
+ export function specIncludes(spec, version) {
140
+ const match = SEMVER_SPEC.exec(spec.trim());
141
+ const target = parseSpecVersion(version);
142
+ const floor = specVersion(spec);
143
+ if (match === null || target === null || floor === null)
144
+ return false;
145
+ const core = [
146
+ Number(match[2]),
147
+ Number(match[3]),
148
+ Number(match[4]),
149
+ ];
150
+ if (target.prerelease.length > 0 &&
151
+ (match[5] === undefined || compareSemverCore(core, target.core) !== 0))
152
+ return false;
153
+ const order = compareSemverSpec(version, floor);
154
+ switch (match[1]) {
155
+ case ">=":
156
+ return order >= 0;
157
+ case ">":
158
+ return order > 0;
159
+ case "<=":
160
+ return order <= 0;
161
+ case "<":
162
+ return order < 0;
163
+ case "^": {
164
+ const below = core[0] > 0 ? [core[0] + 1, 0, 0] : core[1] > 0 ? [0, core[1] + 1, 0] : [0, 0, core[2] + 1];
165
+ return order >= 0 && compareSemverCore(target.core, below) < 0;
166
+ }
167
+ case "~":
168
+ return order >= 0 && compareSemverCore(target.core, [core[0], core[1] + 1, 0]) < 0;
169
+ default:
170
+ return order === 0;
171
+ }
172
+ }
125
173
  const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
126
174
  /**
127
175
  * Apply pin rules to one package.json's TEXT (format-preserving - targeted string replaces, never a
@@ -139,12 +187,22 @@ export function pinSweepText(text, rules, allowDowngrade = false, exact = false)
139
187
  let out = text;
140
188
  const changes = [];
141
189
  const downgrades = [];
142
- for (const { path, key, target: name, spec: rawSpec } of pinEntries(parsed)) {
190
+ for (const { path, holder, key, target: name, spec: rawSpec } of pinEntries(parsed)) {
143
191
  const field = path.join(".");
144
192
  const rule = rules.find((r) => name === r.match || (r.match.endsWith("/") && name.startsWith(r.match)));
145
193
  if (!rule)
146
194
  continue;
147
- const next = rewriteVersionSpec(rawSpec, rule.to, exact);
195
+ // A peer range states what a library accepts, not what installs: widening a floor that already
196
+ // admits the target would drop every consumer still on an older release, and an exact peer pin
197
+ // would admit one release only.
198
+ const peer = field === PEER_FIELD;
199
+ if (peer && specIncludes(rawSpec, rule.to))
200
+ continue;
201
+ // An upper bound has no floor to raise: one that admits the target (`<6.0.0`) stays as written,
202
+ // in every field, and is never read as a rollback.
203
+ if (UPPER_BOUND.test(rawSpec) && specIncludes(rawSpec, rule.to))
204
+ continue;
205
+ const next = rewriteVersionSpec(rawSpec, rule.to, exact && !peer);
148
206
  if (next === null)
149
207
  continue;
150
208
  // Refuse a rollback: `upgrade <version>` pins an exact target, so an OLD target on a newer install
@@ -158,18 +216,15 @@ export function pinSweepText(text, rules, allowDowngrade = false, exact = false)
158
216
  downgrades.push({ field, name: key, from: rawSpec, to: next });
159
217
  continue;
160
218
  }
161
- // Replace exactly `"key"<ws>:<ws>"spec"` inside this field's object, preserving the whitespace. A
162
- // nested `overrides` entry repeated with the same spec maps the same way, so every one is replaced.
163
- const range = objectRangeAt(out, path);
164
- if (range === undefined)
219
+ // Replace exactly `"key"<ws>:<ws>"spec"` inside the object holding this pin, preserving the
220
+ // whitespace: npm's nested `{ ".": "5.2.0" }` under another package names that package.
221
+ const range = objectRangeAt(out, holder);
222
+ const at = range === undefined ? undefined : memberValueAt(out, range, key);
223
+ const written = JSON.stringify(rawSpec);
224
+ if (at === undefined || out.slice(at, at + written.length) !== written)
165
225
  continue;
166
- const pattern = new RegExp(`("${escapeRegExp(key)}"\\s*:\\s*")${escapeRegExp(rawSpec)}(")`, "g");
167
- const body = out.slice(range.start, range.end);
168
- const replaced = body.replace(pattern, `$1${next}$2`);
169
- if (replaced !== body) {
170
- out = out.slice(0, range.start) + replaced + out.slice(range.end);
171
- changes.push({ field, name: key, from: rawSpec, to: next });
172
- }
226
+ out = out.slice(0, at) + JSON.stringify(next) + out.slice(at + written.length);
227
+ changes.push({ field, name: key, from: rawSpec, to: next });
173
228
  }
174
229
  return { text: out, changes, downgrades };
175
230
  }
@@ -188,7 +243,6 @@ function overrideTarget(key) {
188
243
  const last = key.slice(key.lastIndexOf(">") + 1);
189
244
  return /(?:^|\/)((?:@[^/@]+\/)?[^/@]+)(?:@[^/]*)?$/.exec(last)?.[1] ?? last;
190
245
  }
191
- /** Every string version spec a package.json declares for a package, with the field path it sits in. */
192
246
  function pinEntries(parsed) {
193
247
  const entries = [];
194
248
  for (const field of DEP_FIELDS) {
@@ -197,24 +251,24 @@ function pinEntries(parsed) {
197
251
  continue;
198
252
  for (const [name, spec] of Object.entries(deps))
199
253
  if (typeof spec === "string")
200
- entries.push({ path: [field], key: name, target: name, spec });
254
+ entries.push({ path: [field], holder: [field], key: name, target: name, spec });
201
255
  }
202
256
  for (const path of OVERRIDE_FIELDS) {
203
257
  let value = parsed;
204
258
  for (const key of path)
205
259
  value = typeof value === "object" && value !== null ? Reflect.get(value, key) : undefined;
206
260
  // npm nests an override under the package whose dependency it pins; `.` pins that package itself.
207
- const walk = (object, parent) => {
261
+ const walk = (object, parent, holder) => {
208
262
  for (const [key, spec] of Object.entries(object)) {
209
263
  const target = key === "." ? parent : overrideTarget(key);
210
264
  if (typeof spec === "string" && target !== undefined)
211
- entries.push({ path, key, target, spec });
265
+ entries.push({ path, holder, key, target, spec });
212
266
  else if (typeof spec === "object" && spec !== null && !Array.isArray(spec))
213
- walk(spec, target);
267
+ walk(spec, target, [...holder, key]);
214
268
  }
215
269
  };
216
270
  if (typeof value === "object" && value !== null && !Array.isArray(value))
217
- walk(value, undefined);
271
+ walk(value, undefined, path);
218
272
  }
219
273
  return entries;
220
274
  }
@@ -261,6 +315,13 @@ function closingBrace(text, open) {
261
315
  }
262
316
  /** The body of `key`'s object value among the direct members of the object body `within`. */
263
317
  function memberObjectRange(text, within, key) {
318
+ const at = memberValueAt(text, within, key);
319
+ return at !== undefined && text[at] === "{"
320
+ ? { start: at + 1, end: closingBrace(text, at) }
321
+ : undefined;
322
+ }
323
+ /** Where `key`'s value starts among the direct members of the object body `within`. */
324
+ function memberValueAt(text, within, key) {
264
325
  let depth = 0;
265
326
  for (let index = within.start; index < within.end; index++) {
266
327
  const char = text[index];
@@ -277,9 +338,7 @@ function memberObjectRange(text, within, key) {
277
338
  after++;
278
339
  while (/\s/.test(text[after] ?? ""))
279
340
  after++;
280
- return text[after] === "{"
281
- ? { start: after + 1, end: closingBrace(text, after) }
282
- : undefined;
341
+ return after;
283
342
  }
284
343
  index = close;
285
344
  }
@@ -436,10 +495,14 @@ export function groupDeclaredNames(cwd) {
436
495
  }
437
496
  /**
438
497
  * Every fixed-group version the package.json files under `cwd` declare with a plain semver spec, each
439
- * with the files that declare it. An override counts: it decides what installs. `workspace:`, `link:`
440
- * and other non-semver specs are not versions.
498
+ * with the files that declare it. An override counts: it decides what installs. A peer range does
499
+ * not (`>=3.1.0` names a floor a library accepts, not a version anything loads), and `workspace:`,
500
+ * `link:` and other non-semver specs are not versions.
441
501
  */
442
502
  export function groupPinVersions(cwd) {
503
+ return groupSpecVersions(cwd, false);
504
+ }
505
+ function groupSpecVersions(cwd, peers) {
443
506
  const versions = new Map();
444
507
  for (const rel of scan(cwd, "**/package.json")) {
445
508
  let parsed;
@@ -449,8 +512,8 @@ export function groupPinVersions(cwd) {
449
512
  catch {
450
513
  continue;
451
514
  }
452
- for (const { target, spec } of pinEntries(parsed)) {
453
- if (!isFixedGroup(target))
515
+ for (const { path, target, spec } of pinEntries(parsed)) {
516
+ if (!isFixedGroup(target) || (path[0] === PEER_FIELD) !== peers)
454
517
  continue;
455
518
  const version = specVersion(spec);
456
519
  if (version === null)
@@ -537,19 +600,32 @@ function plainFileAt(cwd, rel) {
537
600
  return true;
538
601
  }
539
602
  /**
540
- * The MCP launch pin in each agent file at `cwd`, moved to `version`: the files and the edit of
541
- * `nifra init-agents --sync-mcp`, so an agent launches the nifra the project installs once it does.
603
+ * The MCP launch pin in each agent file at `cwd`, and in each file above it whose launches all serve
604
+ * it ({@link ancestorPins}), moved to `version`: the files and the edit of `nifra init-agents
605
+ * --sync-mcp`, so an agent launches the nifra the project installs once it does.
542
606
  */
543
- function agentPinEdits(cwd, version) {
607
+ function agentPinEdits(cwd, version, above) {
608
+ const target = declaresCli(cwd) ? null : version;
544
609
  const edits = [];
545
- for (const site of PIN_SITES) {
546
- if (!plainFileAt(cwd, site.path))
610
+ const sites = [
611
+ ...PIN_SITES.map((site) => ({ dir: cwd, file: site.path, path: site.path, site })),
612
+ ...above.map((entry) => ({ ...entry, file: entry.site.path })),
613
+ ];
614
+ for (const { dir, file, path, site } of sites) {
615
+ if (!plainFileAt(dir, file))
547
616
  continue;
617
+ const abs = join(dir, file);
618
+ // A launch above the project runs from that directory, which need not see the install: it stays pinned.
619
+ const to = dir === cwd ? target : version;
548
620
  // latin1 is one char per byte, so every byte outside a pin is written back as it was.
549
- const scan = site.repin(readFileSync(join(cwd, site.path), "latin1"), version);
621
+ const scan = site.repin(readFileSync(abs, "latin1"), to);
550
622
  if (scan.stale.length === 0)
551
623
  continue;
552
- edits.push({ change: { file: site.path, from: scan.stale, to: version }, text: scan.text });
624
+ edits.push({
625
+ change: { file: path, from: scan.stale, to: to ?? "unpinned" },
626
+ text: scan.text,
627
+ abs,
628
+ });
553
629
  }
554
630
  return edits;
555
631
  }
@@ -563,6 +639,62 @@ const packageVersionAt = (dir) => {
563
639
  return undefined;
564
640
  }
565
641
  };
642
+ /**
643
+ * Every `link:` or `file:` dependency whose installed folder resolves outside `cwd` and installs a
644
+ * fixed-group package of its own at a version other than `target`. Its imports resolve from its real
645
+ * path, so it keeps loading that copy after this project upgrades: a `server()` it builds can no longer
646
+ * be merged here, and single-copy never redirects across versions. A copy that resolves back inside
647
+ * `cwd` follows this project's install and is not counted.
648
+ */
649
+ export function linkedSkew(cwd, target) {
650
+ let root;
651
+ try {
652
+ root = realpathSync(cwd);
653
+ }
654
+ catch {
655
+ root = cwd;
656
+ }
657
+ const inside = (path) => path === root || path.startsWith(root + sep);
658
+ const seen = new Set();
659
+ const found = [];
660
+ for (const rel of scan(cwd, "**/package.json")) {
661
+ let manifest;
662
+ try {
663
+ manifest = JSON.parse(readFileSync(join(cwd, rel), "utf8"));
664
+ }
665
+ catch {
666
+ continue;
667
+ }
668
+ for (const field of DEP_FIELDS) {
669
+ const block = Reflect.get(Object(manifest), field);
670
+ if (typeof block !== "object" || block === null)
671
+ continue;
672
+ for (const [name, spec] of Object.entries(block)) {
673
+ if (typeof spec !== "string" || !/^(?:link|file):/.test(spec))
674
+ continue;
675
+ let path;
676
+ for (const base of [join(cwd, dirname(rel)), cwd]) {
677
+ try {
678
+ path = realpathSync(join(base, "node_modules", name));
679
+ break;
680
+ }
681
+ catch {
682
+ // Not installed beside this manifest: try the root's node_modules.
683
+ }
684
+ }
685
+ if (path === undefined || inside(path) || seen.has(path))
686
+ continue;
687
+ seen.add(path);
688
+ const installs = installedGroupPackages(path)
689
+ .filter((entry) => !inside(entry.path) && entry.version !== target)
690
+ .map((entry) => ({ package: entry.package, version: entry.version }));
691
+ if (installs.length > 0)
692
+ found.push({ package: name, declaredIn: rel, path, installs });
693
+ }
694
+ }
695
+ }
696
+ return found;
697
+ }
566
698
  /**
567
699
  * Every fixed-group package installed in `cwd/node_modules`, realpath-resolved so a linked repository
568
700
  * reports its own version. `inside` is false for one that resolves outside the workspace root.
@@ -606,16 +738,24 @@ export function installedGroupPackages(cwd) {
606
738
  return found;
607
739
  }
608
740
  /**
609
- * The lowest fixed-group version any package.json under `cwd` declares with a plain semver spec, or
610
- * null when none does. Recipes newer than it still have edits to make somewhere in the workspace.
741
+ * The version the workspace upgrades from: the lowest fixed-group version any package.json under
742
+ * `cwd` pins ({@link groupPinVersions}), since recipes newer than it still have edits to make
743
+ * somewhere. Without a pin, the lowest one installed inside the root, then the lowest peer floor;
744
+ * null when none names one.
611
745
  */
612
746
  export function installedGroupVersion(cwd) {
613
- let lowest = null;
614
- for (const version of groupPinVersions(cwd).keys()) {
615
- if (lowest === null || compareSemverSpec(version, lowest) < 0)
616
- lowest = version;
617
- }
618
- return lowest;
747
+ const lowest = (versions) => {
748
+ let found = null;
749
+ for (const version of versions)
750
+ if (found === null || compareSemverSpec(version, found) < 0)
751
+ found = version;
752
+ return found;
753
+ };
754
+ return (lowest(groupPinVersions(cwd).keys()) ??
755
+ lowest(installedGroupPackages(cwd)
756
+ .filter((entry) => entry.inside)
757
+ .map((entry) => entry.version)) ??
758
+ lowest(groupSpecVersions(cwd, true).keys()));
619
759
  }
620
760
  /**
621
761
  * Chain the recipes after `installed` (exclusive) up to `target` (inclusive): their dependency and
@@ -647,7 +787,7 @@ export function chainRecipes(target, installed) {
647
787
  };
648
788
  }
649
789
  /** Compute the plan (and, when `write`, apply it) for a target recipe against `cwd`. */
650
- export function computeUpgrade(cwd, recipe, write, allowDowngrade = false, exact = false) {
790
+ export function computeUpgrade(cwd, recipe, write, allowDowngrade = false, exact = false, above = []) {
651
791
  const pins = [];
652
792
  const agentPins = [];
653
793
  const planned = new Map();
@@ -658,6 +798,7 @@ export function computeUpgrade(cwd, recipe, write, allowDowngrade = false, exact
658
798
  const linkedOutside = installedGroupPackages(cwd)
659
799
  .filter((entry) => !entry.inside && entry.version !== recipe.version)
660
800
  .map(({ package: name, path, version }) => ({ package: name, path, version }));
801
+ const manifests = new Map();
661
802
  if ((recipe.dependencyMoves?.length ?? 0) > 0 || recipe.pins.length > 0) {
662
803
  for (const rel of scan(cwd, "**/package.json")) {
663
804
  const abs = join(cwd, rel);
@@ -670,15 +811,28 @@ export function computeUpgrade(cwd, recipe, write, allowDowngrade = false, exact
670
811
  pins.push({ file: rel, ...change });
671
812
  for (const d of pinned.downgrades)
672
813
  downgrades.push({ file: rel, ...d });
814
+ if (pinned.text !== original)
815
+ manifests.set(resolve(abs), pinned.text);
673
816
  if (write && pinned.text !== original)
674
817
  writeFileSync(abs, pinned.text);
675
818
  }
676
819
  }
677
- for (const { change, text } of agentPinEdits(cwd, recipe.version)) {
820
+ // Read against the manifests as this upgrade leaves them, so a dry run lists what --write drops.
821
+ const linkLocks = plainFileAt(cwd, BUN_LOCK) ? staleLinkLocks(resolve(cwd), manifests) : [];
822
+ let lockPruned = false;
823
+ if (write && linkLocks.length > 0) {
824
+ const lockPath = join(cwd, BUN_LOCK);
825
+ const pruned = pruneLinkLocks(readFileSync(lockPath, "utf8"), linkLocks.map((entry) => entry.package));
826
+ if (pruned !== undefined) {
827
+ writeFileSync(lockPath, pruned);
828
+ lockPruned = true;
829
+ }
830
+ }
831
+ for (const { change, text, abs } of agentPinEdits(cwd, recipe.version, above)) {
678
832
  agentPins.push(change);
679
833
  planned.set(change.file, text);
680
834
  if (write)
681
- writeFileSync(join(cwd, change.file), Buffer.from(text, "latin1"));
835
+ writeFileSync(abs, Buffer.from(text, "latin1"));
682
836
  }
683
837
  if (recipe.importMoves.length > 0) {
684
838
  for (const rel of scan(cwd, SOURCE_GLOB)) {
@@ -723,7 +877,10 @@ export function computeUpgrade(cwd, recipe, write, allowDowngrade = false, exact
723
877
  downgrades,
724
878
  retiredMarkers,
725
879
  linkedOutside,
880
+ linkedSkew: linkedSkew(cwd, recipe.version),
726
881
  strayPins: strayPins(cwd, recipe.version, planned),
882
+ linkLocks,
883
+ lockPruned,
727
884
  notes: recipe.notes ?? [],
728
885
  };
729
886
  }
@@ -743,7 +900,9 @@ function renderPlan(plan, write, from, steps) {
743
900
  plan.importMoves.length === 0 &&
744
901
  plan.retiredMarkers.length === 0 &&
745
902
  plan.linkedOutside.length === 0 &&
746
- plan.strayPins.length === 0) {
903
+ plan.linkedSkew.length === 0 &&
904
+ plan.strayPins.length === 0 &&
905
+ plan.linkLocks.length === 0) {
747
906
  lines.push("Already up to date - no changes.");
748
907
  return lines.join("\n");
749
908
  }
@@ -811,13 +970,38 @@ function renderPlan(plan, write, from, steps) {
811
970
  }
812
971
  lines.push("");
813
972
  }
973
+ if (plan.linkLocks.length > 0) {
974
+ lines.push(plan.lockPruned
975
+ ? `Dropped ${plan.linkLocks.length} file: package(s) from bun.lock, whose recorded dependencies Bun never refreshes; \`bun install\` reads each linked package.json again:`
976
+ : write
977
+ ? `bun.lock records stale dependencies for ${plan.linkLocks.length} file: package(s), which Bun never refreshes; run \`${linkLockUpdate(plan.linkLocks)}\`:`
978
+ : `bun.lock records stale dependencies for ${plan.linkLocks.length} file: package(s), which Bun never refreshes; --write drops them so \`bun install\` reads each linked package.json again:`);
979
+ for (const entry of plan.linkLocks)
980
+ lines.push(` ${entry.package} (file:${entry.path}) ${entry.changes.map(describeChange).join(", ")}`);
981
+ if (plan.lockPruned)
982
+ lines.push(" Run `bun install` before committing bun.lock: until it records these packages again, `bun install --frozen-lockfile` fails.");
983
+ lines.push("");
984
+ }
814
985
  for (const note of plan.notes)
815
986
  lines.push(`note: ${note}`);
816
987
  if (!write)
817
- lines.push("\nRe-run with --write to apply, then nifra check verifies.");
988
+ lines.push("\nRe-run with --write to apply, then install and run nifra check.");
818
989
  return lines.join("\n").trimEnd();
819
990
  }
820
991
  /** Explain a refused rollback: which pins would roll back, why it's blocked, and the escape hatch. */
992
+ /** The linked repositories to upgrade first, each with the commands that move it to `version`. */
993
+ function renderLinkedSkew(version, skew, cwd, allowed) {
994
+ const lines = [
995
+ `${allowed ? "Allowed by --allow-linked-skew" : "Blocked"}: ${skew.length} linked repositor${skew.length === 1 ? "y loads" : "ies load"} its own nifra at another version. Its imports resolve from its own node_modules, so after this upgrade a server() it builds cannot be merge()d here ("merge() requires a server() from this copy of @nifrajs/core").`,
996
+ ];
997
+ for (const entry of skew) {
998
+ const at = relative(cwd, entry.path).split(sep).join("/") || ".";
999
+ lines.push(` ${entry.package} (${entry.declaredIn}) at ${at}: ${entry.installs.map((install) => `${install.package} ${install.version}`).join(", ")}`, ` cd ${at} && nifra upgrade ${version} --write && bun install`);
1000
+ }
1001
+ if (!allowed)
1002
+ lines.push("Upgrade each one first, then run this again. --allow-linked-skew upgrades this project anyway.");
1003
+ return lines.join("\n");
1004
+ }
821
1005
  function renderDowngradeRefusal(version, downgrades) {
822
1006
  return [
823
1007
  `nifra upgrade → ${version}: refusing to DOWNGRADE ${downgrades.length} pin(s) below what's installed.`,
@@ -829,6 +1013,41 @@ function renderDowngradeRefusal(version, downgrades) {
829
1013
  "installed one, or pass --allow-downgrade if the rollback is intended.",
830
1014
  ].join("\n");
831
1015
  }
1016
+ const INSTALL_COMMANDS = [
1017
+ ["pnpm-lock.yaml", "pnpm install"],
1018
+ ["yarn.lock", "yarn install"],
1019
+ ["package-lock.json", "npm install"],
1020
+ ];
1021
+ /**
1022
+ * Whether the project needs an install before a check can judge the target: `--write` changed what
1023
+ * package.json declares or what bun.lock records, or node_modules holds a group package at another
1024
+ * version. A link from outside the root is left out; installing here does not move it.
1025
+ */
1026
+ export function pendingInstall(cwd, plan) {
1027
+ const installed = installedGroupPackages(cwd)
1028
+ .filter((entry) => entry.inside && entry.version !== plan.version)
1029
+ .map(({ package: name, version }) => ({ package: name, version }));
1030
+ const edited = plan.pins.length > 0 || plan.dependencyMoves.length > 0 || plan.lockPruned;
1031
+ if (!edited && installed.length === 0)
1032
+ return undefined;
1033
+ const command = INSTALL_COMMANDS.find(([lockfile]) => existsSync(join(cwd, lockfile)))?.[1] ?? "bun install";
1034
+ return { command, installed };
1035
+ }
1036
+ const SHOWN_INSTALLS = 3;
1037
+ function renderPendingInstall(pending, version) {
1038
+ const shown = pending.installed
1039
+ .slice(0, SHOWN_INSTALLS)
1040
+ .map((entry) => `${entry.package} ${entry.version}`);
1041
+ const more = pending.installed.length - shown.length;
1042
+ const holds = shown.length === 0
1043
+ ? "the edited pins are not installed yet"
1044
+ : `node_modules still holds ${shown.join(", ")}${more > 0 ? ` and ${more} more` : ""}`;
1045
+ return [
1046
+ `Not checked yet: \`nifra check\` reads the installed packages, and ${holds}, so it would judge the release this upgrade leaves rather than ${version}. Install, then check:`,
1047
+ ` ${pending.command}`,
1048
+ " nifra check",
1049
+ ].join("\n");
1050
+ }
832
1051
  async function hookReportBefore(cwd) {
833
1052
  try {
834
1053
  const { loadBackendApp } = await import("./load.js");
@@ -840,13 +1059,16 @@ async function hookReportBefore(cwd) {
840
1059
  }
841
1060
  }
842
1061
  /** The report after the edits, from a fresh process: the edited sources must not come from this one's
843
- * module cache. Saves the pre-upgrade report for `nifra routes --hooks --since` after an install. */
844
- async function hookScopeAcross(cwd, before) {
1062
+ * module cache. Saves the pre-upgrade report for `nifra routes --hooks --since` after an install.
1063
+ * While the edits are not installed, the old release would load in its place, so none is taken. */
1064
+ async function hookScopeAcross(cwd, before, installed) {
845
1065
  if ("error" in before)
846
1066
  return { error: before.error };
847
1067
  const saved = join(cwd, HOOKS_BEFORE_UPGRADE_FILE);
848
1068
  mkdirSync(dirname(saved), { recursive: true });
849
1069
  writeFileSync(saved, `${JSON.stringify(before, null, 2)}\n`);
1070
+ if (!installed)
1071
+ return { saved: HOOKS_BEFORE_UPGRADE_FILE, pending: "install" };
850
1072
  const entry = fileURLToPath(new URL(import.meta.url.endsWith(".ts") ? "./cli.ts" : "./cli.js", import.meta.url));
851
1073
  const child = Bun.spawn([process.execPath, entry, "routes", "--hooks", "--json"], {
852
1074
  cwd,
@@ -877,6 +1099,8 @@ function renderHookScope(scope) {
877
1099
  const head = `Hook scope: not captured (${scope.error}).`;
878
1100
  return scope.saved === undefined ? head : [head, ...since(scope.saved)].join("\n");
879
1101
  }
1102
+ if ("pending" in scope)
1103
+ return since(scope.saved).join("\n");
880
1104
  return [
881
1105
  "Hook scope across the edits (nifra routes --hooks):",
882
1106
  renderHookDiff(scope.changes)
@@ -893,6 +1117,28 @@ export function upgradeTargets(cliVersion) {
893
1117
  versions.push(cliVersion);
894
1118
  return versions.sort(compareSemverSpec);
895
1119
  }
1120
+ /** Each target with the notes of every release after the installed one: what an app can observe
1121
+ * changing on the way up. Older releases are listed by version only. */
1122
+ function renderUpgradeList(targets, installed, notes) {
1123
+ const lines = [
1124
+ installed === null
1125
+ ? "available upgrade targets:"
1126
+ : `available upgrade targets (this project declares ${installed}):`,
1127
+ ];
1128
+ for (const version of targets) {
1129
+ const ahead = installed === null || compareSemverSpec(version, installed) > 0;
1130
+ lines.push(` ${version}${version === installed ? " (declared)" : ""}`);
1131
+ if (!ahead)
1132
+ continue;
1133
+ const list = notes[version] ?? [];
1134
+ if (list.length === 0)
1135
+ lines.push(" no change an app can observe");
1136
+ for (const note of list)
1137
+ lines.push(` - ${note}`);
1138
+ }
1139
+ lines.push("", "A newer release upgrades with its own CLI: bunx @nifrajs/cli@<version> upgrade <version>");
1140
+ return lines.join("\n");
1141
+ }
896
1142
  /** The command that runs `version`'s own CLI with the same flags. `version` is a validated release. */
897
1143
  function newerCliCommand(version, options) {
898
1144
  const flags = [
@@ -910,12 +1156,12 @@ export async function runUpgrade(cwd, options) {
910
1156
  const cliVersion = options.cliVersion ?? listRecipeVersions().at(-1) ?? "0.0.0";
911
1157
  const targets = upgradeTargets(cliVersion);
912
1158
  if (options.list) {
1159
+ const installed = installedGroupVersion(cwd);
1160
+ const notes = Object.fromEntries(targets.map((v) => [v, getRecipe(v)?.notes ?? []]));
913
1161
  if (options.json)
914
- console.log(JSON.stringify({ versions: targets, cliVersion }, null, 2));
915
- else {
916
- console.log(`available upgrade targets:\n${targets.map((v) => ` ${v}`).join("\n")}\n\n` +
917
- `A newer release upgrades with its own CLI: bunx @nifrajs/cli@<version> upgrade <version>`);
918
- }
1162
+ console.log(JSON.stringify({ versions: targets, cliVersion, installed, notes }, null, 2));
1163
+ else
1164
+ console.log(renderUpgradeList(targets, installed, notes));
919
1165
  return true;
920
1166
  }
921
1167
  const { version } = options;
@@ -959,7 +1205,8 @@ export async function runUpgrade(cwd, options) {
959
1205
  const from = installedGroupVersion(cwd);
960
1206
  const recipe = chainRecipes(version, from);
961
1207
  // Fail-closed on rollback: a dry pass writes nothing, so we can refuse before any package.json is touched.
962
- const preview = computeUpgrade(cwd, recipe, false, allowDowngrade, exact);
1208
+ const above = (await ancestorPins(cwd)).owned;
1209
+ const preview = computeUpgrade(cwd, recipe, false, allowDowngrade, exact, above);
963
1210
  if (preview.downgrades.length > 0) {
964
1211
  if (options.json) {
965
1212
  console.log(JSON.stringify({ ...preview, from, steps: recipe.steps, write: false, refused: "downgrade" }, null, 2));
@@ -969,17 +1216,33 @@ export async function runUpgrade(cwd, options) {
969
1216
  }
970
1217
  return false;
971
1218
  }
1219
+ // Refused before anything is written: the linked repository fails at the first merge(), not here.
1220
+ if (preview.linkedSkew.length > 0 && options.allowLinkedSkew !== true) {
1221
+ if (options.json) {
1222
+ console.log(JSON.stringify({ ...preview, from, steps: recipe.steps, write: false, refused: "linked-skew" }, null, 2));
1223
+ }
1224
+ else {
1225
+ if (!write)
1226
+ console.log(renderPlan(preview, false, from, recipe.steps));
1227
+ console.error(renderLinkedSkew(recipe.version, preview.linkedSkew, cwd, false));
1228
+ }
1229
+ return false;
1230
+ }
972
1231
  const captureHooks = write && options.hooks !== false;
973
1232
  const before = captureHooks ? await hookReportBefore(cwd) : undefined;
974
- const plan = write ? computeUpgrade(cwd, recipe, true, allowDowngrade, exact) : preview;
975
- const hooks = before === undefined ? undefined : await hookScopeAcross(cwd, before);
976
- // Verify only makes sense once edits are on disk. Default on after --write; opt out with --no-verify.
977
- const verify = write && options.verify !== false;
1233
+ const plan = write ? computeUpgrade(cwd, recipe, true, allowDowngrade, exact, above) : preview;
1234
+ const pending = write ? pendingInstall(cwd, plan) : undefined;
1235
+ const hooks = before === undefined ? undefined : await hookScopeAcross(cwd, before, pending === undefined);
1236
+ // Verify only makes sense once edits are on disk and installed. Default on after --write; opt out
1237
+ // with --no-verify. An uninstalled upgrade passes, so `upgrade --write && bun install` chains.
1238
+ const verify = write && options.verify !== false && pending === undefined;
978
1239
  if (options.json) {
979
1240
  // The check result rides inside the one JSON document; its human report would break the stream.
980
1241
  const report = { ...plan, from, steps: recipe.steps, write };
981
1242
  if (hooks !== undefined)
982
1243
  report.hooks = hooks;
1244
+ if (pending !== undefined)
1245
+ report.install = pending;
983
1246
  let ok = true;
984
1247
  if (verify) {
985
1248
  const { collectProjectVerification } = await import("./verification.js");
@@ -992,8 +1255,12 @@ export async function runUpgrade(cwd, options) {
992
1255
  return ok;
993
1256
  }
994
1257
  console.log(renderPlan(plan, write, from, recipe.steps));
1258
+ if (plan.linkedSkew.length > 0)
1259
+ console.warn(`\n${renderLinkedSkew(recipe.version, plan.linkedSkew, cwd, true)}`);
995
1260
  if (hooks !== undefined)
996
1261
  console.log(`\n${renderHookScope(hooks)}`);
1262
+ if (pending !== undefined && options.verify !== false)
1263
+ console.log(`\n${renderPendingInstall(pending, recipe.version)}`);
997
1264
  if (verify) {
998
1265
  const { runCheck } = await import("./check.js");
999
1266
  const ok = await runCheck(cwd, { json: false });