@nifrajs/cli 5.0.0 → 5.2.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.
- package/CHANGELOG.md +3211 -0
- package/README.md +10 -2
- package/dist/agent-files.d.ts +19 -11
- package/dist/agent-files.d.ts.map +1 -1
- package/dist/agent-files.js +26 -18
- package/dist/agent-files.js.map +1 -1
- package/dist/assure-hydration.d.ts.map +1 -1
- package/dist/assure-hydration.js +5 -2
- package/dist/assure-hydration.js.map +1 -1
- package/dist/assure.d.ts +12 -2
- package/dist/assure.d.ts.map +1 -1
- package/dist/assure.js +73 -9
- package/dist/assure.js.map +1 -1
- package/dist/capabilities-tool.d.ts.map +1 -1
- package/dist/capabilities-tool.js +152 -49
- package/dist/capabilities-tool.js.map +1 -1
- package/dist/check-diagnostics.d.ts +7 -0
- package/dist/check-diagnostics.d.ts.map +1 -1
- package/dist/check-diagnostics.js +3 -0
- package/dist/check-diagnostics.js.map +1 -1
- package/dist/check-scan.d.ts +8 -2
- package/dist/check-scan.d.ts.map +1 -1
- package/dist/check-scan.js +49 -13
- package/dist/check-scan.js.map +1 -1
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +91 -45
- package/dist/check.js.map +1 -1
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +128 -59
- package/dist/cli.js.map +1 -1
- package/dist/client-module.d.ts +5 -3
- package/dist/client-module.d.ts.map +1 -1
- package/dist/client-module.js +34 -10
- package/dist/client-module.js.map +1 -1
- package/dist/command-catalog.d.ts +9 -1
- package/dist/command-catalog.d.ts.map +1 -1
- package/dist/command-catalog.js +75 -26
- package/dist/command-catalog.js.map +1 -1
- package/dist/dev-bun-config.d.ts +6 -3
- package/dist/dev-bun-config.d.ts.map +1 -1
- package/dist/dev-bun-config.js +13 -10
- package/dist/dev-bun-config.js.map +1 -1
- package/dist/dev-feed-tool.d.ts +19 -1
- package/dist/dev-feed-tool.d.ts.map +1 -1
- package/dist/dev-feed-tool.js +114 -0
- package/dist/dev-feed-tool.js.map +1 -1
- package/dist/doctor.d.ts +15 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +79 -61
- package/dist/doctor.js.map +1 -1
- package/dist/fix-recipes.d.ts +2 -0
- package/dist/fix-recipes.d.ts.map +1 -1
- package/dist/fix-recipes.js +93 -12
- package/dist/fix-recipes.js.map +1 -1
- package/dist/i18n-check.d.ts +11 -1
- package/dist/i18n-check.d.ts.map +1 -1
- package/dist/i18n-check.js +170 -17
- package/dist/i18n-check.js.map +1 -1
- package/dist/init-agents.d.ts +60 -4
- package/dist/init-agents.d.ts.map +1 -1
- package/dist/init-agents.js +196 -33
- package/dist/init-agents.js.map +1 -1
- package/dist/internal/config-paths.d.ts +16 -0
- package/dist/internal/config-paths.d.ts.map +1 -0
- package/dist/internal/config-paths.js +124 -0
- package/dist/internal/config-paths.js.map +1 -0
- package/dist/internal/installed-package.d.ts +4 -0
- package/dist/internal/installed-package.d.ts.map +1 -0
- package/dist/internal/installed-package.js +17 -0
- package/dist/internal/installed-package.js.map +1 -0
- package/dist/internal/project-specifiers.d.ts +14 -1
- package/dist/internal/project-specifiers.d.ts.map +1 -1
- package/dist/internal/project-specifiers.js +63 -16
- package/dist/internal/project-specifiers.js.map +1 -1
- package/dist/internal/source-facts.d.ts +12 -1
- package/dist/internal/source-facts.d.ts.map +1 -1
- package/dist/internal/source-facts.js +117 -5
- package/dist/internal/source-facts.js.map +1 -1
- package/dist/internal/typescript-import.d.ts.map +1 -1
- package/dist/internal/typescript-import.js +5 -3
- package/dist/internal/typescript-import.js.map +1 -1
- package/dist/internal/workspace-packages.d.ts +22 -0
- package/dist/internal/workspace-packages.d.ts.map +1 -0
- package/dist/internal/workspace-packages.js +215 -0
- package/dist/internal/workspace-packages.js.map +1 -0
- package/dist/introspect.d.ts +9 -0
- package/dist/introspect.d.ts.map +1 -1
- package/dist/introspect.js +32 -1
- package/dist/introspect.js.map +1 -1
- package/dist/levels-tool.d.ts.map +1 -1
- package/dist/levels-tool.js +5 -8
- package/dist/levels-tool.js.map +1 -1
- package/dist/load.d.ts +9 -4
- package/dist/load.d.ts.map +1 -1
- package/dist/load.js +32 -3
- package/dist/load.js.map +1 -1
- package/dist/lock-links.d.ts +42 -0
- package/dist/lock-links.d.ts.map +1 -0
- package/dist/lock-links.js +144 -0
- package/dist/lock-links.js.map +1 -0
- package/dist/mcp-context.d.ts.map +1 -1
- package/dist/mcp-context.js +6 -21
- package/dist/mcp-context.js.map +1 -1
- package/dist/mcp-delegate.d.ts +2 -2
- package/dist/mcp-delegate.d.ts.map +1 -1
- package/dist/mcp-delegate.js +19 -7
- package/dist/mcp-delegate.js.map +1 -1
- package/dist/mcp-exec.d.ts +1 -0
- package/dist/mcp-exec.d.ts.map +1 -1
- package/dist/mcp-exec.js +13 -5
- package/dist/mcp-exec.js.map +1 -1
- package/dist/mcp-http.js +1 -1
- package/dist/mcp-io.d.ts +13 -0
- package/dist/mcp-io.d.ts.map +1 -1
- package/dist/mcp-io.js +23 -0
- package/dist/mcp-io.js.map +1 -1
- package/dist/mcp-path.d.ts +2 -1
- package/dist/mcp-path.d.ts.map +1 -1
- package/dist/mcp-path.js +9 -24
- package/dist/mcp-path.js.map +1 -1
- package/dist/mcp-root.d.ts +6 -4
- package/dist/mcp-root.d.ts.map +1 -1
- package/dist/mcp-root.js +12 -8
- package/dist/mcp-root.js.map +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +40 -17
- package/dist/mcp.js.map +1 -1
- package/dist/migrate-layout.d.ts +41 -1
- package/dist/migrate-layout.d.ts.map +1 -1
- package/dist/migrate-layout.js +1729 -236
- package/dist/migrate-layout.js.map +1 -1
- package/dist/output-schemas.d.ts +34 -0
- package/dist/output-schemas.d.ts.map +1 -1
- package/dist/output-schemas.js +132 -21
- package/dist/output-schemas.js.map +1 -1
- package/dist/project-path.d.ts +6 -0
- package/dist/project-path.d.ts.map +1 -1
- package/dist/project-path.js +48 -14
- package/dist/project-path.js.map +1 -1
- package/dist/project-site.d.ts +7 -0
- package/dist/project-site.d.ts.map +1 -0
- package/dist/project-site.js +19 -0
- package/dist/project-site.js.map +1 -0
- package/dist/recipes/4.0.0.d.ts.map +1 -1
- package/dist/recipes/4.0.0.js +2 -0
- package/dist/recipes/4.0.0.js.map +1 -1
- package/dist/recipes/5.1.0.d.ts +9 -0
- package/dist/recipes/5.1.0.d.ts.map +1 -0
- package/dist/recipes/5.1.0.js +22 -0
- package/dist/recipes/5.1.0.js.map +1 -0
- package/dist/recipes/5.2.0.d.ts +10 -0
- package/dist/recipes/5.2.0.d.ts.map +1 -0
- package/dist/recipes/5.2.0.js +32 -0
- package/dist/recipes/5.2.0.js.map +1 -0
- package/dist/recipes/index.d.ts +3 -0
- package/dist/recipes/index.d.ts.map +1 -1
- package/dist/recipes/index.js +7 -0
- package/dist/recipes/index.js.map +1 -1
- package/dist/release-verification.d.ts +5 -0
- package/dist/release-verification.d.ts.map +1 -1
- package/dist/release-verification.js +14 -0
- package/dist/release-verification.js.map +1 -1
- package/dist/review.d.ts.map +1 -1
- package/dist/review.js +7 -0
- package/dist/review.js.map +1 -1
- package/dist/rule-explain.d.ts +26 -0
- package/dist/rule-explain.d.ts.map +1 -0
- package/dist/rule-explain.js +49 -0
- package/dist/rule-explain.js.map +1 -0
- package/dist/rules/codes.d.ts +5 -1
- package/dist/rules/codes.d.ts.map +1 -1
- package/dist/rules/codes.js +5 -1
- package/dist/rules/codes.js.map +1 -1
- package/dist/rules/contract-visibility.d.ts.map +1 -1
- package/dist/rules/contract-visibility.js +93 -21
- package/dist/rules/contract-visibility.js.map +1 -1
- package/dist/rules/data-guard.d.ts +6 -0
- package/dist/rules/data-guard.d.ts.map +1 -1
- package/dist/rules/data-guard.js +37 -0
- package/dist/rules/data-guard.js.map +1 -1
- package/dist/rules/explanations.d.ts +14 -0
- package/dist/rules/explanations.d.ts.map +1 -0
- package/dist/rules/explanations.js +316 -0
- package/dist/rules/explanations.js.map +1 -0
- package/dist/rules/legacy.d.ts.map +1 -1
- package/dist/rules/legacy.js +44 -2
- package/dist/rules/legacy.js.map +1 -1
- package/dist/rules/merge-auth.d.ts +12 -0
- package/dist/rules/merge-auth.d.ts.map +1 -0
- package/dist/rules/merge-auth.js +52 -0
- package/dist/rules/merge-auth.js.map +1 -0
- package/dist/rules/pages.d.ts +56 -3
- package/dist/rules/pages.d.ts.map +1 -1
- package/dist/rules/pages.js +412 -23
- package/dist/rules/pages.js.map +1 -1
- package/dist/rules/routes.d.ts +3 -2
- package/dist/rules/routes.d.ts.map +1 -1
- package/dist/rules/routes.js +4 -3
- package/dist/rules/routes.js.map +1 -1
- package/dist/rules/security.d.ts +3 -2
- package/dist/rules/security.d.ts.map +1 -1
- package/dist/rules/security.js +42 -11
- package/dist/rules/security.js.map +1 -1
- package/dist/rules/zones.d.ts.map +1 -1
- package/dist/rules/zones.js +34 -11
- package/dist/rules/zones.js.map +1 -1
- package/dist/stylex-migrate.d.ts.map +1 -1
- package/dist/stylex-migrate.js +127 -17
- package/dist/stylex-migrate.js.map +1 -1
- package/dist/test-tool.d.ts.map +1 -1
- package/dist/test-tool.js +3 -9
- package/dist/test-tool.js.map +1 -1
- package/dist/typecheck-coverage.d.ts +11 -0
- package/dist/typecheck-coverage.d.ts.map +1 -1
- package/dist/typecheck-coverage.js +50 -7
- package/dist/typecheck-coverage.js.map +1 -1
- package/dist/upgrade.d.ts +57 -6
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +247 -19
- package/dist/upgrade.js.map +1 -1
- package/dist/verification-plan.d.ts.map +1 -1
- package/dist/verification-plan.js +7 -2
- package/dist/verification-plan.js.map +1 -1
- package/dist/version-drift.d.ts.map +1 -1
- package/dist/version-drift.js +66 -3
- package/dist/version-drift.js.map +1 -1
- package/dist/web-app-options.d.ts +1 -1
- package/dist/web-app-options.d.ts.map +1 -1
- package/dist/web-app-options.js.map +1 -1
- package/docs/examples.json +21 -3
- package/docs/llms-full.txt +1083 -168
- package/docs/types.json +535 -112
- package/package.json +13 -12
- package/src/agent-files.ts +27 -17
- package/src/assure-hydration.ts +5 -1
- package/src/assure.ts +99 -11
- package/src/capabilities-tool.ts +188 -53
- package/src/check-diagnostics.ts +10 -0
- package/src/check-scan.ts +65 -12
- package/src/check.ts +122 -51
- package/src/cli.ts +127 -45
- package/src/client-module.ts +45 -9
- package/src/command-catalog.ts +92 -28
- package/src/dev-bun-config.ts +13 -9
- package/src/dev-feed-tool.ts +146 -1
- package/src/doctor.ts +102 -66
- package/src/fix-recipes.ts +101 -10
- package/src/i18n-check.ts +254 -18
- package/src/init-agents.ts +225 -44
- package/src/internal/config-paths.ts +154 -0
- package/src/internal/installed-package.ts +15 -0
- package/src/internal/project-specifiers.ts +78 -17
- package/src/internal/source-facts.ts +147 -5
- package/src/internal/typescript-import.ts +5 -3
- package/src/internal/workspace-packages.ts +218 -0
- package/src/introspect.ts +39 -1
- package/src/levels-tool.ts +7 -9
- package/src/load.ts +46 -4
- package/src/lock-links.ts +173 -0
- package/src/mcp-context.ts +5 -18
- package/src/mcp-delegate.ts +22 -10
- package/src/mcp-exec.ts +14 -4
- package/src/mcp-http.ts +1 -1
- package/src/mcp-io.ts +33 -0
- package/src/mcp-path.ts +8 -22
- package/src/mcp-root.ts +14 -8
- package/src/mcp.ts +48 -19
- package/src/migrate-layout.ts +1968 -245
- package/src/output-schemas.ts +179 -23
- package/src/project-path.ts +44 -13
- package/src/project-site.ts +18 -0
- package/src/recipes/4.0.0.ts +2 -0
- package/src/recipes/5.1.0.ts +23 -0
- package/src/recipes/5.2.0.ts +33 -0
- package/src/recipes/index.ts +7 -0
- package/src/release-verification.ts +20 -0
- package/src/review.ts +7 -0
- package/src/rule-explain.ts +75 -0
- package/src/rules/codes.ts +5 -1
- package/src/rules/contract-visibility.ts +118 -20
- package/src/rules/data-guard.ts +40 -0
- package/src/rules/explanations.ts +329 -0
- package/src/rules/legacy.ts +46 -2
- package/src/rules/merge-auth.ts +55 -0
- package/src/rules/pages.ts +486 -25
- package/src/rules/routes.ts +4 -3
- package/src/rules/security.ts +49 -11
- package/src/rules/zones.ts +33 -9
- package/src/stylex-migrate.ts +117 -17
- package/src/test-tool.ts +3 -9
- package/src/typecheck-coverage.ts +51 -6
- package/src/upgrade.ts +312 -19
- package/src/verification-plan.ts +15 -2
- package/src/version-drift.ts +68 -2
- package/src/web-app-options.ts +9 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typecheck-coverage.js","sourceRoot":"","sources":["../src/typecheck-coverage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAChE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAA;AACxE,MAAM,SAAS,GAAG,oBAAoB,CAAA;AACtC,MAAM,gBAAgB,GAAG,2CAA2C,CAAA;AACpE,MAAM,cAAc,GAAG,2CAA2C,CAAA;AAElE,6FAA6F;AAC7F,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAI7C,MAAM,YAAY,GAAa,EAAE,CAAA;IACjC,MAAM,IAAI,GAAa,EAAE,CAAA;IACzB,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;YACvF,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CA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|
* package.json files, preserving the caret/tilde/exact style and skipping `workspace:`/`link:` specs.
|
|
8
|
-
* `overrides`, `resolutions` and `pnpm.overrides` are swept too, since they decide what installs
|
|
9
|
-
*
|
|
8
|
+
* `overrides`, `resolutions` and `pnpm.overrides` are swept too, since they decide what installs.
|
|
9
|
+
* The MCP launch pin in `.mcp.json`, `.cursor/mcp.json`, CLAUDE.md and AGENTS.md moves too, the
|
|
10
|
+
* edit `nifra init-agents --sync-mcp` makes; a version pinned anywhere else (a Dockerfile, a CI
|
|
11
|
+
* workflow, another lockfile) is listed only.
|
|
10
12
|
* 2. **dependency moves** - replace removed packages with their supported successor without
|
|
11
13
|
* reserializing package.json or leaving duplicate dependency keys.
|
|
12
14
|
* 3. **import moves** - rewrite exact import specifiers to their updated module paths.
|
|
@@ -24,6 +26,8 @@
|
|
|
24
26
|
* transforms are a future addition - a recipe that needs one is the signal to add the engine, not before.
|
|
25
27
|
*/
|
|
26
28
|
import { type HookReportChange } from "./hooks-report.js";
|
|
29
|
+
import { type AncestorPinSite } from "./init-agents.js";
|
|
30
|
+
import { type StaleLinkLock } from "./lock-links.js";
|
|
27
31
|
import { type UpgradeRecipe } from "./recipes/index.js";
|
|
28
32
|
export interface UpgradeOptions {
|
|
29
33
|
/** Target version, e.g. "1.8.0". Required unless `list` is set. */
|
|
@@ -47,6 +51,8 @@ export interface UpgradeOptions {
|
|
|
47
51
|
* change in which hooks run where is visible. Loads the backend. Default true; `--no-hooks` skips it.
|
|
48
52
|
*/
|
|
49
53
|
readonly hooks?: boolean;
|
|
54
|
+
/** Proceed although a linked repository loads its own nifra at another version. Default false. */
|
|
55
|
+
readonly allowLinkedSkew?: boolean;
|
|
50
56
|
}
|
|
51
57
|
export interface PinChange {
|
|
52
58
|
readonly file: string;
|
|
@@ -70,6 +76,15 @@ export interface DependencyMoveChange {
|
|
|
70
76
|
readonly toVersion: string;
|
|
71
77
|
readonly action: "renamed" | "removed";
|
|
72
78
|
}
|
|
79
|
+
/** An agent file whose MCP launch pins another `@nifrajs/cli`, re-pinned to the target. */
|
|
80
|
+
export interface AgentPinChange {
|
|
81
|
+
readonly file: string;
|
|
82
|
+
/** The versions it pinned, in order of appearance. */
|
|
83
|
+
readonly from: readonly string[];
|
|
84
|
+
/** The target version, or `unpinned` when the project declares `@nifrajs/cli`: the launch then runs
|
|
85
|
+
* that install and never needs re-pinning. */
|
|
86
|
+
readonly to: string;
|
|
87
|
+
}
|
|
73
88
|
/** A retired comment in the project, and the line it applied to before the release retired it. */
|
|
74
89
|
export interface RetiredMarkerSite {
|
|
75
90
|
readonly file: string;
|
|
@@ -85,6 +100,7 @@ export interface RetiredMarkerSite {
|
|
|
85
100
|
export interface UpgradePlan {
|
|
86
101
|
readonly version: string;
|
|
87
102
|
readonly pins: readonly PinChange[];
|
|
103
|
+
readonly agentPins: readonly AgentPinChange[];
|
|
88
104
|
readonly dependencyMoves: readonly DependencyMoveChange[];
|
|
89
105
|
readonly importMoves: readonly ImportChange[];
|
|
90
106
|
/** Pins refused because the target is BELOW the installed version (a rollback). Empty when allowed. */
|
|
@@ -93,8 +109,16 @@ export interface UpgradePlan {
|
|
|
93
109
|
readonly retiredMarkers: readonly RetiredMarkerSite[];
|
|
94
110
|
/** Installed group packages linked from outside the workspace root, at another version. Never edited. */
|
|
95
111
|
readonly linkedOutside: readonly LinkedGroupInstall[];
|
|
112
|
+
/** Repositories a `link:`/`file:` dependency points outside the root, each loading its own nifra at
|
|
113
|
+
* another version. Never edited; the upgrade refuses while any is listed. */
|
|
114
|
+
readonly linkedSkew: readonly LinkedSkew[];
|
|
96
115
|
/** Other versions pinned outside package.json. Never edited. */
|
|
97
116
|
readonly strayPins: readonly StrayPin[];
|
|
117
|
+
/** `file:` entries of the project's bun.lock whose recorded dependencies the linked package.json
|
|
118
|
+
* (as this upgrade leaves it) no longer declares. Bun never refreshes them on its own. */
|
|
119
|
+
readonly linkLocks: readonly StaleLinkLock[];
|
|
120
|
+
/** Whether `--write` dropped {@link linkLocks} from bun.lock, so `bun install` re-reads them. */
|
|
121
|
+
readonly lockPruned: boolean;
|
|
98
122
|
readonly notes: readonly string[];
|
|
99
123
|
}
|
|
100
124
|
/**
|
|
@@ -145,6 +169,9 @@ export declare function applyImportMoves(text: string, moves: readonly {
|
|
|
145
169
|
count: number;
|
|
146
170
|
}>;
|
|
147
171
|
};
|
|
172
|
+
export declare const isFixedGroup: (name: string) => boolean;
|
|
173
|
+
/** Every fixed-group package a package.json under `cwd` names, whatever its spec. */
|
|
174
|
+
export declare function groupDeclaredNames(cwd: string): ReadonlySet<string>;
|
|
148
175
|
/**
|
|
149
176
|
* Every fixed-group version the package.json files under `cwd` declare with a plain semver spec, each
|
|
150
177
|
* with the files that declare it. An override counts: it decides what installs. `workspace:`, `link:`
|
|
@@ -163,16 +190,40 @@ export interface StrayPin {
|
|
|
163
190
|
readonly more: number;
|
|
164
191
|
}
|
|
165
192
|
/**
|
|
166
|
-
* Fixed-group versions other than `version` pinned where `nifra upgrade` does not edit: MCP configs
|
|
167
|
-
* container files, CI workflows, and lockfiles besides
|
|
193
|
+
* Fixed-group versions other than `version` pinned where `nifra upgrade` does not edit: MCP configs and
|
|
194
|
+
* agent guidance beyond the launch pin it moves, container files, CI workflows, and lockfiles besides
|
|
195
|
+
* the workspace's own (which install rewrites). `planned` holds a file's text after the upgrade's own
|
|
196
|
+
* edits, so a dry run lists what `--write` would leave.
|
|
168
197
|
*/
|
|
169
|
-
export declare function strayPins(cwd: string, version: string): StrayPin[];
|
|
198
|
+
export declare function strayPins(cwd: string, version: string, planned?: ReadonlyMap<string, string>): StrayPin[];
|
|
170
199
|
/** An installed fixed-group package, followed to its real location. */
|
|
171
200
|
export interface LinkedGroupInstall {
|
|
172
201
|
readonly package: string;
|
|
173
202
|
readonly path: string;
|
|
174
203
|
readonly version: string;
|
|
175
204
|
}
|
|
205
|
+
/** A repository linked into the project that resolves nifra from its own `node_modules`. */
|
|
206
|
+
export interface LinkedSkew {
|
|
207
|
+
/** The dependency's name, as the manifest declares it. */
|
|
208
|
+
readonly package: string;
|
|
209
|
+
/** The project-relative manifest that declares it. */
|
|
210
|
+
readonly declaredIn: string;
|
|
211
|
+
/** The linked repository's real path. */
|
|
212
|
+
readonly path: string;
|
|
213
|
+
/** Each fixed-group package it installs itself, at a version other than the target. */
|
|
214
|
+
readonly installs: readonly {
|
|
215
|
+
readonly package: string;
|
|
216
|
+
readonly version: string;
|
|
217
|
+
}[];
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Every `link:` or `file:` dependency whose installed folder resolves outside `cwd` and installs a
|
|
221
|
+
* fixed-group package of its own at a version other than `target`. Its imports resolve from its real
|
|
222
|
+
* path, so it keeps loading that copy after this project upgrades: a `server()` it builds can no longer
|
|
223
|
+
* be merged here, and single-copy never redirects across versions. A copy that resolves back inside
|
|
224
|
+
* `cwd` follows this project's install and is not counted.
|
|
225
|
+
*/
|
|
226
|
+
export declare function linkedSkew(cwd: string, target: string): readonly LinkedSkew[];
|
|
176
227
|
/**
|
|
177
228
|
* Every fixed-group package installed in `cwd/node_modules`, realpath-resolved so a linked repository
|
|
178
229
|
* reports its own version. `inside` is false for one that resolves outside the workspace root.
|
|
@@ -197,7 +248,7 @@ export interface ChainedRecipe extends UpgradeRecipe {
|
|
|
197
248
|
*/
|
|
198
249
|
export declare function chainRecipes(target: string, installed: string | null): ChainedRecipe;
|
|
199
250
|
/** Compute the plan (and, when `write`, apply it) for a target recipe against `cwd`. */
|
|
200
|
-
export declare function computeUpgrade(cwd: string, recipe: UpgradeRecipe, write: boolean, allowDowngrade?: boolean, exact?: boolean): UpgradePlan;
|
|
251
|
+
export declare function computeUpgrade(cwd: string, recipe: UpgradeRecipe, write: boolean, allowDowngrade?: boolean, exact?: boolean, above?: readonly AncestorPinSite[]): UpgradePlan;
|
|
201
252
|
/** The hook report around `--write`: the diff and where the pre-upgrade report was saved, or why not. */
|
|
202
253
|
export type UpgradeHookScope = {
|
|
203
254
|
readonly saved: string;
|
package/dist/upgrade.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAgBH,OAAO,EAIL,KAAK,gBAAgB,EAGtB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,KAAK,eAAe,EAAwC,MAAM,kBAAkB,CAAA;AAC7F,OAAO,EAKL,KAAK,aAAa,EAEnB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAiC,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGtF,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,mFAAmF;IACnF,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;IACxB,uEAAuE;IACvE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IACvB,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IACvB,yFAAyF;IACzF,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,6FAA6F;IAC7F,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAA;IACjC,iGAAiG;IACjG,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;IACxB,2FAA2F;IAC3F,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;IACxB,kGAAkG;IAClG,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CACnC;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC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zE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAiEvD,iGAAiG;AACjG,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAM3D;AA0CD,wGAAwG;AACxG,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAqIvF"}
|
package/dist/upgrade.js
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
*
|
|
6
6
|
* 1. **pin sweep** - set every matching dependency to the target version across the workspace's
|
|
7
7
|
* package.json files, preserving the caret/tilde/exact style and skipping `workspace:`/`link:` specs.
|
|
8
|
-
* `overrides`, `resolutions` and `pnpm.overrides` are swept too, since they decide what installs
|
|
9
|
-
*
|
|
8
|
+
* `overrides`, `resolutions` and `pnpm.overrides` are swept too, since they decide what installs.
|
|
9
|
+
* The MCP launch pin in `.mcp.json`, `.cursor/mcp.json`, CLAUDE.md and AGENTS.md moves too, the
|
|
10
|
+
* edit `nifra init-agents --sync-mcp` makes; a version pinned anywhere else (a Dockerfile, a CI
|
|
11
|
+
* workflow, another lockfile) is listed only.
|
|
10
12
|
* 2. **dependency moves** - replace removed packages with their supported successor without
|
|
11
13
|
* reserializing package.json or leaving duplicate dependency keys.
|
|
12
14
|
* 3. **import moves** - rewrite exact import specifiers to their updated module paths.
|
|
@@ -23,11 +25,13 @@
|
|
|
23
25
|
* Deliberately NOT a codemod engine: transforms are string/specifier-level only. Structural (AST)
|
|
24
26
|
* transforms are a future addition - a recipe that needs one is the signal to add the engine, not before.
|
|
25
27
|
*/
|
|
26
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, statSync, writeFileSync, } from "node:fs";
|
|
27
|
-
import { dirname, join, relative, sep } from "node:path";
|
|
28
|
+
import { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, statSync, writeFileSync, } from "node:fs";
|
|
29
|
+
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
28
30
|
import { fileURLToPath } from "node:url";
|
|
29
31
|
import { Glob } from "bun";
|
|
30
32
|
import { collectHookReport, diffHookReports, HOOKS_BEFORE_UPGRADE_FILE, parseHookReport, renderHookDiff, } from "./hooks-report.js";
|
|
33
|
+
import { ancestorPins, declaresCli, PIN_SITES } from "./init-agents.js";
|
|
34
|
+
import { BUN_LOCK, describeChange, linkLockUpdate, pruneLinkLocks, staleLinkLocks, } from "./lock-links.js";
|
|
31
35
|
import { getRecipe, listRecipeVersions } from "./recipes/index.js";
|
|
32
36
|
import { markerTarget } from "./rules/comment-markers.js";
|
|
33
37
|
const DEP_FIELDS = [
|
|
@@ -409,12 +413,28 @@ function scan(cwd, pattern, dot = false) {
|
|
|
409
413
|
return out.sort(); // deterministic order
|
|
410
414
|
}
|
|
411
415
|
// The fixed version group: every package released together at one version.
|
|
412
|
-
const isFixedGroup = (name) => name.startsWith("@nifrajs/") || name === "nifra" || name === "create-nifra";
|
|
416
|
+
export const isFixedGroup = (name) => name.startsWith("@nifrajs/") || name === "nifra" || name === "create-nifra";
|
|
413
417
|
const groupPins = (version) => [
|
|
414
418
|
{ match: "@nifrajs/", to: version },
|
|
415
419
|
{ match: "create-nifra", to: version },
|
|
416
420
|
{ match: "nifra", to: version },
|
|
417
421
|
];
|
|
422
|
+
/** Every fixed-group package a package.json under `cwd` names, whatever its spec. */
|
|
423
|
+
export function groupDeclaredNames(cwd) {
|
|
424
|
+
const names = new Set();
|
|
425
|
+
for (const rel of scan(cwd, "**/package.json")) {
|
|
426
|
+
try {
|
|
427
|
+
const parsed = JSON.parse(readFileSync(join(cwd, rel), "utf8"));
|
|
428
|
+
for (const { target } of pinEntries(parsed))
|
|
429
|
+
if (isFixedGroup(target))
|
|
430
|
+
names.add(target);
|
|
431
|
+
}
|
|
432
|
+
catch {
|
|
433
|
+
// Not JSON: it declares nothing.
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return names;
|
|
437
|
+
}
|
|
418
438
|
/**
|
|
419
439
|
* Every fixed-group version the package.json files under `cwd` declare with a plain semver spec, each
|
|
420
440
|
* with the files that declare it. An override counts: it decides what installs. `workspace:`, `link:`
|
|
@@ -446,6 +466,7 @@ export function groupPinVersions(cwd) {
|
|
|
446
466
|
}
|
|
447
467
|
const STRAY_PIN_FILES = [
|
|
448
468
|
"**/{.mcp.json,mcp.json}",
|
|
469
|
+
"**/{AGENTS.md,CLAUDE.md}",
|
|
449
470
|
"**/{Dockerfile,Dockerfile.*,*.Dockerfile,*.dockerfile,Containerfile}",
|
|
450
471
|
"**/{docker-compose,compose}*.{yml,yaml}",
|
|
451
472
|
".github/workflows/*.{yml,yaml}",
|
|
@@ -456,10 +477,12 @@ const STRAY_PIN_FILES = [
|
|
|
456
477
|
const LOCKFILE = /(?:\.lock|package-lock\.json|pnpm-lock\.yaml)$/;
|
|
457
478
|
const GROUP_PIN = /(?<![\w.@/-])(@nifrajs\/[a-z0-9._-]+|create-nifra|nifra)@(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)/g;
|
|
458
479
|
/**
|
|
459
|
-
* Fixed-group versions other than `version` pinned where `nifra upgrade` does not edit: MCP configs
|
|
460
|
-
* container files, CI workflows, and lockfiles besides
|
|
480
|
+
* Fixed-group versions other than `version` pinned where `nifra upgrade` does not edit: MCP configs and
|
|
481
|
+
* agent guidance beyond the launch pin it moves, container files, CI workflows, and lockfiles besides
|
|
482
|
+
* the workspace's own (which install rewrites). `planned` holds a file's text after the upgrade's own
|
|
483
|
+
* edits, so a dry run lists what `--write` would leave.
|
|
461
484
|
*/
|
|
462
|
-
export function strayPins(cwd, version) {
|
|
485
|
+
export function strayPins(cwd, version, planned = new Map()) {
|
|
463
486
|
const found = [];
|
|
464
487
|
const files = new Set(STRAY_PIN_FILES.flatMap((pattern) => scan(cwd, pattern, true)));
|
|
465
488
|
for (const rel of [...files].sort()) {
|
|
@@ -470,7 +493,7 @@ export function strayPins(cwd, version) {
|
|
|
470
493
|
try {
|
|
471
494
|
if (statSync(join(cwd, rel)).size > 8_000_000)
|
|
472
495
|
continue;
|
|
473
|
-
text = readFileSync(join(cwd, rel), "utf8");
|
|
496
|
+
text = planned.get(rel) ?? readFileSync(join(cwd, rel), "utf8");
|
|
474
497
|
}
|
|
475
498
|
catch {
|
|
476
499
|
continue;
|
|
@@ -494,6 +517,56 @@ export function strayPins(cwd, version) {
|
|
|
494
517
|
}
|
|
495
518
|
return found;
|
|
496
519
|
}
|
|
520
|
+
/** Whether `rel` is a regular file under `cwd` reached through no symlink: the upgrade's write boundary. */
|
|
521
|
+
function plainFileAt(cwd, rel) {
|
|
522
|
+
let path = cwd;
|
|
523
|
+
const parts = rel.split("/");
|
|
524
|
+
for (const [index, part] of parts.entries()) {
|
|
525
|
+
path = join(path, part);
|
|
526
|
+
let stat;
|
|
527
|
+
try {
|
|
528
|
+
stat = lstatSync(path);
|
|
529
|
+
}
|
|
530
|
+
catch {
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
if (stat.isSymbolicLink())
|
|
534
|
+
return false;
|
|
535
|
+
if (index === parts.length - 1 ? !stat.isFile() : !stat.isDirectory())
|
|
536
|
+
return false;
|
|
537
|
+
}
|
|
538
|
+
return true;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* The MCP launch pin in each agent file at `cwd`, and in each file above it whose launches all serve
|
|
542
|
+
* it ({@link ancestorPins}), moved to `version`: the files and the edit of `nifra init-agents
|
|
543
|
+
* --sync-mcp`, so an agent launches the nifra the project installs once it does.
|
|
544
|
+
*/
|
|
545
|
+
function agentPinEdits(cwd, version, above) {
|
|
546
|
+
const target = declaresCli(cwd) ? null : version;
|
|
547
|
+
const edits = [];
|
|
548
|
+
const sites = [
|
|
549
|
+
...PIN_SITES.map((site) => ({ dir: cwd, file: site.path, path: site.path, site })),
|
|
550
|
+
...above.map((entry) => ({ ...entry, file: entry.site.path })),
|
|
551
|
+
];
|
|
552
|
+
for (const { dir, file, path, site } of sites) {
|
|
553
|
+
if (!plainFileAt(dir, file))
|
|
554
|
+
continue;
|
|
555
|
+
const abs = join(dir, file);
|
|
556
|
+
// A launch above the project runs from that directory, which need not see the install: it stays pinned.
|
|
557
|
+
const to = dir === cwd ? target : version;
|
|
558
|
+
// latin1 is one char per byte, so every byte outside a pin is written back as it was.
|
|
559
|
+
const scan = site.repin(readFileSync(abs, "latin1"), to);
|
|
560
|
+
if (scan.stale.length === 0)
|
|
561
|
+
continue;
|
|
562
|
+
edits.push({
|
|
563
|
+
change: { file: path, from: scan.stale, to: to ?? "unpinned" },
|
|
564
|
+
text: scan.text,
|
|
565
|
+
abs,
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
return edits;
|
|
569
|
+
}
|
|
497
570
|
const packageVersionAt = (dir) => {
|
|
498
571
|
try {
|
|
499
572
|
const meta = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
|
|
@@ -504,6 +577,62 @@ const packageVersionAt = (dir) => {
|
|
|
504
577
|
return undefined;
|
|
505
578
|
}
|
|
506
579
|
};
|
|
580
|
+
/**
|
|
581
|
+
* Every `link:` or `file:` dependency whose installed folder resolves outside `cwd` and installs a
|
|
582
|
+
* fixed-group package of its own at a version other than `target`. Its imports resolve from its real
|
|
583
|
+
* path, so it keeps loading that copy after this project upgrades: a `server()` it builds can no longer
|
|
584
|
+
* be merged here, and single-copy never redirects across versions. A copy that resolves back inside
|
|
585
|
+
* `cwd` follows this project's install and is not counted.
|
|
586
|
+
*/
|
|
587
|
+
export function linkedSkew(cwd, target) {
|
|
588
|
+
let root;
|
|
589
|
+
try {
|
|
590
|
+
root = realpathSync(cwd);
|
|
591
|
+
}
|
|
592
|
+
catch {
|
|
593
|
+
root = cwd;
|
|
594
|
+
}
|
|
595
|
+
const inside = (path) => path === root || path.startsWith(root + sep);
|
|
596
|
+
const seen = new Set();
|
|
597
|
+
const found = [];
|
|
598
|
+
for (const rel of scan(cwd, "**/package.json")) {
|
|
599
|
+
let manifest;
|
|
600
|
+
try {
|
|
601
|
+
manifest = JSON.parse(readFileSync(join(cwd, rel), "utf8"));
|
|
602
|
+
}
|
|
603
|
+
catch {
|
|
604
|
+
continue;
|
|
605
|
+
}
|
|
606
|
+
for (const field of DEP_FIELDS) {
|
|
607
|
+
const block = Reflect.get(Object(manifest), field);
|
|
608
|
+
if (typeof block !== "object" || block === null)
|
|
609
|
+
continue;
|
|
610
|
+
for (const [name, spec] of Object.entries(block)) {
|
|
611
|
+
if (typeof spec !== "string" || !/^(?:link|file):/.test(spec))
|
|
612
|
+
continue;
|
|
613
|
+
let path;
|
|
614
|
+
for (const base of [join(cwd, dirname(rel)), cwd]) {
|
|
615
|
+
try {
|
|
616
|
+
path = realpathSync(join(base, "node_modules", name));
|
|
617
|
+
break;
|
|
618
|
+
}
|
|
619
|
+
catch {
|
|
620
|
+
// Not installed beside this manifest: try the root's node_modules.
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
if (path === undefined || inside(path) || seen.has(path))
|
|
624
|
+
continue;
|
|
625
|
+
seen.add(path);
|
|
626
|
+
const installs = installedGroupPackages(path)
|
|
627
|
+
.filter((entry) => !inside(entry.path) && entry.version !== target)
|
|
628
|
+
.map((entry) => ({ package: entry.package, version: entry.version }));
|
|
629
|
+
if (installs.length > 0)
|
|
630
|
+
found.push({ package: name, declaredIn: rel, path, installs });
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
return found;
|
|
635
|
+
}
|
|
507
636
|
/**
|
|
508
637
|
* Every fixed-group package installed in `cwd/node_modules`, realpath-resolved so a linked repository
|
|
509
638
|
* reports its own version. `inside` is false for one that resolves outside the workspace root.
|
|
@@ -588,8 +717,10 @@ export function chainRecipes(target, installed) {
|
|
|
588
717
|
};
|
|
589
718
|
}
|
|
590
719
|
/** Compute the plan (and, when `write`, apply it) for a target recipe against `cwd`. */
|
|
591
|
-
export function computeUpgrade(cwd, recipe, write, allowDowngrade = false, exact = false) {
|
|
720
|
+
export function computeUpgrade(cwd, recipe, write, allowDowngrade = false, exact = false, above = []) {
|
|
592
721
|
const pins = [];
|
|
722
|
+
const agentPins = [];
|
|
723
|
+
const planned = new Map();
|
|
593
724
|
const dependencyMoves = [];
|
|
594
725
|
const importMoves = [];
|
|
595
726
|
const downgrades = [];
|
|
@@ -597,6 +728,7 @@ export function computeUpgrade(cwd, recipe, write, allowDowngrade = false, exact
|
|
|
597
728
|
const linkedOutside = installedGroupPackages(cwd)
|
|
598
729
|
.filter((entry) => !entry.inside && entry.version !== recipe.version)
|
|
599
730
|
.map(({ package: name, path, version }) => ({ package: name, path, version }));
|
|
731
|
+
const manifests = new Map();
|
|
600
732
|
if ((recipe.dependencyMoves?.length ?? 0) > 0 || recipe.pins.length > 0) {
|
|
601
733
|
for (const rel of scan(cwd, "**/package.json")) {
|
|
602
734
|
const abs = join(cwd, rel);
|
|
@@ -609,10 +741,29 @@ export function computeUpgrade(cwd, recipe, write, allowDowngrade = false, exact
|
|
|
609
741
|
pins.push({ file: rel, ...change });
|
|
610
742
|
for (const d of pinned.downgrades)
|
|
611
743
|
downgrades.push({ file: rel, ...d });
|
|
744
|
+
if (pinned.text !== original)
|
|
745
|
+
manifests.set(resolve(abs), pinned.text);
|
|
612
746
|
if (write && pinned.text !== original)
|
|
613
747
|
writeFileSync(abs, pinned.text);
|
|
614
748
|
}
|
|
615
749
|
}
|
|
750
|
+
// Read against the manifests as this upgrade leaves them, so a dry run lists what --write drops.
|
|
751
|
+
const linkLocks = plainFileAt(cwd, BUN_LOCK) ? staleLinkLocks(resolve(cwd), manifests) : [];
|
|
752
|
+
let lockPruned = false;
|
|
753
|
+
if (write && linkLocks.length > 0) {
|
|
754
|
+
const lockPath = join(cwd, BUN_LOCK);
|
|
755
|
+
const pruned = pruneLinkLocks(readFileSync(lockPath, "utf8"), linkLocks.map((entry) => entry.package));
|
|
756
|
+
if (pruned !== undefined) {
|
|
757
|
+
writeFileSync(lockPath, pruned);
|
|
758
|
+
lockPruned = true;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
for (const { change, text, abs } of agentPinEdits(cwd, recipe.version, above)) {
|
|
762
|
+
agentPins.push(change);
|
|
763
|
+
planned.set(change.file, text);
|
|
764
|
+
if (write)
|
|
765
|
+
writeFileSync(abs, Buffer.from(text, "latin1"));
|
|
766
|
+
}
|
|
616
767
|
if (recipe.importMoves.length > 0) {
|
|
617
768
|
for (const rel of scan(cwd, SOURCE_GLOB)) {
|
|
618
769
|
const abs = join(cwd, rel);
|
|
@@ -650,12 +801,16 @@ export function computeUpgrade(cwd, recipe, write, allowDowngrade = false, exact
|
|
|
650
801
|
return {
|
|
651
802
|
version: recipe.version,
|
|
652
803
|
pins,
|
|
804
|
+
agentPins,
|
|
653
805
|
dependencyMoves,
|
|
654
806
|
importMoves,
|
|
655
807
|
downgrades,
|
|
656
808
|
retiredMarkers,
|
|
657
809
|
linkedOutside,
|
|
658
|
-
|
|
810
|
+
linkedSkew: linkedSkew(cwd, recipe.version),
|
|
811
|
+
strayPins: strayPins(cwd, recipe.version, planned),
|
|
812
|
+
linkLocks,
|
|
813
|
+
lockPruned,
|
|
659
814
|
notes: recipe.notes ?? [],
|
|
660
815
|
};
|
|
661
816
|
}
|
|
@@ -670,11 +825,14 @@ function renderPlan(plan, write, from, steps) {
|
|
|
670
825
|
}
|
|
671
826
|
lines.push("");
|
|
672
827
|
if (plan.pins.length === 0 &&
|
|
828
|
+
plan.agentPins.length === 0 &&
|
|
673
829
|
plan.dependencyMoves.length === 0 &&
|
|
674
830
|
plan.importMoves.length === 0 &&
|
|
675
831
|
plan.retiredMarkers.length === 0 &&
|
|
676
832
|
plan.linkedOutside.length === 0 &&
|
|
677
|
-
plan.
|
|
833
|
+
plan.linkedSkew.length === 0 &&
|
|
834
|
+
plan.strayPins.length === 0 &&
|
|
835
|
+
plan.linkLocks.length === 0) {
|
|
678
836
|
lines.push("Already up to date - no changes.");
|
|
679
837
|
return lines.join("\n");
|
|
680
838
|
}
|
|
@@ -694,6 +852,14 @@ function renderPlan(plan, write, from, steps) {
|
|
|
694
852
|
lines.push(` ${p.file} ${p.name}: ${p.from} → ${p.to}`);
|
|
695
853
|
lines.push("");
|
|
696
854
|
}
|
|
855
|
+
if (plan.agentPins.length > 0) {
|
|
856
|
+
lines.push(`${verb} ${plan.agentPins.length} MCP launch pin(s):`);
|
|
857
|
+
for (const p of plan.agentPins)
|
|
858
|
+
lines.push(` ${p.file} @nifrajs/cli: ${p.from.join(", ")} → ${p.to}`);
|
|
859
|
+
if (write)
|
|
860
|
+
lines.push(" Restart your agent so it launches the new nifra MCP server.");
|
|
861
|
+
lines.push("");
|
|
862
|
+
}
|
|
697
863
|
if (plan.importMoves.length > 0) {
|
|
698
864
|
const total = plan.importMoves.reduce((n, m) => n + m.count, 0);
|
|
699
865
|
lines.push(`${verb} ${total} import move(s) across ${plan.importMoves.length} file(s):`);
|
|
@@ -734,6 +900,18 @@ function renderPlan(plan, write, from, steps) {
|
|
|
734
900
|
}
|
|
735
901
|
lines.push("");
|
|
736
902
|
}
|
|
903
|
+
if (plan.linkLocks.length > 0) {
|
|
904
|
+
lines.push(plan.lockPruned
|
|
905
|
+
? `Dropped ${plan.linkLocks.length} file: package(s) from bun.lock, whose recorded dependencies Bun never refreshes; \`bun install\` reads each linked package.json again:`
|
|
906
|
+
: write
|
|
907
|
+
? `bun.lock records stale dependencies for ${plan.linkLocks.length} file: package(s), which Bun never refreshes; run \`${linkLockUpdate(plan.linkLocks)}\`:`
|
|
908
|
+
: `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:`);
|
|
909
|
+
for (const entry of plan.linkLocks)
|
|
910
|
+
lines.push(` ${entry.package} (file:${entry.path}) ${entry.changes.map(describeChange).join(", ")}`);
|
|
911
|
+
if (plan.lockPruned)
|
|
912
|
+
lines.push(" Run `bun install` before committing bun.lock: until it records these packages again, `bun install --frozen-lockfile` fails.");
|
|
913
|
+
lines.push("");
|
|
914
|
+
}
|
|
737
915
|
for (const note of plan.notes)
|
|
738
916
|
lines.push(`note: ${note}`);
|
|
739
917
|
if (!write)
|
|
@@ -741,6 +919,19 @@ function renderPlan(plan, write, from, steps) {
|
|
|
741
919
|
return lines.join("\n").trimEnd();
|
|
742
920
|
}
|
|
743
921
|
/** Explain a refused rollback: which pins would roll back, why it's blocked, and the escape hatch. */
|
|
922
|
+
/** The linked repositories to upgrade first, each with the commands that move it to `version`. */
|
|
923
|
+
function renderLinkedSkew(version, skew, cwd, allowed) {
|
|
924
|
+
const lines = [
|
|
925
|
+
`${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").`,
|
|
926
|
+
];
|
|
927
|
+
for (const entry of skew) {
|
|
928
|
+
const at = relative(cwd, entry.path).split(sep).join("/") || ".";
|
|
929
|
+
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`);
|
|
930
|
+
}
|
|
931
|
+
if (!allowed)
|
|
932
|
+
lines.push("Upgrade each one first, then run this again. --allow-linked-skew upgrades this project anyway.");
|
|
933
|
+
return lines.join("\n");
|
|
934
|
+
}
|
|
744
935
|
function renderDowngradeRefusal(version, downgrades) {
|
|
745
936
|
return [
|
|
746
937
|
`nifra upgrade → ${version}: refusing to DOWNGRADE ${downgrades.length} pin(s) below what's installed.`,
|
|
@@ -816,6 +1007,28 @@ export function upgradeTargets(cliVersion) {
|
|
|
816
1007
|
versions.push(cliVersion);
|
|
817
1008
|
return versions.sort(compareSemverSpec);
|
|
818
1009
|
}
|
|
1010
|
+
/** Each target with the notes of every release after the installed one: what an app can observe
|
|
1011
|
+
* changing on the way up. Older releases are listed by version only. */
|
|
1012
|
+
function renderUpgradeList(targets, installed, notes) {
|
|
1013
|
+
const lines = [
|
|
1014
|
+
installed === null
|
|
1015
|
+
? "available upgrade targets:"
|
|
1016
|
+
: `available upgrade targets (this project declares ${installed}):`,
|
|
1017
|
+
];
|
|
1018
|
+
for (const version of targets) {
|
|
1019
|
+
const ahead = installed === null || compareSemverSpec(version, installed) > 0;
|
|
1020
|
+
lines.push(` ${version}${version === installed ? " (declared)" : ""}`);
|
|
1021
|
+
if (!ahead)
|
|
1022
|
+
continue;
|
|
1023
|
+
const list = notes[version] ?? [];
|
|
1024
|
+
if (list.length === 0)
|
|
1025
|
+
lines.push(" no change an app can observe");
|
|
1026
|
+
for (const note of list)
|
|
1027
|
+
lines.push(` - ${note}`);
|
|
1028
|
+
}
|
|
1029
|
+
lines.push("", "A newer release upgrades with its own CLI: bunx @nifrajs/cli@<version> upgrade <version>");
|
|
1030
|
+
return lines.join("\n");
|
|
1031
|
+
}
|
|
819
1032
|
/** The command that runs `version`'s own CLI with the same flags. `version` is a validated release. */
|
|
820
1033
|
function newerCliCommand(version, options) {
|
|
821
1034
|
const flags = [
|
|
@@ -833,12 +1046,12 @@ export async function runUpgrade(cwd, options) {
|
|
|
833
1046
|
const cliVersion = options.cliVersion ?? listRecipeVersions().at(-1) ?? "0.0.0";
|
|
834
1047
|
const targets = upgradeTargets(cliVersion);
|
|
835
1048
|
if (options.list) {
|
|
1049
|
+
const installed = installedGroupVersion(cwd);
|
|
1050
|
+
const notes = Object.fromEntries(targets.map((v) => [v, getRecipe(v)?.notes ?? []]));
|
|
836
1051
|
if (options.json)
|
|
837
|
-
console.log(JSON.stringify({ versions: targets, cliVersion }, null, 2));
|
|
838
|
-
else
|
|
839
|
-
console.log(
|
|
840
|
-
`A newer release upgrades with its own CLI: bunx @nifrajs/cli@<version> upgrade <version>`);
|
|
841
|
-
}
|
|
1052
|
+
console.log(JSON.stringify({ versions: targets, cliVersion, installed, notes }, null, 2));
|
|
1053
|
+
else
|
|
1054
|
+
console.log(renderUpgradeList(targets, installed, notes));
|
|
842
1055
|
return true;
|
|
843
1056
|
}
|
|
844
1057
|
const { version } = options;
|
|
@@ -882,7 +1095,8 @@ export async function runUpgrade(cwd, options) {
|
|
|
882
1095
|
const from = installedGroupVersion(cwd);
|
|
883
1096
|
const recipe = chainRecipes(version, from);
|
|
884
1097
|
// Fail-closed on rollback: a dry pass writes nothing, so we can refuse before any package.json is touched.
|
|
885
|
-
const
|
|
1098
|
+
const above = (await ancestorPins(cwd)).owned;
|
|
1099
|
+
const preview = computeUpgrade(cwd, recipe, false, allowDowngrade, exact, above);
|
|
886
1100
|
if (preview.downgrades.length > 0) {
|
|
887
1101
|
if (options.json) {
|
|
888
1102
|
console.log(JSON.stringify({ ...preview, from, steps: recipe.steps, write: false, refused: "downgrade" }, null, 2));
|
|
@@ -892,9 +1106,21 @@ export async function runUpgrade(cwd, options) {
|
|
|
892
1106
|
}
|
|
893
1107
|
return false;
|
|
894
1108
|
}
|
|
1109
|
+
// Refused before anything is written: the linked repository fails at the first merge(), not here.
|
|
1110
|
+
if (preview.linkedSkew.length > 0 && options.allowLinkedSkew !== true) {
|
|
1111
|
+
if (options.json) {
|
|
1112
|
+
console.log(JSON.stringify({ ...preview, from, steps: recipe.steps, write: false, refused: "linked-skew" }, null, 2));
|
|
1113
|
+
}
|
|
1114
|
+
else {
|
|
1115
|
+
if (!write)
|
|
1116
|
+
console.log(renderPlan(preview, false, from, recipe.steps));
|
|
1117
|
+
console.error(renderLinkedSkew(recipe.version, preview.linkedSkew, cwd, false));
|
|
1118
|
+
}
|
|
1119
|
+
return false;
|
|
1120
|
+
}
|
|
895
1121
|
const captureHooks = write && options.hooks !== false;
|
|
896
1122
|
const before = captureHooks ? await hookReportBefore(cwd) : undefined;
|
|
897
|
-
const plan = write ? computeUpgrade(cwd, recipe, true, allowDowngrade, exact) : preview;
|
|
1123
|
+
const plan = write ? computeUpgrade(cwd, recipe, true, allowDowngrade, exact, above) : preview;
|
|
898
1124
|
const hooks = before === undefined ? undefined : await hookScopeAcross(cwd, before);
|
|
899
1125
|
// Verify only makes sense once edits are on disk. Default on after --write; opt out with --no-verify.
|
|
900
1126
|
const verify = write && options.verify !== false;
|
|
@@ -915,6 +1141,8 @@ export async function runUpgrade(cwd, options) {
|
|
|
915
1141
|
return ok;
|
|
916
1142
|
}
|
|
917
1143
|
console.log(renderPlan(plan, write, from, recipe.steps));
|
|
1144
|
+
if (plan.linkedSkew.length > 0)
|
|
1145
|
+
console.warn(`\n${renderLinkedSkew(recipe.version, plan.linkedSkew, cwd, true)}`);
|
|
918
1146
|
if (hooks !== undefined)
|
|
919
1147
|
console.log(`\n${renderHookScope(hooks)}`);
|
|
920
1148
|
if (verify) {
|