dev-booster 1.17.2 → 1.18.1

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 (48) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +62 -0
  3. package/template/.devbooster/MANIFEST.md +34 -1
  4. package/template/.devbooster/boosters/advisor.md +5 -0
  5. package/template/.devbooster/boosters/audit.md +20 -0
  6. package/template/.devbooster/boosters/auto-triage.md +5 -0
  7. package/template/.devbooster/boosters/backend.md +12 -0
  8. package/template/.devbooster/boosters/builder.md +5 -0
  9. package/template/.devbooster/boosters/code-audit.md +19 -0
  10. package/template/.devbooster/boosters/coder.md +5 -0
  11. package/template/.devbooster/boosters/create.md +5 -0
  12. package/template/.devbooster/boosters/debug.md +19 -0
  13. package/template/.devbooster/boosters/deploy.md +12 -0
  14. package/template/.devbooster/boosters/discovery.md +5 -0
  15. package/template/.devbooster/boosters/frontend.md +12 -0
  16. package/template/.devbooster/boosters/implementation.md +5 -0
  17. package/template/.devbooster/boosters/investigation.md +5 -0
  18. package/template/.devbooster/boosters/performance.md +12 -0
  19. package/template/.devbooster/boosters/planning.md +5 -0
  20. package/template/.devbooster/boosters/refactor.md +12 -0
  21. package/template/.devbooster/boosters/review.md +12 -0
  22. package/template/.devbooster/boosters/security.md +14 -0
  23. package/template/.devbooster/boosters/smart-task.md +27 -16
  24. package/template/.devbooster/boosters/stack-refresh.md +20 -0
  25. package/template/.devbooster/boosters/testing.md +12 -0
  26. package/template/.devbooster/hub/knowledge/angular-patterns.md +185 -0
  27. package/template/.devbooster/hub/knowledge/dependency-guide.md +175 -0
  28. package/template/.devbooster/hub/knowledge/eslint-migration.md +206 -0
  29. package/template/.devbooster/hub/knowledge/index.md +91 -0
  30. package/template/.devbooster/hub/knowledge/migration-guides.md +137 -0
  31. package/template/.devbooster/hub/knowledge/monorepo-patterns.md +121 -0
  32. package/template/.devbooster/hub/knowledge/nestjs-patterns.md +185 -0
  33. package/template/.devbooster/hub/knowledge/nextjs-pitfalls.md +226 -0
  34. package/template/.devbooster/hub/knowledge/nodejs-patterns.md +148 -0
  35. package/template/.devbooster/hub/knowledge/package-manager-patterns.md +143 -0
  36. package/template/.devbooster/hub/knowledge/prisma-postgresql-patterns.md +188 -0
  37. package/template/.devbooster/hub/knowledge/react-patterns.md +500 -0
  38. package/template/.devbooster/hub/knowledge/tailwind-shadcn-patterns.md +146 -0
  39. package/template/.devbooster/hub/knowledge/tanstack-patterns.md +278 -0
  40. package/template/.devbooster/hub/knowledge/testing-patterns.md +164 -0
  41. package/template/.devbooster/hub/knowledge/trpc-patterns.md +212 -0
  42. package/template/.devbooster/hub/knowledge/typescript-patterns.md +219 -0
  43. package/template/.devbooster/hub/knowledge/upgrade-fallout.md +154 -0
  44. package/template/.devbooster/hub/knowledge/vite-patterns.md +177 -0
  45. package/template/.devbooster/rules/GUIDE.md +24 -0
  46. package/template/.devbooster/rules/PROTOCOL.md +3 -2
  47. package/template/.devbooster/rules/TRIGGERS.md +14 -0
  48. package/template/DEVBOOSTER_INIT.md +22 -1
@@ -0,0 +1,226 @@
1
+ # ▲ Next.js Pitfalls
2
+
3
+ > **Purpose:** Common pitfalls and issues in Next.js 16+ projects
4
+ > **Primary official sources:** [Next.js TypeScript configuration](https://nextjs.org/docs/app/api-reference/config/next-config-js/typescript) · [Next.js 16 upgrade guide](https://nextjs.org/docs/app/guides/upgrading/version-16) · [Next.js Image configuration](https://nextjs.org/docs/app/api-reference/components/image#configuration-options)
5
+
6
+ ## Project Convention Decision Rule
7
+
8
+ Before applying this guidance, verify the installed versions, router and rendering model, local rules, existing abstractions, configuration, and tests. Preserve a valid established project convention; do not replace it only because another documented approach is also valid. Use official sources to verify API behavior, compatibility, constraints, and migrations. Recommend a change only when the developer requests it or evidence shows the current approach is incompatible, unsafe, deprecated, broken, or responsible for a verified issue.
9
+
10
+ ---
11
+
12
+ ## Table of Contents
13
+
14
+ 1. [Framework-level Masking — ignoreBuildErrors](#framework-level-masking)
15
+ 2. [Legacy Build-time Lint Masking — Next.js 15 and Earlier](#legacy-build-time-lint-masking)
16
+ 3. [Broken Lint Script After a Next.js 16 Upgrade](#broken-lint-script-after-a-nextjs-16-upgrade)
17
+ 4. [Invalid next.config Properties](#invalid-nextconfig-properties)
18
+ 5. [TSConfig Changes Triggered by Next.js](#tsconfig-changes-triggered-by-nextjs)
19
+ 6. [New Lint Findings After an Upgrade](#new-lint-findings-after-an-upgrade)
20
+ 7. [Warnings Need Triage](#warnings-need-triage)
21
+ 8. [Choose Server and Client Boundaries Deliberately](#choose-server-and-client-boundaries-deliberately)
22
+ 9. [Use Route Loading and Error Boundaries Before Rebuilding Them](#use-route-loading-and-error-boundaries-before-rebuilding-them)
23
+ 10. [Avoid Hydration Mismatches by Preserving Initial Output](#avoid-hydration-mismatches-by-preserving-initial-output)
24
+
25
+ ---
26
+
27
+ ## Framework-level Masking
28
+
29
+ ### Problem
30
+ The `typescript.ignoreBuildErrors: true` option in `next.config.*` skips Next.js's built-in TypeScript type-checking step during production builds. It does not run the check and suppress its errors, so it can allow type errors to reach deployment.
31
+
32
+ *Source: [Next.js TypeScript configuration](https://nextjs.org/docs/app/api-reference/config/next-config-js/typescript)*
33
+
34
+ > The official Next.js documentation warns: "If disabled, be sure you are running type checks as part of your build or deploy process, otherwise this can be very dangerous."
35
+
36
+ ### Code (symptom)
37
+ ```js
38
+ // next.config.js — bypasses Next.js type checking
39
+ typescript: { ignoreBuildErrors: true }
40
+ ```
41
+
42
+ ### Fix
43
+ Remove the flag; `false` is the default:
44
+ ```js
45
+ module.exports = {
46
+ typescript: {
47
+ ignoreBuildErrors: false,
48
+ },
49
+ }
50
+ ```
51
+
52
+ If a project temporarily keeps the flag, run an explicit type check such as `tsc --noEmit` in CI or the deployment pipeline.
53
+
54
+ ---
55
+
56
+ ## Legacy Build-time Lint Masking
57
+
58
+ **Evidence:** Field-validated in a real audit.
59
+
60
+ ### Applicability
61
+ Next.js 15 and earlier. The `eslint.ignoreDuringBuilds` option was supported in these versions and allowed production builds to complete with ESLint errors.
62
+
63
+ *Source: [Next.js 15 ESLint configuration](https://nextjs.org/docs/15/app/api-reference/config/next-config-js/eslint)*
64
+
65
+ ### Code (symptom)
66
+ ```js
67
+ module.exports = {
68
+ eslint: {
69
+ ignoreDuringBuilds: true,
70
+ },
71
+ }
72
+ ```
73
+
74
+ ### Why it matters
75
+ This setting bypasses Next.js's built-in build-time lint failure. It may have been introduced as a temporary deployment workaround, but it hides lint failures unless ESLint runs independently in CI or another verified workflow.
76
+
77
+ ### Version boundary
78
+ Next.js 16 removed `next lint`, build-time linting, and the `eslint` key in `next.config.*`. For Next.js 16+, remove this legacy config and run ESLint directly as a separate validation command.
79
+
80
+ ---
81
+
82
+ ## Broken Lint Script After a Next.js 16 Upgrade
83
+
84
+ ### Problem
85
+ Starting with Next.js 16, `next lint` is removed. `next build` no longer runs linting, and the `eslint` key in `next.config.*` is removed.
86
+
87
+ Invoking the removed command can produce an error such as:
88
+ ```
89
+ Invalid project directory provided, no such directory: .../lint
90
+ ```
91
+
92
+ ### Fix
93
+ Run ESLint directly and make linting a separate CI or deployment step:
94
+ ```json
95
+ {
96
+ "scripts": {
97
+ "lint": "eslint ."
98
+ }
99
+ }
100
+ ```
101
+
102
+ For flat-config setup and migration details, see [ESLint Migration](./eslint-migration.md).
103
+
104
+ ---
105
+
106
+ ## Invalid next.config Properties
107
+
108
+ ### Problem
109
+ A property in an unsupported location in `next.config.*` can produce a configuration warning or be ignored. For example, `unoptimized` is not a top-level Next.js config option.
110
+
111
+ ### Code (symptom)
112
+ ```js
113
+ // Invalid location
114
+ module.exports = { unoptimized: true }
115
+
116
+ // Valid location
117
+ module.exports = { images: { unoptimized: true } }
118
+ ```
119
+
120
+ ### Fix
121
+ Use the documented `images.unoptimized` option:
122
+ ```js
123
+ module.exports = {
124
+ images: {
125
+ unoptimized: true,
126
+ },
127
+ }
128
+ ```
129
+
130
+ ---
131
+
132
+ ## TSConfig Changes Triggered by Next.js
133
+
134
+ ### Problem
135
+ When TypeScript is added to a project, `next dev` and `next build` can create or update `tsconfig.json` with recommended settings and generated-type includes.
136
+
137
+ ### Handling
138
+ - Review the complete `tsconfig.json` diff and identify why each change was made.
139
+ - Keep required generated-type includes, such as `.next/types/**/*.ts`, when the project uses Next.js route-aware types.
140
+ - Validate compiler-option changes, including `moduleResolution`, against the project's Next.js and TypeScript versions before accepting or reverting them.
141
+ - Commit intentional configuration changes so they are visible in review.
142
+
143
+ ---
144
+
145
+ ## New Lint Findings After an Upgrade
146
+
147
+ ### Problem
148
+ After migrating to ESLint flat config or updating Next.js, ESLint, or plugins, new rules or changed analysis can reveal existing issues or introduce upgrade-specific incompatibilities.
149
+
150
+ ### Common examples
151
+ - A callback referenced before declaration
152
+ - Non-deterministic logic during render, such as `Math.random()` in a component body
153
+ - An unused import that was previously not reported
154
+
155
+ ### Handling
156
+ 1. Analyze each finding individually.
157
+ 2. Classify it as a pre-existing issue now detected, a configuration change, or an upgrade regression.
158
+ 3. Apply a specific fix or document a narrowly justified exception.
159
+
160
+ ---
161
+
162
+ ## Warnings Need Triage
163
+
164
+ ### Problem
165
+ A successful build can still emit warnings about configuration, deprecations, or behavior that affects production.
166
+
167
+ ### Checklist
168
+ After a framework upgrade:
169
+ 1. Run `next build` and capture the full output.
170
+ 2. Review warnings as well as errors.
171
+ 3. Determine the source, impact, and owner of each warning.
172
+ 4. Fix the warning or document an accepted disposition according to the project's release policy.
173
+
174
+ ### Rule of thumb
175
+ **A passing build with warnings requires triage; warnings are neither automatically deploy-blocking nor automatically acceptable.**
176
+
177
+ ---
178
+
179
+ ## Choose Server and Client Boundaries Deliberately
180
+
181
+ ### Decision
182
+ In the App Router, components are Server Components by default. Add `'use client'` only when the component or one of its direct responsibilities requires client-side capabilities such as state, Effects, browser APIs, or event handlers.
183
+
184
+ ### Verify first
185
+ - Identify the active router; do not apply App Router guidance to a Pages Router project.
186
+ - Keep the client boundary as narrow as the existing architecture permits.
187
+ - Inspect existing component boundaries and shared providers before moving a component to the client.
188
+ - Pass serializable props across the Server-to-Client boundary.
189
+
190
+ Do not convert a server-rendered subtree to a Client Component merely to solve a small interactive concern. Extract the interactive leaf when that preserves the project’s established composition pattern.
191
+
192
+ *Sources: [Next.js — Server and Client Components](https://nextjs.org/docs/app/getting-started/server-and-client-components) · [Next.js — use client](https://nextjs.org/docs/app/api-reference/directives/use-client)*
193
+
194
+ ---
195
+
196
+ ## Use Route Loading and Error Boundaries Before Rebuilding Them
197
+
198
+ ### Decision
199
+ For App Router route segments, inspect existing `loading.*`, `error.*`, and shared layout conventions before adding component-local loading or error state. These files define framework-native boundaries for the segment and its descendants.
200
+
201
+ ### Verify first
202
+ - Confirm whether the loading state is route-level, component-level, or owned by an existing client query abstraction.
203
+ - Preserve existing fallback, retry, error-reporting, and accessibility conventions.
204
+ - Do not use `loading.*` as a substitute for errors in a client-side mutation or interaction; use the project’s local feedback pattern there.
205
+ - Confirm the required error boundary shape for the installed Next version before creating one.
206
+
207
+ Use the smallest boundary that gives the intended user experience. A project may intentionally prefer a shared route skeleton or a local component state; preserve either approach when valid.
208
+
209
+ *Sources: [Next.js — Loading UI and Streaming](https://nextjs.org/docs/app/building-your-application/routing/loading-ui-and-streaming) · [Next.js — Error Handling](https://nextjs.org/docs/app/building-your-application/routing/error-handling)*
210
+
211
+ ---
212
+
213
+ ## Avoid Hydration Mismatches by Preserving Initial Output
214
+
215
+ ### Symptom
216
+ The server-rendered HTML differs from the first client render, producing a hydration warning, discarded markup, or visible flicker.
217
+
218
+ ### Verify first
219
+ Look for browser-only values (`window`, storage, viewport), time, randomness, locale, and data that changes between the server and first client render. Confirm whether the component is intended to render consistently on both sides.
220
+
221
+ ### Fix
222
+ Render the same initial output on server and client, then read browser-only state after mount when necessary. For an intentionally client-only widget, isolate it behind the project’s established client boundary rather than scattering hydration suppressions.
223
+
224
+ Do not use `suppressHydrationWarning` as a general fix; it is a narrow escape hatch and does not reconcile the underlying output.
225
+
226
+ *Source: [Next.js — React Hydration Error](https://nextjs.org/docs/messages/react-hydration-error)*
@@ -0,0 +1,148 @@
1
+ # Node.js Runtime Patterns
2
+
3
+ > **Purpose:** Diagnose and prevent common Node.js runtime, module, environment, and script failures.
4
+ > **Primary official sources:** [Node.js documentation](https://nodejs.org/docs/latest/api/) · [npm package.json documentation](https://docs.npmjs.com/cli/v11/configuring-npm/package-json) · [npm scripts documentation](https://docs.npmjs.com/cli/v11/using-npm/scripts)
5
+
6
+ ## Project Convention Decision Rule
7
+
8
+ Before applying this guidance, verify the installed versions, local rules, existing abstractions, configuration, runtime environment, and tests. Preserve a valid established project convention; do not replace it only because another documented approach is also valid. Use official sources to verify API behavior, compatibility, constraints, and migrations. Recommend a change only when the developer requests it or evidence shows the current approach is incompatible, unsafe, deprecated, broken, or responsible for a verified issue.
9
+
10
+ ---
11
+
12
+ ## Table of Contents
13
+
14
+ 1. [Runtime and Engines Misalignment](#runtime-and-engines-misalignment)
15
+ 2. [ESM and CommonJS Interoperability](#esm-and-commonjs-interoperability)
16
+ 3. [Environment Loading and Validation](#environment-loading-and-validation)
17
+ 4. [Unhandled Async Failures](#unhandled-async-failures)
18
+ 5. [Portable npm Scripts and Lifecycle Hooks](#portable-npm-scripts-and-lifecycle-hooks)
19
+ 6. [Version Manager, CI, and Container Alignment](#version-manager-ci-and-container-alignment)
20
+
21
+ ---
22
+
23
+ ## Runtime and Engines Misalignment
24
+
25
+ ### Symptom
26
+ A command works on one machine but fails in CI or production with syntax errors, unsupported APIs, native-module errors, or an `EBADENGINE` warning/error.
27
+
28
+ ### Verify first
29
+ ```sh
30
+ node --version
31
+ npm --version
32
+ node -p "process.version"
33
+ ```
34
+ Compare those values with the root `package.json` `engines`, the CI runtime setup, container base image, and any version-manager file. `engines` expresses compatibility metadata; enforcement depends on the package manager and its configuration. See [npm `engines`](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#engines).
35
+
36
+ ### Fix
37
+ - Define a tested Node range in `engines`; use an exact version only when reproducibility requires it.
38
+ - Select a Node version explicitly in CI and containers rather than relying on a runner or image default.
39
+ - Rebuild native dependencies after changing Node versions; do not reuse artifacts built against an incompatible ABI.
40
+ - Keep local version-manager configuration aligned with the supported range.
41
+
42
+ ---
43
+
44
+ ## ESM and CommonJS Interoperability
45
+
46
+ ### Symptom
47
+ `require is not defined`, `ERR_REQUIRE_ESM`, missing named exports, or different behavior between development and production builds.
48
+
49
+ ### Verify first
50
+ Inspect the closest `package.json` for `"type"`, the file extension (`.mjs`, `.cjs`, `.js`), and the dependency's documented exports. Node determines module interpretation from these inputs. See [Node.js modules: packages](https://nodejs.org/docs/latest/api/packages.html) and [ECMAScript modules](https://nodejs.org/docs/latest/api/esm.html).
51
+
52
+ ### Fix
53
+ - Choose one module system for new application code and declare it deliberately with `type` or explicit extensions.
54
+ - In ESM, import CommonJS through its default export when necessary, then read properties from that value.
55
+ - In CommonJS, use `import()` for an ESM-only dependency because synchronous `require()` has compatibility limits.
56
+ - Do not depend on undocumented deep imports or inferred named exports; use the dependency's public export map.
57
+
58
+ ```js
59
+ // CommonJS loading an ESM package
60
+ const loadTool = () => import('an-esm-only-package')
61
+
62
+ // ESM consuming CommonJS
63
+ import legacyPackage from 'legacy-package'
64
+ const { createClient } = legacyPackage
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Environment Loading and Validation
70
+
71
+ ### Symptom
72
+ A service starts with `undefined` configuration, uses development credentials in another environment, or fails only after handling traffic.
73
+
74
+ ### Verify first
75
+ Identify where configuration is loaded, which process owns it, and whether the expected variables are present without printing secrets:
76
+
77
+ ```sh
78
+ node -e "console.log(Boolean(process.env.REQUIRED_SETTING))"
79
+ ```
80
+ Node exposes the process environment through [`process.env`](https://nodejs.org/docs/latest/api/process.html#processenv). Recent Node releases also document loading `.env` files with [`--env-file`](https://nodejs.org/docs/latest/api/cli.html#--env-fileconfig); verify availability in the exact Node version in use before relying on it.
81
+
82
+ ### Fix
83
+ - Load configuration before importing or initializing code that reads it.
84
+ - Validate required variables, types, allowed values, and cross-field constraints at process startup; fail with variable names, never secret values.
85
+ - Treat environment values as strings until parsed and validated.
86
+ - Keep secrets out of source control and inject them through the deployment environment or an approved secret mechanism.
87
+
88
+ ---
89
+
90
+ ## Unhandled Async Failures
91
+
92
+ ### Symptom
93
+ A request hangs, an error appears as an unhandled rejection, or the process exits unexpectedly after an async operation fails.
94
+
95
+ ### Verify first
96
+ Trace every promise-returning call to an `await`/`return`/`.catch()`. Review the runtime's unhandled-rejection behavior for the deployed Node version: [Node.js `unhandledRejection`](https://nodejs.org/docs/latest/api/process.html#event-unhandledrejection).
97
+
98
+ ### Fix
99
+ - Await promises inside `try`/`catch` where recovery or translation is needed.
100
+ - Return promises from wrapper functions so callers can observe failures.
101
+ - At process boundaries, log actionable context, release resources, and exit or restart according to the service's supervision model.
102
+ - Do not use a global rejection handler as a substitute for local error handling; it is an observability and last-resort shutdown boundary.
103
+
104
+ ```js
105
+ async function readConfiguration() {
106
+ try {
107
+ return await fetchConfiguration()
108
+ } catch (error) {
109
+ throw new Error('Configuration could not be loaded', { cause: error })
110
+ }
111
+ }
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Portable npm Scripts and Lifecycle Hooks
117
+
118
+ ### Symptom
119
+ A script passes on one operating system but fails in CI, or an install unexpectedly runs build, download, or publish-related code.
120
+
121
+ ### Verify first
122
+ Review `scripts` and lifecycle names in `package.json`, then run the exact package-manager command used by CI. npm exposes lifecycle context through environment variables and has command-specific lifecycle behavior; see [npm scripts](https://docs.npmjs.com/cli/v11/using-npm/scripts) and [lifecycle scripts](https://docs.npmjs.com/cli/v11/using-npm/scripts#life-cycle-operation-order).
123
+
124
+ ### Fix
125
+ - Prefer Node-based scripts or cross-platform tooling over shell-specific syntax, utilities, and environment assignments.
126
+ - Make each script's inputs and outputs explicit; use package binaries through the package manager rather than assuming global installations.
127
+ - Keep `prepare`, `prepack`, `prepublishOnly`, and install hooks small and intentional. Verify which commands trigger each hook before placing builds or side effects there.
128
+ - Run install commands with lifecycle scripts disabled only as a diagnostic or controlled security measure, not as a permanent workaround for an unknown hook.
129
+
130
+ ---
131
+
132
+ ## Version Manager, CI, and Container Alignment
133
+
134
+ ### Problem
135
+ Node is pinned locally but not in CI or the deployment image, creating a runtime matrix that is neither tested nor supported.
136
+
137
+ ### Fix
138
+ Use one documented source of truth for the supported Node range, and make every execution environment select a compatible runtime:
139
+
140
+ | Environment | Check |
141
+ | --- | --- |
142
+ | Local development | Version-manager configuration and `node --version` |
143
+ | CI | Explicit setup action/task and cache key including Node and lockfile |
144
+ | Container | Explicit base-image tag and rebuild after runtime changes |
145
+ | Deployment | Platform runtime setting or image runtime |
146
+
147
+ ### Verify first
148
+ Print `node --version` at the start of CI and from the built container. Install from the committed lockfile, then run the same test/build commands that validate local development. For supported release lines and schedules, use the [Node.js release page](https://nodejs.org/en/about/previous-releases).
@@ -0,0 +1,143 @@
1
+ # Package Manager Patterns
2
+
3
+ > **Purpose:** Resolve reproducibility, dependency-resolution, workspace-scope, and security-report issues across npm, Yarn, and pnpm.
4
+ > **Primary official sources:** [npm CLI documentation](https://docs.npmjs.com/cli/) · [Yarn documentation](https://yarnpkg.com/configuration/manifest) · [pnpm documentation](https://pnpm.io/)
5
+
6
+ ## Project Convention Decision Rule
7
+
8
+ Before applying this guidance, verify the installed versions, local rules, package manager, lockfile, workspace layout, configuration, and tests. Preserve a valid established project convention; do not replace it only because another documented approach is also valid. Use official sources to verify API behavior, compatibility, constraints, and migrations. Recommend a change only when the developer requests it or evidence shows the current approach is incompatible, unsafe, deprecated, broken, or responsible for a verified issue.
9
+
10
+ ---
11
+
12
+ ## Table of Contents
13
+
14
+ 1. [Detect the Manager and Lockfile](#detect-the-manager-and-lockfile)
15
+ 2. [Override and Resolution Semantics](#override-and-resolution-semantics)
16
+ 3. [Peer Dependency Conflicts](#peer-dependency-conflicts)
17
+ 4. [Serialized Installs](#serialized-installs)
18
+ 5. [Audit Findings](#audit-findings)
19
+ 6. [Workspace Root Versus Package Scope](#workspace-root-versus-package-scope)
20
+ 7. [Frozen Lockfile Validation](#frozen-lockfile-validation)
21
+
22
+ ---
23
+
24
+ ## Detect the Manager and Lockfile
25
+
26
+ ### Symptom
27
+ An install rewrites the lockfile, resolves a different tree, or fails because a command was run with the wrong manager.
28
+
29
+ ### Verify first
30
+ Inspect the repository root for `packageManager` in `package.json`, manager configuration files, and lockfiles such as `package-lock.json`, `yarn.lock`, or `pnpm-lock.yaml`. The Corepack documentation explains the `packageManager` field and shims: [Node.js Corepack](https://nodejs.org/docs/latest/api/corepack.html).
31
+
32
+ ### Fix
33
+ - Use the manager declared by the repository; do not introduce or regenerate another manager's lockfile.
34
+ - Treat one committed lockfile as the install-resolution authority for a repository.
35
+ - When the intended manager is ambiguous, inspect CI and contributor documentation before changing dependencies.
36
+ - Pin the manager release through the repository's supported mechanism, then ensure CI uses the same release family.
37
+
38
+ ---
39
+
40
+ ## Override and Resolution Semantics
41
+
42
+ ### Problem
43
+ A transitive dependency needs a security or compatibility fix, but editing a lockfile directly is fragile and will be overwritten.
44
+
45
+ ### Verify first
46
+ Identify the full dependency path and confirm the replacement version is compatible. Then use the manager's native manifest field:
47
+
48
+ | Manager | Manifest mechanism | Official reference |
49
+ | --- | --- | --- |
50
+ | npm | `overrides` | [npm `overrides`](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#overrides) |
51
+ | Yarn | `resolutions` | [Yarn manifest `resolutions`](https://yarnpkg.com/configuration/manifest#resolutions) |
52
+ | pnpm | `pnpm.overrides` | [pnpm overrides](https://pnpm.io/package_json#pnpmoverrides) |
53
+
54
+ ### Fix
55
+ - Put the override where that manager resolves dependencies, normally the root manifest for a workspace repository.
56
+ - Scope it as narrowly as the manager supports; document the reason and remove it when upstream constraints no longer require it.
57
+ - Reinstall with the declared manager, review the lockfile diff, and test the affected dependency path.
58
+ - Do not assume the fields are interchangeable: selector syntax, allowed locations, and direct-dependency rules differ by manager.
59
+
60
+ ---
61
+
62
+ ## Peer Dependency Conflicts
63
+
64
+ ### Symptom
65
+ Installation reports incompatible peers, installs multiple host versions, or runtime plugins fail because they are connected to an unexpected host package.
66
+
67
+ ### Verify first
68
+ Read the peer range from the package reporting the conflict and identify the actual host version selected by the lockfile. A peer dependency expresses compatibility with a package supplied by the consumer; see [npm peer dependencies](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#peerdependencies) and [pnpm peer dependencies](https://pnpm.io/npmrc#strict-peer-dependencies).
69
+
70
+ ### Fix
71
+ 1. Prefer versions whose peer ranges overlap.
72
+ 2. Upgrade or replace the dependent package if it does not support the selected host.
73
+ 3. Use a documented compatibility bridge only after testing the integration.
74
+ 4. Avoid permanently suppressing peer checks. A flag can unblock diagnosis, but it does not make an unsupported runtime combination safe.
75
+
76
+ ---
77
+
78
+ ## Serialized Installs
79
+
80
+ ### Symptom
81
+ Concurrent jobs or processes corrupt a lockfile, contend for package-manager state, or publish nondeterministic dependency changes.
82
+
83
+ ### Fix
84
+ - Make dependency updates a serialized workflow: one writer updates the manifest and lockfile, then commits both together.
85
+ - Keep CI installs read-only with respect to the lockfile.
86
+ - Avoid sharing mutable package-manager caches or store directories across concurrent jobs unless the tool and cache backend support it safely.
87
+ - Separate dependency-update automation from build/test jobs that only consume the committed resolution.
88
+
89
+ ### Verify first
90
+ Run a clean install twice in separate workspaces, then confirm the lockfile and dependency tree do not change. Use the manager's own listing/why command to verify the selected version.
91
+
92
+ ---
93
+
94
+ ## Audit Findings
95
+
96
+ ### Symptom
97
+ An audit reports vulnerabilities and a bulk auto-fix proposes major upgrades, lockfile churn, or removal of required packages.
98
+
99
+ ### Verify first
100
+ For each finding, determine whether the vulnerable package is reachable in the shipped runtime, which version introduces the fix, and whether the advisory applies to the supported deployment path. npm documents its audit command and report format in [npm audit](https://docs.npmjs.com/auditing-package-dependencies-for-security-vulnerabilities).
101
+
102
+ ### Fix
103
+ - Prioritize direct, runtime-reachable, exploitable dependencies.
104
+ - Upgrade the owning direct dependency when possible; use a narrowly scoped override only when necessary.
105
+ - Review major-version changes and test behavior instead of blindly accepting forceful remediation.
106
+ - Record accepted risk with scope and review conditions when no compatible fix exists.
107
+
108
+ An audit is an input to risk assessment, not proof that an application is exploitable or safe.
109
+
110
+ ---
111
+
112
+ ## Workspace Root Versus Package Scope
113
+
114
+ ### Problem
115
+ A command runs against the wrong package, configuration appears ignored, or a dependency is added to the root when it belongs to an application/library package.
116
+
117
+ ### Verify first
118
+ Confirm the current directory, workspace declaration, and package target. npm documents workspace targeting in [npm workspaces](https://docs.npmjs.com/cli/v11/using-npm/workspaces); Yarn and pnpm have equivalent workspace-aware command support.
119
+
120
+ ### Fix
121
+ - Put runtime and library dependencies in the package that imports them.
122
+ - Keep root tooling dependencies at the root only when the root owns the command or configuration.
123
+ - Use explicit workspace selectors for install, run, test, and publish operations.
124
+ - Avoid assuming a command's default scope; root and workspace behavior is manager- and command-specific.
125
+
126
+ ---
127
+
128
+ ## Frozen Lockfile Validation
129
+
130
+ ### Symptom
131
+ CI succeeds after silently modifying a lockfile, or a clean checkout cannot reproduce the committed dependency tree.
132
+
133
+ ### Fix
134
+ Use the manager's immutable/frozen validation mode in CI:
135
+
136
+ | Manager | Typical validation command | Reference |
137
+ | --- | --- | --- |
138
+ | npm | `npm ci` | [npm ci](https://docs.npmjs.com/cli/v11/commands/npm-ci) |
139
+ | Yarn | `yarn install --immutable` | [Yarn install](https://yarnpkg.com/cli/install) |
140
+ | pnpm | `pnpm install --frozen-lockfile` | [pnpm install](https://pnpm.io/cli/install) |
141
+
142
+ ### Verify first
143
+ Start from a clean checkout, run the applicable command, then confirm no manifest or lockfile changes are produced. Use the exact manager release declared by the repository.